Advertisement
SpaceRanger4321

reinstall

Jan 17th, 2020
1,616
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. -- Functions
  2. function printCentered(Text, Line)
  3. local x, y = term.getSize()
  4. x = x/2 - #Text/2
  5. term.setCursorPos(x, Line)
  6. if Color then
  7. col.set(Color, BkgColor)
  8. end
  9. term.write(Text)
  10. return true
  11. end
  12.  
  13. function init()
  14. term.clear()
  15. term.setBackgroundColor( colors.red )
  16. term.setTextColor( colors.blue )
  17. term.clear()
  18. printCentered("ReInstall OS ?", 5)
  19. sleep(1)
  20. term.setCursorPos( 13, 6 )
  21. term.setTextColor( colors.black )
  22. while true do
  23. local event, key = os.pullEvent("key")
  24. if key == keys.y then
  25. term.setBackgroundColor( colors.orange )
  26. term.setTextColor( colors.blue )
  27. term.clear()
  28. printCentered("UnInstalling . . .", 5)
  29. sleep(3)
  30. printCentered("Deleteing Desktop, and all System Files", 6)
  31. sleep(3)
  32. fs.delete("/.os/")
  33. fs.delete("/startup")
  34. fs.delete("/startup.lua")
  35. fs.delete("/edit")
  36. sleep(2)
  37. term.clear()
  38. printCentered("UnInstalled, ReInstalling . . .", 5)
  39. sleep(1)
  40. shell.run("pastebin run LqKwPb6N")
  41. else
  42. term.setBackgroundColor( colors.yellow )
  43. term.clear()
  44. printCentered("ReInstallation Failed. Going back to GUI", 5)
  45. sleep(2)
  46. term.setBackgroundColor( colors.black )
  47. term.clear()
  48. shell.run("/.os/.gui")
  49. end
  50. end
  51. end
  52.  
  53. -- Main Init
  54. init()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement