Advertisement
Tatantyler

MuSeOS Man Pages

Sep 15th, 2012
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.61 KB | None | 0 0
  1. args = {...}
  2.  
  3. -- man pages start here
  4.  
  5. local backup_help = [[
  6. backup - Make a complete copy of a computer
  7.  
  8. ------------------------------------------
  9.  
  10. USAGE: backup
  11.  
  12. This program makes a nearly-exact copy of a computer, excluding its label.
  13. It saves every file/directory and its contents to the first disk inserted.
  14. This disk will be located at "disk/".
  15.  
  16. This program must be run as root, or else it will crash.
  17. ]]
  18.  
  19. local programs_help = [[
  20. Program List:
  21. logviewer
  22. sudo
  23. su
  24. adduser
  25. systeminfo
  26. whoami
  27. protect
  28. diskinfo
  29. man
  30. deluser
  31. changepassword
  32. ]]
  33.  
  34. local api_help = [[
  35. API Functions:
  36. museOS.switchUser(string target, string password)
  37. museOS.sudo(string rootpw, string program, args)
  38. museOS.getUserID()
  39. museOS.getUsers()
  40. museOS.authenticate(string user, string password)
  41.  
  42. authenticate: provides password authentication
  43. sudo: Similar to shell.run, but runs programs as root
  44. getUserID: returns the current user's userID
  45. getUsers: returns a list of users
  46. switchUser: switches the current user
  47.  
  48. All functions can be run without root access.
  49. ]]
  50.  
  51. local turtleSettings_help = [[
  52. turtleSettings - change settings on turtles
  53.  
  54. ------------------------------------------
  55.  
  56. This program allows the superuser to change the systemwide turtle settings.
  57. These settings can change:
  58.     If the turtle is allowed to move
  59.     If the turtle is allowed to place blocks
  60.     If the turtle is allowed to break blocks
  61.     If the turtle is allowed to suck up blocks
  62.  
  63. This program must be run as root!
  64. ]]
  65.  
  66. local updater_help = [[
  67. updater - update MuSeOS
  68.  
  69. ------------------------------------------
  70.  
  71. USAGE: updater
  72.  
  73. This program allows the superuser to update MuSeOS to the latest version.
  74. This program will not run if MuSeOS is already at the latest version.
  75.  
  76. You need to be root to run this!
  77. ]]
  78.  
  79. local logviewer_help = [[
  80. logViewer - view system logs
  81.  
  82. ------------------------------------------
  83.  
  84. USAGE: logviewer [target log]
  85.  
  86. This program allows the superuser to view logs that have been made by the OS.
  87.     Default logs are:
  88.         OSLog - Security and Users
  89.         fileLog - File Operations
  90.         RSLog - Redstone Operations
  91.         HTTTPLog - HTTP Operations
  92.         RednetLog - Rednet Transmissions
  93.         TurtleLog - Turtle Operations (if applicable)
  94.  
  95. This program must be run as root!
  96. ]]
  97.  
  98. local sudo_help = [[
  99. sudo - run programs as root
  100.  
  101. ------------------------------------------
  102.  
  103. USAGE: sudo [root pw] [program] [arguments]
  104.  
  105. This program launches a program as root.
  106. This program will refuse to function if you are already root.
  107.  
  108. ]]
  109.  
  110. local adduser_help = [[
  111. addUser - add a user
  112.  
  113. ------------------------------------------
  114.  
  115. USAGE: adduser [username] [password]
  116.  
  117. This program adds a new user to the system.
  118. This user will have normal priviledges.
  119.  
  120. This program must be run as root!
  121. ]]
  122.  
  123. local systeminfo_help = [[
  124. systemInfo - display system information
  125.  
  126. ------------------------------------------
  127.  
  128. USAGE: systeminfo
  129.  
  130. This program displays the following:
  131.     MuSeOS Version
  132.     Computer ID
  133.     Computer Label
  134.    
  135.     If this program is run as root, the following is also displayed:
  136.     OSLog file size
  137.     fileLog file size
  138.     RSLog file size
  139.     HTTPLog file size
  140.     RednetLog file size
  141. ]]
  142.  
  143. local whoami_help = [[
  144. whoami - displays user info
  145.  
  146. ------------------------------------------
  147.  
  148. USAGE: whoami
  149.  
  150. This program displays the username of the current user and his/her user ID.
  151. ]]
  152.  
  153. local protect_help = [[
  154. protect - protects a folder from modification
  155.  
  156. ------------------------------------------
  157.  
  158. USAGE: protect [path/to/folder]
  159.  
  160. This program adds a folder to the protected folders file, ensuring that the OS blocks all attempts
  161. to access the file.
  162. Protected folders can still be accessed by root, though.
  163.  
  164. This program must be run as root!
  165. ]]
  166.  
  167. local deluser_help = [[
  168. delUser - delete a user
  169.  
  170. ------------------------------------------
  171.  
  172. USAGE: deluser [target]
  173.  
  174. This program deletes a user, their program settings folder, and their home folder.
  175.  
  176. This program is irreversible!
  177. This program must be run as root!
  178. ]]
  179.  
  180. local su_help = [[
  181. su - switch users
  182.  
  183. ------------------------------------------
  184.  
  185. USAGE: su [target user] [password]
  186.  
  187. This program allows a user to switch to another user's account, provided they know the target user's password.
  188. ]]
  189.  
  190. local changepassword_help =[[
  191. changepassword - change a user's password
  192.  
  193. ------------------------------------------
  194.  
  195. USAGE:changepassword [target user] [old password] [new password]
  196.  
  197. This program allows root to change a user's password, provided they know that user's current password.
  198.  
  199. This program must be run as root!
  200. ]]
  201.  
  202.  
  203. local diskinfo_help = [[
  204. diskinfo - show disk information
  205.  
  206. ------------------------------------------
  207.  
  208. USAGE: diskinfo [side]
  209.  
  210. This program shows information on the disk inserted in [side].
  211. Information shown:
  212.     Has Data/Has Music
  213.     Mount Path (if applicable)
  214.     Disk Label (if applicable)
  215.     Disk ID (if applicable)
  216.     Audio Title (if applicable)
  217.    
  218. You can also play music with This program, just press ENTER.
  219. To eject the inserted disk, press SPACE.
  220. To exit, press any key other than ESCAPE.
  221. ]]
  222.  
  223. local man_help = [[
  224. man - MuSeOS manual
  225.  
  226. ------------------------------------------
  227.  
  228. USAGE: man [command]
  229.  
  230. This program shows usage information and other things.
  231. It shows:
  232.     Arguments that must be passed to the program
  233.     How to use a program
  234.     What the program does
  235.     Notes
  236. ]]
  237. -- man pages end here
  238.  
  239.  
  240.  
  241. local function man()
  242.     local maxX, maxY = term.getSize()
  243.     term.clear()
  244.     term.setCursorPos(1,1)
  245.     topic = string.lower(args[1])
  246.     if topic == "logviewer" then
  247.         io.write(logviewer_help)
  248.     elseif topic == "sudo" then
  249.         io.write(sudo_help)
  250.     elseif topic == "su" then
  251.         io.write(su_help)
  252.     elseif topic == "whoami" then
  253.         io.write(whoami_help)
  254.     elseif topic == "protect" then
  255.         io.write(protect_help)
  256.     elseif topic == "deluser" then
  257.         io.write(deluser_help)
  258.     elseif topic == "changepassword" then
  259.         io.write(changepassword_help)
  260.     elseif topic == "diskinfo" then
  261.         io.write(diskinfo_help)
  262.     elseif topic == "adduser" then
  263.         io.write(adduser_help)
  264.     elseif topic == "systeminfo" then
  265.         io.write(systeminfo_help)
  266.     elseif topic == "api" then
  267.         io.write(api_help)
  268.     elseif topic == "programs" then
  269.         io.write(programs_help)
  270.     elseif topic == "updater" then
  271.         io.write(updater_help)
  272.     elseif topic == "turtlesettings" and turtle then
  273.         io.write(turtleSettings_help)
  274.     elseif topic == "backup" then
  275.         io.write(backup_help)
  276.     else
  277.         io.write(man_help)
  278.     end
  279.     term.setCursorPos(1,maxY)
  280.     io.write("Press any key to exit.")
  281.     os.pullEvent("key")
  282. end
  283.  
  284. if #args == 1 then
  285.     man()
  286. else
  287.     args[1] = "man"
  288.     man()
  289. end
  290. term.clear()
  291. term.setCursorPos(1,1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement