turtle5204

swiftos installer

Jan 21st, 2016
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.24 KB | None | 0 0
  1. local lk = http.get("https://raw.githubusercontent.com/swiftOS/swiftOS-Packages/master/Packages/libkpm.lua")
  2. if lk and lk.readAll then
  3.     local libkpm = loadstring( lk.readAll() )()
  4.  
  5.     local function makeBlank(loc)
  6.         local file = fs.open(loc, "w")
  7.         file.write("{}")
  8.         file.close()
  9.     end
  10.  
  11.     local function gpr(text)
  12.         if term.isColor() then
  13.             term.setTextColor(colors.green)
  14.         end
  15.         print(text)
  16.         term.setTextColor(colors.white)
  17.     end
  18.  
  19.     gpr("Creating /usr/etc/kpm")
  20.     fs.makeDir("/usr/etc/kpm")
  21.  
  22.     gpr("Creating packages.kpm")
  23.     makeBlank("/usr/etc/kpm/packages.kpm")
  24.  
  25.     gpr("Creating installed.kpm")
  26.     makeBlank("/usr/etc/kpm/installed.kpm")
  27.  
  28.     gpr("Creating sources.kpm")
  29.     makeBlank("/usr/etc/kpm/sources.kpm")
  30.  
  31.     gpr("Creating base files done, adding main repository")
  32.     libkpm.addRepo( "https://raw.githubusercontent.com/swiftOS/swiftOS-Packages/master/repo.kpm" )
  33.  
  34.     gpr("Syncing repository...")
  35.     libkpm.sync()
  36.  
  37.     gpr("Downloading 'base' metapackage - this will install swiftOS, would you like to continue? (y/n)")
  38.     local m = string.lower( read() )
  39.  
  40.     if m == "yes" or m == "y" then
  41.         libkpm.install("base")
  42.         gpr("Done. Reboot!")
  43.     else
  44.         error("Canceled install.", 0)
  45.     end
  46.  
  47. else
  48.     error("Couldn't connect to get libkpm.", 0)
  49. end
Advertisement
Add Comment
Please, Sign In to add comment