Z1maV1

install

May 14th, 2022 (edited)
613
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.69 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2.  
  3. term.clear()
  4. term.setCursorPos(1,1)
  5.  
  6. deletedone = false
  7.  
  8. local dirs = {"/boot", "/etc", "/home", "/lib", "/tmp", "/usr", "/var", "/bin"}
  9.  
  10. local function deleteDirs()
  11.     for idx, val in ipairs(dirs) do
  12.         if fs.exists(val) then
  13.             shell.run("rm", val)
  14.             textutils.slowPrint("###########")
  15.             deletedone = true
  16.         end
  17.     end
  18. end
  19.  
  20. print("Deleting pre-exists files...")
  21. if fs.exists("/startup") then
  22.     shell.run("rm", "/startup")
  23.     term.setTextColor(colors.red)
  24.     textutils.slowPrint("###########")
  25.     deletedone = true
  26. end
  27. deleteDirs()
  28. if deletedone == true then
  29.     term.setTextColor(colors.green)
  30.     print("Deleted!")
  31. else
  32.     term.setTextColor(colors.red)
  33.     print("No files to delete")
  34. end
  35. sleep(1)
  36. term.setTextColor(colors.white)
  37.  
  38. print("Copying fils...")
  39. shell.run("cp", "/disk/bios/startup.bios", "/startup")
  40. term.setTextColor(colors.red)
  41. textutils.slowPrint("###########")
  42. shell.run("cp", "/disk/diamondOS/os/*", "/")
  43. textutils.slowPrint("###########")
  44. shell.run("cp", "/disk/diamondOS/back.lua", "/back")
  45. textutils.slowPrint("###########")
  46. term.setTextColor(colors.green)
  47. print("Copyed!")
  48. term.setTextColor(colors.white)
  49. sleep(1)
  50. ----------------------------------
  51. settings.set("bootFile", "/boot/craftbootloader.lua")
  52. settings.save()
  53. print("Deleting temp files")
  54. sleep(1)
  55. shell.run("/.deletetemp")
  56. term.setTextColor(colors.red)
  57. textutils.slowPrint("###########")
  58. term.setTextColor(colors.green)
  59. print("Done.")
  60. term.setTextColor(colors.white)
  61. sleep(1)
  62.  
  63. disk.eject("top")
  64. disk.eject("bottom")
  65. disk.eject("left")
  66. disk.eject("right")
  67. disk.eject("front")
  68. disk.eject("back")
  69.  
  70. os.reboot()
  71.  
Advertisement
Add Comment
Please, Sign In to add comment