Margresse404

auto3

Jun 16th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 KB | None | 0 0
  1.  
  2. local versionNumber = 3.3
  3.  
  4. local args = {...}
  5.  
  6. if #args >= 1 then
  7. if args[1] == "setup" then
  8. --sane default window sizes
  9. local lyqwin = [[
  10. 1,1,9,4,false,rom/programs/reboot
  11. 1,1,9,4,false,rom/programs/shutdown
  12. 1,1,19,9,true,rom/programs/color/paint
  13. 3,3,47,15,false,rom/programs/shell
  14. 2,2,47,15,false,rom/programs/lua
  15. ]]
  16. local lyqwinPocket = [[
  17. 1,1,9,4,false,rom/programs/reboot
  18. 1,1,9,4,false,rom/programs/shutdown
  19. 1,1,19,9,true,rom/programs/color/paint
  20. 1,3,26,16,false,rom/programs/shell
  21. 1,4,26,16,false,rom/programs/lua
  22. ]]
  23. if pocket then lyqwin = lyqwinPocket end
  24. if pack then
  25. pack.addFile("/LyqydOS/.lyqwin", lyqwin)
  26. else
  27. if not fs.exists("/LyqydOS/.lyqwin") then
  28. local handle = io.open("/LyqydOS/.lyqwin", "w")
  29. if handle then
  30. handle:write(lyqwin)
  31. handle:close()
  32. end
  33. end
  34. end
  35. print("Run LyqydOS on startup? (y/N)")
  36. term.write("> ")
  37. local input = io.read()
  38. if #input > 0 then
  39. input = string.lower(string.sub(input, 1, 1))
  40. if input == "y" then
  41. local handle
  42. if fs.exists("/startup") then
  43. handle = io.open("/startup", "a")
  44. else
  45. handle = io.open("/startup", "w")
  46. end
  47. if handle then
  48. handle:write([[shell.run("/LyqydOS/procman")]].."\n")
  49. handle:close()
  50. end
  51. end
  52. end
  53. elseif args[1] == "remove" then
  54. if pack then
  55. pack.removeFile("/LyqydOS/.config")
  56. pack.removeFile("/LyqydOS/.lyqrunhistory")
  57. pack.removeFile("/LyqydOS/.lyqshellrunhistory")
  58. pack.removeFile("/LyqydOS/.lyqwin")
  59. else
  60. if fs.exists("/LyqydOS/.config") then fs.delete("/LyqydOS/.config") end
  61. if fs.exists("/LyqydOS/.lyqrunhistory") then fs.delete("/LyqydOS/.lyqrunhistory") end
  62. if fs.exists("/LyqydOS/.lyqshellrunhistory") then fs.delete("/LyqydOS/.lyqshellrunhistory") end
  63. if fs.exists("/LyqydOS/.lyqwin") then fs.delete("/LyqydOS/.lyqwin") end
  64. end
  65. end
  66. else
  67. --get packman and use it.
  68.  
  69.  
  70. local otherHTTPs = {"https://raw.githubusercontent.com/MargreetH/windowTryout/master/windowTest.lua", "https://raw.githubusercontent.com/MargreetH/windowTryout/master/scripts/functions.lua", "https://raw.githubusercontent.com/MargreetH/windowTryout/master/reactorControlWithTouch.lua","https://raw.githubusercontent.com/MargreetH/windowTryout/master/reactorSettings.lua", "https://raw.githubusercontent.com/MargreetH/windowTryout/master/AE2monotoring.lua"}
  71. local otherpaths = {"/git", "/git/scripts", "/git", "/git", "/git"}
  72. local fileName = {"windowTest", "functions", "reactor", "reactorSettings", "AE2monitoring"}
  73.  
  74. for i=1, #fileName, 1 do
  75.  
  76. local response = http and http.get(otherHTTPs[i])
  77. if response then
  78. if not fs.exists(otherpaths[i]) then fs.makeDir(otherpaths[i]) end
  79. local handle = io.open(otherpaths[i].."/"..fileName[i], "w")
  80. if handle then
  81. handle:write(response.readAll())
  82. handle:close()
  83. else
  84. error("Could not write ")
  85. end
  86. response.close()
  87. else
  88. error("Could not fetch file")
  89. end
  90.  
  91. end
  92.  
  93.  
  94.  
  95.  
  96. end
Advertisement
Add Comment
Please, Sign In to add comment