Advertisement
DOGGYWOOF

Untitled

Mar 16th, 2024
6
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. -- Function to copy files from one directory to another
  2. local function copyFiles(sourceDir, destDir)
  3. for _, file in ipairs(fs.list(sourceDir)) do
  4. if not fs.isDir(destDir) then
  5. fs.makeDir(destDir)
  6. end
  7. local sourcePath = fs.combine(sourceDir, file)
  8. local destPath = fs.combine(destDir, file)
  9. fs.copy(sourcePath, destPath)
  10. end
  11. end
  12.  
  13. -- Function to eject all disks
  14. local function ejectDisks()
  15. for _, side in ipairs(rs.getSides()) do
  16. if peripheral.getType(side) == "disk_drive" then
  17. peripheral.call(side, "eject")
  18. end
  19. end
  20. end
  21.  
  22. -- Function to simulate installation
  23. local function simulateInstallation()
  24. -- Copy every file from /disk/install-files to the root of the computer
  25. copyFiles("/disk/install-files", "/")
  26.  
  27. -- Copy /disk to /root
  28. fs.copy("/disk", "/root")
  29.  
  30. -- Eject all disk positions
  31. ejectDisks()
  32.  
  33. -- Rename /root as /disk/os/gui
  34. fs.move("/root", "/disk/os/gui")
  35. end
  36.  
  37. -- Call the function to simulate installation
  38. simulateInstallation()
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement