MatthewGB

LuaMpcUpdater

May 19th, 2014
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.23 KB | None | 0 0
  1. print("Updater and downloader for Mat Programming Co ComputerCraft/LUA Software")
  2. print("Go to matprogramming.com/programs.php to see more programs")
  3. print(fs.getFreeSpace("/").."/"..fs.getSize("/").." bytes")
  4. print()
  5. function mkprg(id, pbcode, fname, name)
  6.  prg = {""}
  7.  prg[1] = id
  8.  prg[2] = pbcode
  9.  prg[3] = fname
  10.  prg[4] = name
  11.  return prg
  12. end
  13. ml2 = mkprg("1", "B7DMEc28", "ml2", "MotherLoad2")
  14. ht = mkprg("2", "NPAqsiCy", "httptest", "HTTP Tester")
  15. bs = mkprg("3", "tNp9mbrW", "boxs", "Box Shooter")
  16. ud = mkprg("4", "UrHwcU7L", "updater", "Updater")
  17. ms = mkprg("5", "HEtXTdeT",  "ms", "Monitor Sign Thing")
  18. mct = mkprg("6", "4NDJSTu9", "mct", "Mine Chem Turtle")
  19. tgc = mkprg("7", "h6njt4cs", "tgc", "Terminal Glasses Console")
  20. iro = mkprg("8", "R6z2D51E", "netrouter", "Internet Router")
  21. ira = mkprg("9", "WyXRR9Fn", "netradio", "Internet Radio")
  22. icl = mkprg("10","7bTMwiV7", "netclient", "Internet Client")
  23. prog = {""}
  24. nop = 10
  25. prog[1] = ml2
  26. prog[2] = ht
  27. prog[3] = bs
  28. prog[4] = ud
  29. prog[5] = ms
  30. prog[6] = mct
  31. prog[7] = tgc
  32. prog[8] = iro
  33. prog[9] = ira
  34. prog[10]= icl
  35. fs.makeDir("mpc")
  36. for k, v in pairs(prog) do
  37.   shell.run("rm mpc/"..v[3])
  38.   shell.run("pastebin get "..v[2].." "..v[3])
  39.   shell.run("mv "..v[3].." mpc/"..v[3])
  40. end
  41. print()
  42. print("Availible programs:")
  43. for k, v in pairs(prog) do
  44.   print(v[1]..": "..v[4].." ("..v[2]..")")
  45. end
  46. write("Program number: ")
  47. a = read()
  48. if a == "exit" or a == "quit" or a == "console" then
  49.  quit = true
  50. elseif a == "1" then
  51.  shell.run("mpc/ml2")
  52. elseif a == "2" then
  53.  shell.run("mpc/httptest")
  54. elseif a == "3" then
  55.  shell.run("mpc/boxs")
  56. elseif a == "4" then
  57.  shell.run("mpc/updater")
  58. elseif a == "5" then
  59.  shell.run("mpc/ms")
  60. elseif a == "6" then
  61.  shell.run("mpc/mct")
  62. elseif a == "7" then
  63.  shell.run("mpc/tgc")
  64. elseif a == "8" then
  65.  print("The internet router has to be used on a dedicated computer, so this computer has been set as the startup file. The previous startup file is called oldstartup")
  66.  shell.run("cp startup oldstartup")
  67.  shell.run("rm startup")
  68.  shell.run("cp mpc/netrouter startup")
  69.  shell.run("mpc/netrouter")
  70. elseif a == "9" then
  71.  shell.run("mpc/netradio")
  72. elseif a == "10" then
  73.  shell.run("mpc/netclient")
  74. else
  75.  print("Invalid number")
  76. end
Advertisement
Add Comment
Please, Sign In to add comment