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

how to make a install disk?

Started by Hraponssi, 10 October 2015 - 10:24 AM
Hraponssi #1
Posted 10 October 2015 - 12:24 PM
how do i make a proper installer where it copys from my disk to the pc.
installer: http://pastebin.com/7tGKJj8k
i get a error everytime i run it:
bios:14: [string "install"]:2: '=' expected
thanks in advance :)/>
H4X0RZ #2
Posted 10 October 2015 - 07:53 PM
You can't run commands (to be more precise, programs) from within another program by simply writing down what you would use while in shell.
To run another program you have to use shell.run()

Your script could/should look like this then:

version = "1.0"
shell.run("cd /")
shell.run("mkdir os")
shell.run("cp /disk/os /os")
shell.run("cp /disk/gui /gui")
TYKUHN2 #3
Posted 10 October 2015 - 09:35 PM
Better yet I recommend using the APIs built for each use.

version = "1.0" #-- or 1.0 without quotes depending on use
fs.makeDir("os")
fs.copy("disk/os", "os")
fs.copy("disk/gui", "gui")
Edited on 11 October 2015 - 02:24 PM
H4X0RZ #4
Posted 11 October 2015 - 04:43 AM
Better yet I recommend using the APIs built for each use.

version = "1.0" #-- or 1.0 without quotes depending on use
fs.makeDir("os")
fs.copy("disk/os", "os")
fs.copy("gui", "gui")

Yes, this would be " better" performance-wise (less Funktion calls) but it also makes it harder for the OP to write the script.
valithor #5
Posted 11 October 2015 - 05:12 AM
Better yet I recommend using the APIs built for each use.

version = "1.0" #-- or 1.0 without quotes depending on use
fs.makeDir("os")
fs.copy("disk/os", "os")
fs.copy("gui", "gui")

Yes, this would be " better" performance-wise (less Funktion calls) but it also makes it harder for the OP to write the script.

It is generally bad practice to use shell.run for things that can be done with normal functions. It is a horrible thing to learn when you are just starting.

Either way it should be fs.copy("disk/gui","gui")
Edited on 11 October 2015 - 03:12 AM
Hraponssi #6
Posted 18 October 2015 - 08:34 AM
i ended up finding out about fs.copy() before i did of shell() so il stick to it, thanks for the ideas :)/>