Advertisement
gravitowl

AutominerInstaller

Dec 21st, 2024
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. -- Installer Script for Your Files
  2. local files = {
  3. {url = "https://raw.githubusercontent.com/MentaalAchtergesteld/CC-SCRIPTS/refs/heads/main/scripts/autominer.lua", path = "/autominer.lua"},
  4. {url = "https://raw.githubusercontent.com/MentaalAchtergesteld/CC-SCRIPTS/refs/heads/main/lib/ecdysis.lua", path = "/lib/ecdysis.lua"},
  5. {url = "https://raw.githubusercontent.com/MentaalAchtergesteld/CC-SCRIPTS/refs/heads/main/lib/tabula.lua", path = "/lib/tabula.lua"}
  6. }
  7.  
  8. -- Ensure /lib directory exists
  9. if not fs.exists("/lib") then
  10. print("[INFO] Creating /lib directory...")
  11. fs.makeDir("/lib")
  12. end
  13.  
  14. -- Download Function
  15. local function download_file(url, path)
  16. print(string.format("[START] Downloading %s...", url))
  17.  
  18. local response = http.get(url)
  19. if not response then
  20. print(string.format("[ERROR] Failed to fetch %s. Check your connection!", url))
  21. return false
  22. end
  23.  
  24. local content = response.readAll()
  25. response.close()
  26.  
  27. local file = fs.open(path, "w")
  28. file.write(content)
  29. file.close()
  30.  
  31. print(string.format("[SUCCESS] File saved to %s", path))
  32. return true
  33. end
  34.  
  35. -- Main Installation Process
  36. print("Starting file installation process...\n")
  37. for _, file in ipairs(files) do
  38. if download_file(file.url, file.path) then
  39. print(string.format("[OK] %s installed at %s", file.url, file.path))
  40. else
  41. print(string.format("[FAIL] Could not install %s.", file.url))
  42. end
  43. print()
  44. end
  45.  
  46. print("All done! Give 'em a go, mate!")
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement