svdragster

PSAVsetup

Mar 16th, 2013
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.74 KB | None | 0 0
  1. startupexist = fs.exists("startup")
  2. --shellrun = fileLineGet("startup", zeile)
  3. running = shell.getRunningProgram()
  4. version = os.version()
  5.  
  6. okay = false
  7. okay2 = false
  8. geklickt = false
  9. backupname = "startupbackup"
  10.  
  11. term.setBackgroundColour( colors.green )
  12. term.setTextColour( colors.cyan )
  13. term.clear()
  14. term.setCursorPos(1,1)
  15. print("PSAV - BETA")
  16. term.setCursorPos(47,1)
  17. print("setup")
  18. term.setCursorPos(1,4)
  19. if version ~= "CraftOS 1.5" then
  20.   error("Running on "..version..", you need CraftOS 1.4 or higher!")
  21. end
  22.  
  23. if not term.isColor() then
  24.   error("You need an advanced(Golden) computer.")
  25. end
  26.  
  27. if startupexist == true then
  28.   term.setTextColor(colors.red)
  29.   print ("A startup already exists. This may cause problems and the PSAV can't be started at boot.")
  30.   term.setTextColor(colors.white)
  31.   print ("Would you like to copy and rename the current startup file? (please click)")
  32.   term.setCursorPos(3,9)
  33.   term.setBackgroundColour( colors.yellow )
  34.   term.setTextColour( colors.cyan )
  35.   write("yes")
  36.   term.setCursorPos(9,9)
  37.   write("no")
  38.   term.setCursorPos(14,9)
  39.   write("cancel")
  40.   term.setBackgroundColour ( colors.green )
  41.   term.setTextColour( colors.white)
  42.   while geklickt == false do
  43.     event, knopf, x, y = os.pullEvent("mouse_click")
  44.     if (x >= 3) and (x <= 6) and (y == 9) then
  45.       geklickt = true
  46.       print("")
  47.       if fs.exists("/PSAVbackup/startupbackup") then
  48.         repeat
  49.           print("Please choose a name for the renamed startup file.")
  50.           backupname = read()
  51.         until not fs.exists("/PSAVbackup/"..backupname)
  52.       end
  53.       fs.makeDir("PSAVbackup")
  54.       fs.copy("startup", "/PSAVbackup/"..backupname)
  55.       term.setTextColour( colors.yellow )
  56.       print("A folder called \"PSAVbackup\" was created. The startup is now called \""..backupname.."\"")
  57.     end
  58.     if (x >= 14) and (x <= 19) and (y == 9) then
  59.       geklickt = true
  60.       term.setBackgroundColour( colors.black )
  61.       shell.run("clear")
  62.       shell.run("shell")
  63.     end
  64.     if (x >= 9) and (x <= 10) and (y == 9) then
  65.       geklickt = true
  66.       print("")
  67.     end
  68.   end
  69. end
  70.  
  71.  
  72.  
  73. f = io.open("/startup", "w")
  74. f:write("shell.run\(\"PSAV/psav\"\)")
  75. f:close()
  76.  
  77. term.setTextColor(colors.orange)
  78. print("The necessary files will be downloaded now and placed in a folder called PSAV.")
  79. print("Please do not terminate this setup, and run a scan at the end, or PSAV won't work.")
  80. term.setCursorPos(3,19)
  81. term.setBackgroundColour( colors.yellow )
  82. term.setTextColour( colors.cyan )
  83. write("okay")
  84.  
  85. while okay == false do
  86.   event, knopf, x, y = os.pullEvent("mouse_click")
  87.   if (x >= 3) and (x <= 7) and (y == 19) then
  88.     okay = true
  89.     fs.makeDir("/PSAV")
  90.     shell.run("pastebin get A2ANd03G /PSAV/psav")
  91.     shell.run("pastebin get Gdnjpv2W /PSAV/scan")
  92.     shell.run("pastebin get Ev5qReqD /PSAV/details")
  93.     fs.makeDir("/PSAV/reports/")
  94.     shell.run("pastebin get dF82bcmi /PSAV/problems.txt")
  95.     shell.run("pastebin get rvP2fXrn /PSAV/settings")
  96.     fs.makeDir("/PSAV/config/")
  97.     shell.run("pastebin get T9sTsgti /PSAV/config/config.txt")
  98.     term.setBackgroundColour( colors.black )
  99.     fs.makeDir("/PSAV/reports/")
  100.   end
  101. end
  102.  
  103. term.setBackgroundColour( colors.green )
  104. term.setTextColour( colors.cyan )
  105. term.clear()
  106. term.setCursorPos(1,1)
  107. print("PSAV - BETA")
  108. term.setCursorPos(47,1)
  109. print("setup")
  110. term.setCursorPos(2,4)
  111. term.setTextColour( colors.lime )
  112. print("The setup is nearly done! Please run a first time scan. Necessary files will be created while the scan.")
  113.  
  114. term.setCursorPos(3,19)
  115. term.setBackgroundColour( colors.yellow )
  116. term.setTextColour( colors.cyan )
  117. write("okay")
  118. term.setBackgroundColour( colors.green )
  119. while okay2 == false do
  120.   event, knopf, x, y = os.pullEvent("mouse_click")
  121.   if (x >= 3) and (x <= 7) and (y == 19) then
  122.     shell.run("/PSAV/scan")
  123.   end
  124. end
Advertisement
Add Comment
Please, Sign In to add comment