Guest User

abminstaller

a guest
Feb 8th, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.45 KB | None | 0 0
  1. local dirs = { "abm", "apis", "os" }
  2. local files = {
  3.     "https://github.com/acharluk/ACharLuk-s-Boot-Manager/raw/master/abm/abm.lua",
  4.     "https://github.com/acharluk/ACharLuk-s-Boot-Manager/raw/master/abm/configuration.cfg",
  5.     "https://github.com/acharluk/ACharLuk-s-Boot-Manager/raw/master/abm/ABMcreator.lua",
  6.     "https://github.com/acharluk/ACharLuk-s-Boot-Manager/raw/master/startup",
  7.     "https://github.com/acharluk/ACharLuk-s-Boot-Manager/raw/master/apis/acl"
  8. }
  9.  
  10. local filesLoc = {
  11.     "abm/abm.lua",
  12.     "abm/configuration.cfg",
  13.     "abm/ABMcreator.lua",
  14.     "startup",
  15.     "apis/acl"
  16. }
  17. function createDir(dir)
  18.     print(dir)
  19.     if not fs.exists(dir) then
  20.         print("Creating dir: "..dir)
  21.         fs.makeDir(dir)
  22.         return
  23.     end
  24. end
  25. function getFile(url, location)
  26.     dl = http.get(url)
  27.     data = dl.readAll()
  28.     dl.close()
  29.     f = fs.open(location, "w")
  30.     f.write(data)
  31.     f.close()
  32. end
  33.  
  34. function main()
  35.     if not http then print("HTTP is not enabled, exiting") return end
  36.     print("Installing ABM")
  37.     print("Creating directories")
  38.     for i = 1, #dirs do
  39.         createDir(dirs[i])
  40.     end
  41.     print("Finished creating directories")
  42.  
  43.     print("Downloading required files")
  44.     for i = 1, #files do
  45.         print("Now downloading: "..files[i])
  46.         print("Saving to: "..filesLoc[i])
  47.         getFile(files[i], filesLoc[i])
  48.     end
  49.     print("Finished downloading required files")
  50.     print("Please reboot to start ABM")
  51.  
  52.     print("Successfully installed ABM")
  53. end
  54.  
  55. local ok, err = pcall(main)
  56. if not ok then
  57.     print(err)
  58. end
Advertisement
Add Comment
Please, Sign In to add comment