.entry-views-count{ display: none !important; }

Advanced rc system – looking for help and suggestions

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

sh /etc/rc.d/mounting
> mount -tvfat -osync,rw /dev/hda2 /mnt, etc

sh /etc/rc.d/misc
> if [ -d /etc/rc.d/misc.d ]; then
> for file in /etc/rc.d/misc.d/*; do
> sh $file
> done
>fi
^ > clock script & mpd script

sh /etc/rc.d/custom
> (empty file)

sh /etc/rc.d/startfile
> sh0 /mnt/start (old start files)
> sh /mnt/startm (new minix start files)

sh /etc/rc.d/startz (start gui)

reboot

Of course there’s real coding used, and the actual thing’s found here:
http://mysourcedump.org/upload.php?pid=40839547

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
fi

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 ; )

~Keripo

iPodLinux forums: http://ipl.derpapst.org/oldforums/viewtopic.php?t=14440

Check Also

Anime Expo 2019 – Part 3: Azur Lane

Post Views: 1,303 This is Part 3: Azur Lane of my series of blog posts …