Guest User

Untitled

a guest
Nov 14th, 2012
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. if shell.getRunningProgram() == "disk/startup" then
  2. print("Installing...")
  3.  
  4. if fs.isDir("disk/install") then
  5. local files = fs.list("disk/install")
  6. for _,file in ipairs( files ) do
  7. print("disk/install/"..file.." -> "..file)
  8. fs.delete(file)
  9. fs.copy("disk/install/"..file,file)
  10. end
  11. else
  12. print "No files to install. Put install files to directory 'disk/install'"
  13. end
  14.  
  15. if not os.getComputerLabel("label") then
  16. labelFile = fs.open("disk/label", "r")
  17. if labelFile then
  18. label = labelFile.readAll()
  19. labelFile.close()
  20. os.setComputerLabel(label)
  21. label = string.gsub(label, '[0-9]+', function (x) return x+1 end)
  22. labelFile = fs.open("disk/label", "w")
  23. labelFile.write(label)
  24. labelFile.close()
  25. print("Set label to " .. label)
  26. else
  27. print "No label file. Put label to file 'disk/label'\nIt should contain number, that will be incremented each time"
  28. end
  29. end
  30. print("Done!")
  31. else
  32. print "Place a disk drive with floppy near computer and copy this program to disk/startup"
  33. end
Advertisement
Add Comment
Please, Sign In to add comment