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

How do i create a program install

Started by ForceLog, 05 January 2016 - 08:21 AM
ForceLog #1
Posted 05 January 2016 - 09:21 AM
i have a program but i idk how to create a auto install this is the code i did

shell.run("copy","disk/clean")

what should install the program clean but it dosen't i also tryed these 2

shell.run("cp","disk/info","info")
also tryed
shell.run(fs.copy","(disk/info","startup)")

none work please tell me how to create one
Lyqyd #2
Posted 05 January 2016 - 03:28 PM
Moved to Ask a Pro.
TheOddByte #3
Posted 05 January 2016 - 04:14 PM
You're using fs.copy in shell.run, which will error.

What you want to do is to use fs.copy like this

fs.copy( "<the file you want to copy>", "<the path you want to copy to>" )
So if you're trying to copy the file "info" from the disk to the computer you'd want to do this

fs.copy( "disk/info", "info" )
agowa338 #4
Posted 08 January 2016 - 12:24 AM
Here is my installer (Change the first three lines):
Spoiler

local diskID = 1  --output of disk.getID()
local source = "tstartup"
local destination = "/startup"

local drivePath
local driveSide
fs.delete(destination)

for _, side in ipairs(rs.getSides()) do
  if peripheral.isPresent(side) and peripheral.getType(side) == "drive" and disk.getID(side) then
    driveSide = side
    drivePath = "/"..disk.getMountPath(driveSide)
    break
  end
end
fs.copy(drivePath.."/"..source, destination)
print("Installation finished")
sleep(1)
disk.eject(driveSide)
os.reboot()

Edited on 07 January 2016 - 11:26 PM