rtmc/src/boot.lua
2024-08-17 21:31:38 +00:00

40 lines
957 B
Lua

-- keycardOS "bootloader", has no access to basalt
-- intended for checking for updates, and automatically updating basalt if it is missing
local function boot()
KEYPADOS_VERSION = "3.0"
monitor = peripheral.find("monitor")
monitor.clear()
monitor.setTextScale(0.5)
y = 1
function mPrint(text)
monitor.setCursorPos(1,y)
monitor.write(text)
y = y + 1
end
mPrint("keypadOS v" .. KEYPADOS_VERSION)
if fs.exists("basalt.lua") then
mPrint("Basalt found!")
else
mPrint("Download basalt...")
basalt_code = http.get("https://raw.githubusercontent.com/Pyroxenium/Basalt/master/docs/versions/latest.lua").readAll()
mPrint("Install basalt...")
local file = fs.open("basalt.lua", "w")
file.write(basalt_code)
file.close()
mPrint("Rebooting...")
os.reboot()
end
monitor.setTextScale(1)
monitor.clear()
end
boot()