Advertisement
Guest User

os

a guest
Apr 26th, 2018
2,120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.86 KB | None | 0 0
  1. local oldPull = os.pullEvent;
  2. os.pullEvent = os.pullEventRaw;
  3.  
  4. term.clear()
  5.  
  6. os.loadAPI("/.sys/crashfix")
  7. os.loadAPI("/.sys/bootloader")
  8.  
  9. term.setBackgroundColor(colors.black)
  10. term.setTextColor(colors.white)
  11.  
  12. term.setCursorPos(1,1)
  13.  
  14. print("Press s to boot into Safe Mode")
  15. print("Press a to boot into advanced boot")
  16. print("Press o to boot into PowerOS")
  17.  
  18. local event, key = os.pullEvent("key")
  19.  
  20. if key == keys.s then
  21.   bootloader.safe = true
  22.   bootloader.os = false
  23.   bootloader.advanced = false
  24.   shell.run("/.sys/kernel")
  25. elseif key == keys.a then
  26.   bootloader.os = false
  27.   bootloader.advanced = true
  28.   bootloader.safe = false
  29.   shell.run("/.sys/kernel")
  30. elseif key == keys.o then
  31.   bootloader.advanced = false
  32.   bootloader.safe = false
  33.   bootloader.os = true
  34.   shell.run("/.sys/kernel")
  35. else
  36.   os.reboot()
  37. end
  38.  
  39. os.pullEvent = oldPull;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement