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

Startup Programs

Started by cptdeath58, 05 May 2014 - 09:54 PM
cptdeath58 #1
Posted 05 May 2014 - 11:54 PM
I was wondering if there is any way to reroute a computer to select its hard drive's startup rather than the disk's startup.
In other words, Using the computer's startup other than the disk's.
CometWolf #2
Posted 06 May 2014 - 12:13 AM
Without acess to the rom files, there is not. If you do however have acess to them, you can edit this part of the shell to acheive what you want.

-- Then run the user created startup, from the disks or the root
local sUserStartup = shell.resolveProgram( "/startup" )
for n,sSide in pairs( peripheral.getNames() ) do
  if disk.isPresent( sSide ) and disk.hasData( sSide ) then
   local sDiskStartup = shell.resolveProgram( fs.combine(disk.getMountPath( sSide ), "startup") )
   if sDiskStartup then
    sUserStartup = sDiskStartup
    break
   end
  end
end

if sUserStartup then
  shell.run( sUserStartup )
end
cptdeath58 #3
Posted 06 May 2014 - 12:26 AM
Well thanks.
Now to figure out how to access them.
Bomb Bloke #4
Posted 06 May 2014 - 12:43 AM
You can do something similar if you have access to the disk, just stick this at the start of the disk's startup script:

if fs.exists("startup") then shell.run("startup") end

I had a setup where I placed a disk drive next to a computer containing a disk with a script that programmed new turtles. Obviously I didn't want the computer to configure itself as a turtle, but since I didn't want to move the disk around every time I wanted to change its contents, I simply rigged the code as above. Well, actually I rigged it so that it detected whether the system was a turtle or not, but you get the idea.

Of course, shortly after I implemented that the MineCraft server started stalling every few hours or so. I never fully diagnosed the issue, but I did eventually narrow it down to that system. Beats me whether it was the usage of my disk drive or not.