Operating system for OpenComputers
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.4KB

  1. local fs = require "filesystem"
  2. local wdir = "/tmp/psbootstrap"
  3. local dlfiles = {
  4. ["/lib/libmtar.lua"] = "https://git.shadowkat.net/izaya/OC-misc/raw/branch/master/mtar/libmtar.lua",
  5. ["/lib/fs/rtfs/init.lua"] = "https://git.shadowkat.net/izaya/PsychOSPackages/raw/branch/master/rtfs/lib/fs/rtfs/init.lua",
  6. ["/lib/fs/rtfs/v1.lua"] = "https://git.shadowkat.net/izaya/PsychOSPackages/raw/branch/master/rtfs/lib/fs/rtfs/v1.lua",
  7. ["/lib/diskpart.lua"] = "https://git.shadowkat.net/izaya/PsychOSPackages/raw/branch/master/diskpart/lib/diskpart.lua",
  8. ["/etc/rc.d/partman.lua"] = "https://git.shadowkat.net/izaya/OC-misc/raw/branch/master/partition/OpenOS/etc/rc.d/partman.lua",
  9. ["/bin/slicer.lua"] = "https://git.shadowkat.net/izaya/PsychOSPackages/raw/branch/master/slicer/exec/slicer.lua",
  10. ["/bin/boopu.lua"] = "https://git.shadowkat.net/izaya/PsychOSPackages/raw/branch/master/boopu/exec/boopu.lua",
  11. }
  12. local function run(cmd)
  13. print(cmd)
  14. os.execute(cmd)
  15. end
  16. print("Downloading and linking files...")
  17. for k,v in pairs(dlfiles) do
  18. local tpath = string.format("%s/%s", wdir, k)
  19. local isdir = fs.isDirectory(fs.path(tpath)) or fs.makeDirectory(fs.path(tpath))
  20. run(string.format("wget '%s' '%s'", v, tpath))
  21. local lt = k
  22. while not fs.isDirectory(fs.path(lt)) and not fs.isLink(fs.path(lt)) do
  23. lt = fs.path(lt)
  24. end
  25. if fs.get(tpath) ~= fs.get(lt) then
  26. run(string.format("ln '%s/%s' '%s'", wdir, lt, lt))
  27. end
  28. end