Update sPhone.lua

This commit is contained in:
Ale32bit 2015-10-11 11:29:26 +02:00
parent f18bcbf7c3
commit 0ba3a7fe87

View file

@ -34,6 +34,34 @@ local function crash(err)
shell.run("/rom/programs/shell") shell.run("/rom/programs/shell")
end end
local function recovery()
term.setBackgroundColor(colors.white)
term.setTextColor(colors.black)
term.clear()
term.setCursorPos(1,1)
print("sPhone Recovery")
print("1: Hard Reset")
print("2: Update sPhone")
print("3: Continue Booting")
while true do
local _, k = os.pullEvent("char")
if k == 1 then
for k, v in pairs(fs.list("/")) do
if not fs.isReadOnly(v) then
fs.delete(v)
end
end
print("Installing sPhone...")
sleep(0.5)
setfenv(loadstring(http.get("https://raw.githubusercontent.com/Sertex-Team/sPhone/master/src/installer.lua").readAll()),getfenv())()
elseif k == 2 then
setfenv(loadstring(http.get("https://raw.githubusercontent.com/Sertex-Team/sPhone/master/src/installer.lua").readAll()),getfenv())()
elseif k == 3 then
break
end
end
end
local function kernel() local function kernel()
term.setBackgroundColor(colors.white) term.setBackgroundColor(colors.white)
term.setCursorPos(1,1) term.setCursorPos(1,1)
@ -45,9 +73,18 @@ local function kernel()
else else
print("Missing bootImage") print("Missing bootImage")
end end
sleep(1) local bootTimer = os.startTimer(1)
while true do
local e,k = os.pullEvent()
if e == "key" and k == 56 then
recovery()
break
elseif e == "timer" then
break
end
end
_G.sPhone = { _G.sPhone = {
version = "Alpha 2.4.3", version = "Alpha 2.5",
user = "Run sID", user = "Run sID",
devMode = false, devMode = false,
mainTerm = term.current() mainTerm = term.current()