Advertisement
Alakazard12

NovaOS Installer

Mar 28th, 2013
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | None | 0 0
  1. if not http then
  2.     print("Enable http to install")
  3.     return
  4. end
  5.  
  6. local Success = true
  7.  
  8. local Dirs = {
  9.     "Resources";
  10.     "APIs";
  11.     "Settings";
  12.     "Programs";
  13.     "Home";
  14. }
  15.  
  16. local function Download(Link)
  17.     local Res = http.get(Link)
  18.     if not Link then
  19.         print("Unable to download files")
  20.         return nil
  21.     end
  22.     return Res
  23. end
  24.  
  25. local  Downloads = {
  26.     {"https://github.com/alakazard12/NovaOS/raw/master/Boot", "Boot"};
  27.     {"https://github.com/alakazard12/NovaOS/raw/master/Resources/Logo", "Resources/Logo"};
  28.     {"https://github.com/alakazard12/APIs/raw/master/Gapi", "APIs/Gapi"};
  29. }
  30.  
  31. if fs.exists("/NovaOS") then
  32.     fs.delete("/NovaOS")
  33. end
  34.  
  35. for i,v in pairs(Dirs) do
  36.     fs.makeDir("/NovaOS/" .. v)
  37. end
  38.  
  39. for i,v in pairs(Downloads) do
  40.     print("Downloading [" .. i .. "/" .. #Downloads .. "]")
  41.     local Get = Download(v[1])
  42.     if not Get then
  43.         Success = false
  44.         return
  45.     end
  46.     local Flo = fs.open("/NovaOS/" .. v[2], "w")
  47.     Flo.write(Get.readAll())
  48.     Flo.close()
  49. end
  50.  
  51. if Success == true then
  52.     print("NovaOS has been installed, reboot to start NovaOS")
  53. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement