From 34e25ebda57a7f5a4f28d0ff923ae27daf5c68b2 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Wed, 6 Mar 2019 15:04:04 -0500 Subject: Another big change! --- system/boot.lua | 21 +++++++++++++++------ system/desktop.lua | 18 +++++++++++++++--- system/login.lua | 1 + system/post-setup.lua | 14 ++++++++++++-- system/reset.lua | 36 ++++++++++++++++++++++++++++++++++++ system/skel/.background | 13 +++++++++++++ 6 files changed, 92 insertions(+), 11 deletions(-) create mode 100644 system/login.lua create mode 100644 system/reset.lua create mode 100644 system/skel/.background (limited to 'system') diff --git a/system/boot.lua b/system/boot.lua index 3361100..08d5d64 100644 --- a/system/boot.lua +++ b/system/boot.lua @@ -20,7 +20,7 @@ term.clear() term.setCursorPos(1,1) print("Starting up bits-UI ".. version .."...") -sleep(3) +sleep(2) if term.isColor() then term.setTextColor(colors.green) @@ -31,7 +31,7 @@ else os.shutdown() end -sleep(3) +sleep(2) if fs.exists(desktop) then term.setTextColor(colors.green) @@ -43,7 +43,7 @@ else os.shutdown() end -sleep(3) +sleep(2) if fs.exists("/home") then term.setTextColor(colors.green) @@ -54,7 +54,16 @@ else print("[OK] Home directory has been created...") end -sleep(3) +if fs.exists("/etc") then + term.setTextColor(colors.green) + print("[OK] Etc has been found...") +else + fs.makeDir("/etc") + term.setTextColor(colors.green) + print("[OK] Etc directory has been created...") +end + +sleep(2) if fs.exists("/home/.config") then term.setTextColor(colors.green) @@ -69,9 +78,9 @@ else shell.run("/system/post-setup.lua") end -sleep(3) +sleep(2) term.setTextColor(colors.green) print("[DONE] Boot sequence is completed...") term.setTextColor(colors.white) -sleep(3) +sleep(2) shell.run(desktop) \ No newline at end of file diff --git a/system/desktop.lua b/system/desktop.lua index e0afe4f..75598c9 100644 --- a/system/desktop.lua +++ b/system/desktop.lua @@ -13,24 +13,36 @@ GNU General Public License for more details. ]]-- +os.loadAPI("/system/apis/flib.lua") +local backgroundColour = 32768 +local backgroundImage = "/home/.background" +local panelColour = 8192 +local appTitle = "[Apps]" + function titleBar() local time = os.time() local formattedTime = textutils.formatTime(time, false) term.setCursorPos(1,1) - term.setBackgroundColor(colors.green) + term.setBackgroundColor(panelColour) term.setTextColor(1) term.clearLine() term.setCursorPos(2, 1) - print("[Apps]") + print(appTitle) term.setCursorPos(44, 1) print(formattedTime) end function drawDesktop() - term.setBackgroundColor(colors.black) + term.setBackgroundColor(backgroundColour) term.clear() + bground = paintutils.loadImage(backgroundImage) + paintutils.drawImage(bground,1,1) titleBar() end +--[[ + if fs.exists("/programs") then +end +]] drawDesktop() diff --git a/system/login.lua b/system/login.lua new file mode 100644 index 0000000..03647ed --- /dev/null +++ b/system/login.lua @@ -0,0 +1 @@ +-- Not available on this build! \ No newline at end of file diff --git a/system/post-setup.lua b/system/post-setup.lua index 9328a58..78a80d1 100644 --- a/system/post-setup.lua +++ b/system/post-setup.lua @@ -13,6 +13,10 @@ GNU General Public License for more details. ]]-- +--local passwd = read() +--local passPath = "/etc/passwd.pwd" +os.loadAPI("/system/apis/sha256.lua") + term.clear() term.setCursorPos(1,1) term.setTextColor(colors.white) @@ -27,7 +31,13 @@ else print("[ERROR] Unable to find README.txt...") end -print("Welcome to the setup!") +if fs.exists("/system/skel/.background") then + shell.run("copy", "/system/skel/.background", "/home") +else + print("[ERROR] Unable to find the background...") +end + +--print("Welcome to the setup! This feature will be not be in Alpha 2") -sleep(3) +sleep(1) shell.run("/system/desktop.lua") \ No newline at end of file diff --git a/system/reset.lua b/system/reset.lua new file mode 100644 index 0000000..9b8efb4 --- /dev/null +++ b/system/reset.lua @@ -0,0 +1,36 @@ +--[[ + bits-UI Reset Script: A script that will wipe the system to the default factory settings. + Copyright (C) 2019 Alee14 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +]]-- +function clear() + term.clear() + term.setCursorPos(1,1) + term.setTextColor(colors.white) +end +clear() +print("Are you sure you want to reset bits-UI? (y/n)") +local input = read() +if input == "y" then + print("Erasing all user stored data...") + fs.delete("/home") + fs.delete("/etc/passwd.pwd") + sleep(2) + print("Erased all data...") + sleep(2) + print("Rebooting...") + sleep(3) + os.reboot() +else + shell.run("startup.lua") +end \ No newline at end of file diff --git a/system/skel/.background b/system/skel/.background new file mode 100644 index 0000000..d67433b --- /dev/null +++ b/system/skel/.background @@ -0,0 +1,13 @@ + + + 77777777777777777777 + 7ffffffffffffffffff7 + 7ff000fffffffffffff7 + 7ffffffffffffffffff7 + 7ffffffffffffffffff7 + 7ffffffffffffffffff7 + 7ffffffffffffffffff7 + 7ffffffffffffffffff7 + 7ffffffffffffffffff7 + 7ffffffffffffffffff7 + 77777777777777777777 -- cgit v1.2.3