Running external scripts from bootfile script

Ive successfully setup my bootfile and image on a compactflash card thanks to all the great advice available on these forums. I’ve got the cf card file system mounted so i can see all the files on the card.

My next problem is that I want to run a configuration script (/etc/rc.d/rc.sysinit) from the bootfile. However, it appears to either not want to “start” the script, or hangs in the process.

I’ve tried 2 methods; the first being to run the script directly as a command, ie

waitfor /etc/rc.d/rc.sysinit

this gives me an error similar to “Cannot start /etc/rc.d/rc.sysinit (8)”

secondly, i tried running it from shell, which i expected would be more successful.

devc-con -n2 &
waitfor /dev/con1
waitfor /etc/rc.d/rc.sysinit
reopen /dev/con1
[+session] TERM=qansi sh -c /etc/rc.d/rc.sysinit&
reopen /dev/con2
[+session] TERM=qansi sh

However, this just appears to stop when it gets to the script. the second console is available. The rc.sysinit script I have just sets environment variables PATH and LD_LIBRARY_PATH, and runs fine on its own if i just go ./rc.sysinit.

Any ideas?

Yes you need to go though a shell to run a script.

What makes you think it stopped. If all you do is set environement variables these variable dies as soon as the sh dies, which means as soon as the script finisted. Setting environment variable only work for current process (the shell) and then they get inherrited by the children, they can`t make their way up the process tree,

Thanks mario. spot on. i now start sh again at the end of the script and its goods. this gives me the environment i need.

Having now solved all my bootfile gremlins, Ive migrated from an 8mb compact flash to a 512 mb one. only now, the exact same image file wont run! It goes through the bit that prints all the dots on the screen and then stops! I built the same bootfile again, removing the +compress option, and it booted, however then wouldnt start any of the devices. ie giving error messages such as ‘Unable to start “seedres” (8)’, ‘Unable to start “pci-bios” (8)’ etc.

what have i done wrong? is there some option i should be using for large CF cards?

Sounds more like a bios problem with the larger compact flash. How are you initing it?


I ended up changing the bootfile keywords ‘.bootstrap’ to ‘boot’ and ‘.script’ to ‘startup-script’. very strange, but it works again, so i guess im happy.