This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Selkitty's profile picture

Simple Install Program

Started by Selkitty, 28 January 2012 - 08:20 AM
Selkitty #1
Posted 28 January 2012 - 09:20 AM
USE THIS SCRIPT TO PUT THE INSTALLER ON A DISK QUICKLY AND EASILY


Very simple script to install a startup program to a dedicated terminal (can be modified to install other things as well) Can also be used to update that program on terminals that already have it.

Thanks to FuzzyPurp for showing me the functions to use to throw this together XD (because I'm a total noob at lua)
NOTE: this code is nolonger used, the code in Kaleb702's post is used instead. the code has been updated a few times, take a look at the code on cc-get to see the changes






fs.delete("NAME") -- startup can be changed if you dont want a dedicated terminal
fs.copy("disk/PROGRAM","NAME") -- PROGRAM is the name of the program you have added to the disk to be installed and startup is the same as above
sleep(1)
print("Your program has been installed.")
print("Shutting down the terminal.")
sleep(2)
shell.run("shutdown")



this is a link to the program itself, use the link at the top to properly add it to a disk ready for use cc-get Link


EDIT: UPDATED THE POST A BIT FOR NO REASON OTHER THAN IT WAS BUGGING ME
Kaleb702 #2
Posted 01 February 2012 - 04:56 AM
Took the time to improve your's a little.



file = "" – Change the file
directory = "" – Change the directory

term.clear()
textutils.slowPrint("————————-")
textutils.slowPrint("Install Mage: " .. file)
textutils.slowPrint("————————-")

– fs
.delete("startup")
fs.copy("disk/" .. file, directory .. file)
os.sleep
(1)
textutils.slowPrint("Your program has been installed. Please remove the disk from your computer.")
print("Thank you for choosing Install Mage.")
io.read()
os.shutdown()

Why? Because now it's just a little bit easier to change the file and directory it is installed to. Also, it now uses the proper practice for shutting down the computer. Avoid shell.run like the plague.
Selkitty #3
Posted 01 February 2012 - 07:31 AM
Very nice edit, I'll probably swap over to that. Having named variables makes the world a lot smoother x3 Mine was just built to get the job done when I needed a program to quickly add other programs to multiple terminals and the shell.run was just leftover from a different program I was working on ^^
Kaleb702 #4
Posted 01 February 2012 - 06:31 PM
You're welcome, and you can do whatever you want with that.

Also, I totally ruined the highlighting. :(/>/>
rockymc #5
Posted 04 February 2012 - 07:55 PM
Why don't you use the
read()
to read the install dir and file?
Kaleb702 #6
Posted 04 February 2012 - 08:37 PM
Why don't you use the
read()
to read the install dir and file?

Mmm, because the user might not know the file. Installers install a specific file. As for the directory, maybe, but they might pick an invalid directory. (Which wouldn't be too hard to fix; if input <is directory and is existing, do normal install> else <make directory, do normal install>)
rockymc #7
Posted 04 February 2012 - 09:50 PM
Well, I made my installer. WizTall installs whatever program the user wants to.
FuzzyPurp #8
Posted 05 February 2012 - 07:29 AM
Well, I made my installer. WizTall installs whatever program the user wants to.

Hmm.. i don't seem to see it on the forum.
rockymc #9
Posted 05 February 2012 - 05:47 PM
Well, I made my installer. WizTall installs whatever program the user wants to.

Hmm.. i don't seem to see it on the forum.

Gonna publish it.
Selkitty #10
Posted 06 February 2012 - 02:36 AM
Well, I made my installer. WizTall installs whatever program the user wants to.

Thats exactly what this installer does. granted yes you have to edit the named variables but it's function is to install a specified program from a floppy to a terminal.
!!!!!!!!!!ExclaimationMark #11
Posted 13 August 2014 - 04:56 AM
This is the first unlocked thread, so I went to do nerocing on this. (oh, and now I am the king of nerocing. (XD))