Advertisement
Guest User

install.lua

a guest
Apr 13th, 2014
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.71 KB | None | 0 0
  1. local filesystem = require "filesystem"
  2. local component = require "component"
  3. local process = require "process"
  4.  
  5. local bootloader = [[
  6. local proxy = ...
  7. local filesystem = require "filesystem"
  8. local component = require "component"
  9. local term = require "term"
  10.  
  11. local maxResX,maxResY = component.gpu.maxResolution()
  12.  
  13. if maxResX >= 80 and maxResY >= 25 then
  14.  component.gpu.setResolution(80,25)
  15. end
  16.  
  17. term.clear()
  18.  
  19. print("SKS-BOOT")
  20. print("\nBoot device:")
  21. local rPartPath = io.read()
  22. local partPath = rPartPath:sub(1,rPartPath:len()-1)
  23.  
  24. filesystem.umount("/")
  25. filesystem.mount(component.proxy(component.get(partPath)),"/")]]
  26.  
  27. local revRunningFrom = process.running():reverse()
  28. local rFrFiSl = revRunningFrom:find("/")
  29. local runningFrom = process.running():sub(1,-rFrFiSl-1)
  30. print "SKS-OS installer"
  31. print("Running from: "..runningFrom)
  32. print "Install to:"
  33. local insLoc = io.read()
  34. print("Install to "..insLoc)
  35. print("Confirm Y/N")
  36. local conf = io.read():lower()
  37. if conf == "n" then
  38.  error "operation cancelled"
  39. end
  40.  
  41. print("Copy: /bin")
  42. filesystem.makeDirectory(insLoc.."/bin")
  43. print("Copy: /lib")
  44. filesystem.makeDirectory(insLoc.."/lib")
  45. print("Copy /usr/man")
  46. filesystem.makeDirectory(insLoc.."/usr")
  47. filesystem.makeDirectory(insLoc.."/usr/man")
  48. for f in filesystem.list("/bin") do
  49.  print(f)
  50.  filesystem.copy("/bin/"..f,insLoc.."/bin/"..f)
  51. end
  52.  
  53.  
  54. for f in filesystem.list("/lib") do
  55.  print(f)
  56.  filesystem.copy("/lib/"..f,insLoc.."/lib/"..f)
  57. end
  58.  
  59.  
  60. for f in filesystem.list("/usr/man") do
  61.  print(f)
  62.  filesystem.copy("/usr/man/"..f,insLoc.."/usr/man/"..f)
  63. end
  64.  
  65. local fObj = io.open(insLoc.."/autorun.lua","w")
  66. fObj:write(bootloader)
  67. fObj:close()
  68.  
  69. local filesystem = nil
  70. local component = nil
  71. local process = nil
  72. local insLoc = nil
  73. local bootloader = nil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement