JustJurt

installer.lua

Jul 28th, 2025
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.06 KB | None | 0 0
  1. VERSION = "6"
  2.  
  3. function Write_File(path, data)
  4.     fs.delete(path)
  5.  
  6.     local file = fs.open(path, "w")
  7.  
  8.     if file then
  9.         file.write(data) -- Write content to the file
  10.         file.close() -- Close the file
  11.         -- print("File created")
  12.     else
  13.         print("File failed to create")
  14.     end
  15. end
  16.  
  17. function Github_Download(path, githubPath)
  18.     local url = "https://raw.githubusercontent.com/Jerry-Todd/Computer-Craft-Scripts/main/"
  19.     local cacheBuster = os.epoch("utc") -- Get the current timestamp
  20.     local file = http.get(url .. githubPath .. "?t=" .. cacheBuster)
  21.     if file then
  22.         file = file.readAll()
  23.         -- print("Github / Got file: " .. githubPath)
  24.         Write_File(path, file)
  25.         print(" - " .. path)
  26.     else
  27.         print("Github / Cant get file: " .. githubPath)
  28.     end
  29. end
  30.  
  31. term.clear()
  32. term.setCursorPos(1, 1)
  33.  
  34. fs.delete("scripts")
  35. fs.delete("wcon")
  36. fs.delete("launch.lua")
  37. fs.delete("startup.lua")
  38.  
  39. print("Creating shortcuts")
  40.  
  41. Write_File("scripts/install/installer.lua", "shell.run(\"pastebin run zPDTq93k\")")
  42. Write_File("scripts/options/Update.lua", "shell.run(\"scripts/install/installer.lua\")")
  43. Write_File("scripts/options/Exit.lua", "term.clear()\nterm.setCursorPos(1,1)\nprint(\"Terminal\")")
  44. Write_File("startup.lua", "shell.run(\"launch.lua\")")
  45.  
  46. print("Downloading Scripts")
  47.  
  48. -- Github_Download("scripts/install/installer.lua", "scripts/install/installer.lua")
  49.  
  50. -- wcon
  51. Github_Download("wcon/client.lua", "scripts/wcon/wcon-client.lua")
  52. Github_Download("wcon/remote.lua", "scripts/wcon/wcon-remote.lua")
  53.  
  54. -- scripts
  55. Github_Download("scripts/Quary.lua", "scripts/quary.lua")
  56. Github_Download("scripts/Digarea.lua", "scripts/digarea.lua")
  57. Github_Download("scripts/Treefarm.lua", "scripts/treefarm.lua")
  58. Github_Download("scripts/Stripdig.lua", "scripts/stripdig.lua")
  59.  
  60. Github_Download("launch.lua", "scripts/launcher.lua")
  61.  
  62. sleep(1)
  63.  
  64. term.clear()
  65. term.setCursorPos(1, 1)
  66.  
  67. print("Download complete.")
  68. print("Update shortcut created.")
  69. print("Version: " .. VERSION)
  70. sleep(2)
  71. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment