In prep for ZeroNet, I’ve created a more customizable and flexible bootup system. The single file rc startup script meant that customization required editing the single file, and if you screwed up, you’ll have to go from the start. In addition, adding and removing snippets of the script was a hassle. After observing the method used for start files and researching a bit about the Linux bash file, I took the old rc script apart and rearranged it into a series of scripts that can be easily edited. Not only does this allow easy modification to only certain parts of startup (ie, whether MPD runs or not), it ensures that other parts of startup aren’t accidentally affected.
The system is arranged roughly like such;
inittab starts up the rc file:
set -x (all commands are shown as visible)
exec >> /var/log/boot-all.log 2>&1 (rather than print to screen, log it)
sh /etc/rc.d/bootscript (boot script)
> hostname ipod, etc
> mount -tvfat -osync,rw /dev/hda2 /mnt, etc
> if [ -d /etc/rc.d/misc.d ]; then
> for file in /etc/rc.d/misc.d/*; do
> sh $file
^ > clock script & mpd script
> (empty file)
> sh0 /mnt/start (old start files)
> sh /mnt/startm (new minix start files)
sh /etc/rc.d/startz (start gui)
Of course there’s real coding used, and the actual thing’s found here:
As you can see, this system allows for everything that the old rc system does and more. Not only does it break it into workable chunks, the ouputs can be logged to /var/log, extra scripts can be added or removed easily (for MPD I acutally added a trigger that can be disabled through running a shell script), and both old and new start files can be run.
Right now I’m looking for help in improving the system. My knowledge in the Linux bash shell is limited and there are a few things I know is possibly but I do not know how to accomplish. First, at the beginning of each script I hardcoded it so it would log to a log file in /var/log. What I would like it to do instead would be to first check for a trigger to tell it whether to log or not (like what I did for MPD), and if yes, then log. Basically the coding would be something like:
if [ -e /etc/rc.d/boot-options/log-yes ]; then
exec >> /var/log/boot.log
as apposed to just “exec >> /var/log/boot.log”. I tried that coding but it resulted only in no logging and nothing being executed. Also, even though the MPD trigger does work, the shell script I wrote to toggle it on/off seemingly doesn’t. I’m not too sure of the difference between the minix shell and old shell syntax in terms of renaming files, but either way, the script doesn’t work in ZeroLauncher nor Podzilla 0.
If anyone would be kind to help me either fix those few problems, improve the system or give suggestions, I thank you greately and hope you post ; )
iPodLinux forums: http://ipl.derpapst.org/oldforums/viewtopic.php?t=14440