Don't like ads? PRO users don't see any ads ;-)
Guest

COMPUTERcraft mail

By: a guest on Aug 8th, 2012  |  syntax: None  |  size: 6.88 KB  |  hits: 99  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. print("Hello, and welcome to the TCMail installer.")
  2. file = fs.open("/disk/TCMail/Client/startup", "r")
  3. a = file.readAll()
  4. s = (tostring(a))
  5. file.close()
  6. sleep( 1 )
  7. print("Which type of installation would you like to run? \nOptions are:\n1. Client - Install if you are a standard user.\n2. Server - Install if this computer is the mail server.\n3. Admin - Client install with server control utilities.\n4. Quit - If you want to quit.\nTYPE ONLY THE NAME, CASE SENSITIVE!")
  8. input = read()
  9. if input == "Server" then
  10.     print("Copying Server files to the computer. Do not turn off the power.")
  11.     print("Copying Startup file...")
  12.     fs.delete("/startup")
  13.     fs.copy("/disk/TCMail/Server/startup", "/startup")
  14.     sleep( 1 )
  15.     print("Copying Reboot file...")
  16.     fs.delete("/reboot")
  17.     fs.copy("/disk/TCMail/Server/reboot", "/reboot")
  18.     sleep( 1 )
  19.     print("Copying Server Runtime...")
  20.     fs.delete("/mailserv")
  21.     fs.copy("/disk/TCMail/Server/mailserv", "/mailserv")
  22.     sleep( 1 )
  23.     print("Installation completed. Please allow this program to exit and then take your floppy disk to use somewhere else.")
  24.     sleep( 3 )
  25.     print("Closing Active Files")
  26.     sleep( 1 )
  27.     print("Exiting TCMail installation...")
  28.     sleep( 1 )
  29.     print("...")
  30.     sleep( 1 )
  31.     print("...")
  32.     sleep( 1 )
  33.     print("...")
  34.     sleep( 1 )
  35.     shell.run("reboot")
  36. end
  37. if input == "Client" then
  38.     print("Copying Client files to the computer. Do not turn off the power.")
  39.     print("Copying Startup file...")
  40.     if fs.exists("/startup") then
  41.         file = fs.open("/startup", "r")
  42.         d = file.readAll()
  43.         file.close()
  44.         f = tostring(d)
  45.         if f == s then
  46.             print("Detected Existing TCMail Startup File, overwriting...")
  47.             fs.delete("/startup")
  48.             fs.copy("/disk/TCMail/Client/startup", "/startup")
  49.             sleep( 1 )
  50.         else
  51.             print("There appears to already be an Operating System installed on this computer, shown by the presence of a startup file. If you would like, TCMail can be installed alongside this Operating System, by appending TCMail's startup code to that of your OS. Would you like to do this? (yes/no/quit)")
  52.             input = read()
  53.             if input == "yes" then
  54.                 print("Appending Startup Code")
  55.                 print("Opening Startup File")
  56.                 file = fs.open("/startup", "a")
  57.                 print("Writing Code")            
  58.                 file.write(s)
  59.                 print("Writing Completed, closing file and continuing with the rest of the installation.")
  60.                 file.close()
  61.             end
  62.             if input == "quit" then
  63.                 print("Installation cancelled. Please allow this program to exit and then take your floppy disk to use somewhere else.")
  64.                 sleep( 3 )
  65.                 print("Closing Active Files")
  66.                 sleep( 1 )
  67.                 print("Exiting TCMail installation...")
  68.                 sleep( 1 )
  69.                 print("...")
  70.                 sleep( 1 )
  71.                 print("...")
  72.                 sleep( 1 )
  73.                 print("...")
  74.                 sleep( 1 )
  75.                 shell.run("reboot")
  76.             end
  77.             if input == "no" then
  78.                 print("Deleting the startup file and continuing with installation.")
  79.                 fs.delete("/startup")
  80.                 fs.copy("/disk/TCMail/Client/startup", "/startup")
  81.                 sleep( 1 )
  82.             end
  83.         end
  84.     else
  85.         fs.delete("/startup")
  86.         fs.copy("/disk/TCMail/Client/startup", "/startup")
  87.         sleep( 1 )
  88.     end
  89.     print("Copying Mail Program...")
  90.     fs.delete("/mail")
  91.     fs.copy("/disk/TCMail/Client/mail", "/mail")
  92.     sleep( 1 )
  93.     print("Copying Mail Registation Program...")
  94.     fs.delete("/mailreg")
  95.     fs.copy("/disk/TCMail/Client/mailreg", "/mailreg")
  96.     sleep( 1 )
  97.     print("Copying Silent Registration Program...")
  98.     fs.delete("/mailregsilent")
  99.     fs.copy("/disk/TCMail/Client/mailregsilent", "/mailregsilent")
  100.     sleep( 1 )
  101.     print("Copying Database Query Program...")
  102.     fs.delete("/mailreq")
  103.     fs.copy("/disk/TCMail/Client/mailreq", "/mailreq")
  104.     sleep( 1 )
  105.     print("Copying Email Registration Program...")
  106.     fs.delete("/emailreg")
  107.     fs.copy("/disk/TCMail/Client/emailreg", "/emailreg")
  108.     sleep( 1 )
  109.     print("Copying TCMail Client Help Program...")
  110.     fs.delete("/mhelp")
  111.     fs.copy("/disk/TCMail/Client/mhelp", "/mhelp")
  112.     sleep( 1 )
  113.     print("Installation completed. Please allow this program to exit and then take your floppy disk to use somewhere else.")
  114.     sleep( 3 )
  115.     print("Closing Active Files")
  116.     sleep( 1 )
  117.     print("Exiting TCMail installation...")
  118.     sleep( 1 )
  119.     print("...")
  120.     sleep( 1 )
  121.     print("...")
  122.     sleep( 1 )
  123.     print("...")
  124.     sleep( 1 )
  125.     shell.run("reboot")
  126. end
  127. if input == "Admin" then
  128.     print("Copying Admin files to the computer. Do not turn off the power.")
  129.     print("Copying Startup file...")
  130.     fs.delete("/startup")
  131.     fs.copy("/disk/TCMail/Admin/startup", "/startup")
  132.     sleep( 1 )
  133.     print("Copying Mail Program...")
  134.     fs.delete("/mail")
  135.     fs.copy("/disk/TCMail/Admin/mail", "/mail")
  136.     sleep( 1 )
  137.     print("Copying Mail Registation Program...")
  138.     fs.delete("/mailreg")
  139.     fs.copy("/disk/TCMail/Admin/mailreg", "/mailreg")
  140.     sleep( 1 )
  141.     print("Copying Silent Registration Program...")
  142.     fs.delete("/mailregsilent")
  143.     fs.copy("/disk/TCMail/Admin/mailregsilent", "/mailregsilent")
  144.     sleep( 1 )
  145.     print("Copying Database Query Program...")
  146.     fs.delete("/mailreq")
  147.     fs.copy("/disk/TCMail/Admin/mailreq", "/mailreq")
  148.     sleep( 1 )
  149.     print("Copying Email Registration Program...")
  150.     fs.delete("/emailreg")
  151.     fs.copy("/disk/TCMail/Admin/emailreg", "/emailreg")
  152.     sleep( 1 )
  153.     print("Copying TCMail Admin Help Program...")
  154.     fs.delete("/mhelp")
  155.     fs.copy("/disk/TCMail/Admin/mhelp", "/mhelp")
  156.     sleep( 1 )
  157.     print("Copying Server Admin Remote Reboot Program...")
  158.     fs.delete("/rbt")
  159.     fs.copy("/disk/TCMail/Admin/rbt", "/rbt")
  160.     sleep( 1 )
  161.     print("Installation completed. Please allow this program to exit and then take your floppy disk to use somewhere else.")
  162.     sleep( 3 )
  163.     print("Closing Active Files")
  164.     sleep( 1 )
  165.     print("Exiting TCMail installation...")
  166.     sleep( 1 )
  167.     print("...")
  168.     sleep( 1 )
  169.     print("...")
  170.     sleep( 1 )
  171.     print("...")
  172.     sleep( 1 )
  173.     shell.run("reboot")
  174. end
  175. if input == "Quit" then
  176.     print("Installation cancelled. Please allow this program to exit and then take your floppy disk to use somewhere else.")
  177.     sleep( 3 )
  178.     print("Closing Active Files")
  179.     sleep( 1 )
  180.     print("Exiting TCMail installation...")
  181.     sleep( 1 )
  182.     print("...")
  183.     sleep( 1 )
  184.     print("...")
  185.     sleep( 1 )
  186.     print("...")
  187.     sleep( 1 )
  188.     shell.run("reboot")
  189. end