Advertisement
Ocawesome101

OC-OS v2 Installer

Oct 26th, 2019
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.15 KB | None | 0 0
  1. -- OC-OS v2 Installer. Disk bootable. --
  2.  
  3. -- Setup
  4. local sUrl = "https://raw.githubusercontent.com/ocawesome101/oc-os-2/master/"
  5. local dirs = ("/startup", "/boot/ocos", "/ocos/sys/core", "/ocos/sys/apis", "/ocos/sys/userdata", "/ocos/programs", "/ocos/users")
  6. local files = {"/startup/00_bios.lua", "/boot/ocos/boot.lua", "/ocos/boot.lua", "/ocos/sys/core/start.lua", "/ocos/sys/apis/shell.lua", "/ocos/programs/login.lua", "/ocos/sys/userdata/names", "/ocos/sys/userdata/passwords"}
  7.  
  8. local function log(msg)
  9.     term.setTextColor(colors.green)
  10.     write("-> ")
  11.     term.setTextColor(colors.yellow)
  12.     print(msg)
  13.     sleep(0.05)
  14. end
  15.  
  16. local function get(url)
  17.     local response = http.get(url, nil, true)
  18.     if not response then
  19.         log("Failed.")
  20.         return nil
  21.     end
  22.  
  23.     local sResponse = response.readAll()
  24.     response.close()
  25.     return sResponse
  26. end
  27.  
  28. local function dl(file)
  29.     log("Downloading " .. file)
  30.     local data = get(sUrl .. file)
  31.     local handle = fs.open(file)
  32.     handle.write(data)
  33.     handle.close()
  34. end
  35.  
  36. local function checkDirs(tDirs)
  37.     for i=1, #tDirs, 1 do
  38.         if fs.exists(tDirs[i])
  39.     end
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement