Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Function to copy files from one directory to another
- local function copyFiles(sourceDir, destDir)
- for _, file in ipairs(fs.list(sourceDir)) do
- if not fs.isDir(destDir) then
- fs.makeDir(destDir)
- end
- local sourcePath = fs.combine(sourceDir, file)
- local destPath = fs.combine(destDir, file)
- fs.copy(sourcePath, destPath)
- end
- end
- -- Function to eject all disks
- local function ejectDisks()
- for _, side in ipairs(rs.getSides()) do
- if peripheral.getType(side) == "disk_drive" then
- peripheral.call(side, "eject")
- end
- end
- end
- -- Function to simulate installation
- local function simulateInstallation()
- -- Copy every file from /disk/install-files to the root of the computer
- copyFiles("/disk/install-files", "/")
- -- Copy /disk to /root
- fs.copy("/disk", "/root")
- -- Eject all disk positions
- ejectDisks()
- -- Rename /root as /disk/os/gui
- fs.move("/root", "/disk/os/gui")
- end
- -- Call the function to simulate installation
- simulateInstallation()
Add Comment
Please, Sign In to add comment