Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local oldPull = os.pullEvent
- os.pullEvent = os.pullEventRaw
- --this program basically deals with all the chores of shutting down the OS and making sure all files are put away cleanly
- local tArg = {...}
- local CompletionAction = tArg[1]
- local AllowReturn = tArg[2]
- local Stage = 0
- start()
- function start()
- term.clear()
- term.setBackground("blue")
- Stage_one()
- end
- function Stage_one()
- print("Shutdown Handler")
- if AllowReturn == true then
- print("Shutting Down, to cancel please Press B within 30 seconds")
- until Stage == 1 or Stage == -1 do
- local input = read()
- if input == "b" then
- Stage == -1
- end
- end
- else
- Stage == 1
- end
- if Stage == -1 then
- sleep(10)
- shell.run(".Menu")
- else if Stage == 1 then
- Stage_two()
- end
- end
- function Stage_two()
- Completion()
- end
- function Completion()
- if CompletionAction == "Restart" then
- os.reboot()
- else if CompletionAction == "Shutdown" then
- os.shutdown()
- end
- end
- os.pullEvent = oldPull
Add Comment
Please, Sign In to add comment