aboutsummaryrefslogtreecommitdiff
path: root/startup
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@gmail.com>2019-03-05 12:49:07 -0500
committerAndrew Lee <alee14498@gmail.com>2019-03-05 12:49:07 -0500
commit8e5d5935df078db9f05a9587ad6d61b7f2b82dcf (patch)
tree2c1aad106767f80e881c4078c598f7b87b26930e /startup
parentf43a02544db685563bb626e100aa5f201a65e6c3 (diff)
downloadbits-UI-8e5d5935df078db9f05a9587ad6d61b7f2b82dcf.tar.gz
bits-UI-8e5d5935df078db9f05a9587ad6d61b7f2b82dcf.tar.bz2
bits-UI-8e5d5935df078db9f05a9587ad6d61b7f2b82dcf.zip
Boot loader :D (I nearly lost all of my work when I ran the updater...)
Diffstat (limited to 'startup')
-rw-r--r--startup62
1 files changed, 61 insertions, 1 deletions
diff --git a/startup b/startup
index 2e9e5ca..a1efcd0 100644
--- a/startup
+++ b/startup
@@ -1,2 +1,62 @@
-- bits-UI: An operating system for ComputerCraft. Licensed with GPL-3.0.
-shell.run("/system/boot.lua") \ No newline at end of file
+local boot = "/system/boot.lua"
+
+function bootloader()
+ term.setCursorPos(1,1)
+ term.write("Welcome to the BUBL boot loader!\n")
+ term.setCursorPos(1,3)
+ term.write("1. Boot bits-UI\n")
+ term.setCursorPos(1,4)
+ term.write("2. Update bits-UI\n")
+ term.setCursorPos(1,5)
+ term.write("3. Boot CraftOS\n")
+ term.setCursorPos(1,7)
+ term.write("> ")
+end
+
+function clear()
+ term.clear()
+ term.setCursorPos(1,1)
+ term.setTextColor(colors.white)
+end
+
+function bootloaderInput()
+ local input = read()
+
+ if input == "1" then
+ clear()
+ shell.run("/system/boot.lua")
+ elseif input == "2" then
+ clear()
+ term.write("Running updater...")
+ sleep(3)
+ shell.run("pastebin", "run", "7XY80hfG")
+ elseif input == "3" then
+ clear()
+ term.write(os.version())
+ term.setCursorPos(1,2)
+ else
+ term.write("[ERROR] Invalid number.")
+ bootloader()
+ bootloaderInput()
+ end
+
+end
+
+
+if fs.exists(boot) then
+ term.setTextColor(colors.green)
+ term.write("Boot detected!")
+else
+ clear()
+ term.setTextColor(colors.red)
+ term.write("[ERROR] System has been halted.")
+ term.setCursorPos(1,2)
+ term.write("Details: Cannot find boot.lua")
+ sleep(3)
+ os.shutdown()
+end
+
+clear()
+bootloader()
+bootloaderInput() \ No newline at end of file