Don't like ads? PRO users don't see any ads ;-)
Guest

antivirus

By: a guest on Jun 16th, 2012  |  syntax: Lua  |  size: 2.18 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. print("Starting 1lann's rescue disk!")
  2. clock = os.clock()
  3. if clock > 1 then
  4. print("This program wasn't run on startup!")
  5. print("Please reboot your computer and try again")
  6. elseif not fs.exists("/disk") then
  7. print("This program is not ran from a disk")
  8. print("Please put it on a disk as startup and try again")
  9. elseif not fs.isDir("/disk") then
  10. print("A file is obstructing the name disk")
  11. print("Would you like move it or exit the rescue")
  12. print("disk and shutdown the computer?")
  13. print("Enter rename to move it or something other")
  14. print("than rename to exit and shutdown")
  15. input = read()
  16. if input == "rename" then
  17. print("Ok renaming file...")
  18. f = io.open("/disk", "r")
  19. disk = f:read("*a")
  20. f:close()
  21. f = io.open("/otherdisk", "w")
  22. f:write(disk)
  23. f:close()
  24. print("Alright, renamed to \"otherdisk\")
  25. print("Now we have to reboot the computer")
  26. print("Press enter to reboot the computer")
  27. blah = read()
  28. os.reboot()
  29. else
  30. os.shutdown()
  31. end
  32. else
  33. print("Did you modify startup since the last")
  34. print("time you ran the rescue disk?")
  35. print("Type something other than yes or no to go")
  36. print("straight to the terminal")
  37. print("\(If this is your first time, type yes\)")
  38. print("yes/no")
  39. option = read()
  40. if (option) == "yes" then
  41. term.clear()
  42. term.setCursorPos(1, 1)
  43. print("Alright, then I can't check your startup")
  44. print("I\'m gonna open the editor for startup")
  45. print("once you hit enter")
  46. print("Editing and hitting save won't do anything")
  47. print("to the actual startup")
  48. blah = read()
  49. f = io.read("/startup", "r")
  50. file = f:read("*a")
  51. f:close()
  52. f = io.read("/disk/tempstartup", "w")
  53. file = f:write(file)
  54. f:close()
  55. shell.run("/rom/programs/edit", "/disk/tempstartup")
  56. fs.delete("/disk/tempstartup")
  57. print("Was that startup file correct?")
  58. print("yes/something other than yes")
  59. option = read()
  60. if option == "yes" then
  61. print("Alright, I\'ll backup your startup file")
  62. f = io.open("/disk/startbackup")
  63. f:write(file)
  64. f:close()
  65. print("Backed up as \"startbackup\" on the disk")
  66. print("Please eject the disk and press enter to")
  67. print("Shutdown the computer")
  68. blah = read()
  69. os.shutdown()
  70. else
  71. restore()
  72. end
  73.  
  74. if (option) == "no" then
  75. restore()
  76. else
  77. term.clear()
  78. end
  79. end