From be33a44a20e9e0e9b074e2ab55ddb2e3c729cfcb Mon Sep 17 00:00:00 2001 From: Ale32bit Date: Sun, 20 Nov 2016 17:07:19 +0100 Subject: [PATCH] Update init.lua --- src/init.lua | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/init.lua b/src/init.lua index 997a669..96cff8c 100644 --- a/src/init.lua +++ b/src/init.lua @@ -96,6 +96,8 @@ local function recovery() elseif k == 4 then fs.delete("/.sPhone/config") fs.delete("/.sPhone/cache") + fs.delete("/.sPhone/apps/spk") + fs.delete("/.sPhone/autorun") os.reboot() elseif k == 5 then safemode = false @@ -129,14 +131,16 @@ end if e == "key" and k == 56 then recovery() break - elseif e == "timer" then - _G.safemode = false + elseif e == "timer" and k == bootTimer then + safemode = false break end end if not fs.exists("/.sPhone/sPhone") then - crash("No OS found") + printError("sPhone not installed") + shell.run("/.sPhone/init -u") + return end @@ -178,23 +182,16 @@ if argData["-u"] then setfenv(loadstring(http.get("https://raw.githubusercontent.com/BeaconNet/sPhone/master/src/installer.lua").readAll()),getfenv())() end -if argData["-s"] then - runningOnStartup = true -end - os.pullEvent = os.oldPullEvent local ok, err = pcall(function() setfenv(loadfile("/.sPhone/sPhone"), setmetatable({ crash = crash, safemode = safemode, - runningOnStartup = runningOnStartup, }, {__index = getfenv()}))() end) if not ok then crash(err) end - -crash("sPhone stopped running!") _G.term = nil -- The OS ends here - This string force to crash the pda to shutdown