Linux On iPod Forum Index
 FAQ  •  Search  •  Memberlist  •  Usergroups  •  Profile  •  Log in to check your private messages  •  Log in
 Advanced rc system - looking for help and suggestions View next topic
View previous topic
Post new topicReply to topic
Author Message
Keripo Test Account
Contributor


Joined: 11 Apr 2006

Location: Ontario, Canada

PostPosted: Wed Jul 12, 2006 5:20 pm Reply with quoteBack to top

Note: This isn't exactly a "software", but this was the best place to put it.

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;

Code:
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:
Code:
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

_________________
Project ZeroSlackr
http://sourceforge.net/projects/zeroslackr/
http://ipodlinux.org/forums/viewtopic.php?t=29636
View user's profileSend private messageSend e-mailVisit poster's websiteAIM AddressMSN Messenger
Confused Fishcake



Joined: 16 Apr 2006


PostPosted: Thu Jul 13, 2006 6:14 am Reply with quoteBack to top

Surely this would make iPl even slower to boot? iPods don't have very fast seek times for the hard disk, so it mught not be a great idea. I like the idea in theory, but if it adds more than a second to boot times, its not much good.
View user's profileSend private messageMSN Messenger
jgjake2



Joined: 04 Mar 2006

Location: Texas

PostPosted: Thu Jul 13, 2006 6:18 am Reply with quoteBack to top

Confused Fishcake wrote:
Surely this would make iPl even slower to boot? iPods don't have very fast seek times for the hard disk, so it mught not be a great idea. I like the idea in theory, but if it adds more than a second to boot times, its not much good.

dude, booting this and booting the normal rc file, would almost b the same. at the MOST it would b a 30 sec diff, and even that is pushing it...

_________________
http://ipodlinux.org/allin1
http://www.myspace.com/xxxdiefckr
ajpsk8: (iPod)
i put it in the microwave and it... pops...
View user's profileSend private messageVisit poster's website
trubld1



Joined: 27 Dec 2005

Location: Toronto, Canada

PostPosted: Thu Jul 13, 2006 12:39 pm Reply with quoteBack to top

@jgjake2: don't you mean 30 msec, becasue that would be a big difference.

_________________
5.5G MacPod. - iBoy - Podzilla 2 - ScummVM
View user's profileSend private messageSend e-mailVisit poster's websiteAIM AddressMSN Messenger
AriX



Joined: 22 Nov 2005

Location: Pennsylvania

PostPosted: Thu Jul 13, 2006 1:07 pm Reply with quoteBack to top

Keripo Test Account wrote:
Note: This isn't exactly a "software", but this was the best place to put it.

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;

Code:
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:
Code:
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


Hey, nice work!
I made an improved version, because there were a few things that didn't make much sense. First, if this was being added onto a userland that mounted to hp, you'd need to add the mnt folder, which I did. Other edits:

The custom thing was removed, custom scripts are now run from /etc/rc.d/misc.d/, because it makes way more sense that way, having one custom file makes way less sense then adding as many custom scripts to a folder, because an automated installer may put in a custom script and another one may modify it. The rc file was modified to tell you how to do it.

I made it so that it never used startm scripts or whatever they were called, because I recently found out that minix-sh could use old sh commands the same way, and no one would ever use that.

The startfile script was removed, and the contents starting from if [-e... was put in the rc file in place, because it didn't make sense having an external file be launched using the same amount of code that the external file itself used.

I made it so that if neither PodzillaBackup or ZeroNet existed, podzilla would be launched so that you don't need ZeroNet to use this cool rc system.

I tried to fix the toggle MPD thing, tell me if it worked.

I think that's it, you can download my version at http://winx.mtservers.net/rcsystem.zip

I reccommend that you use my version, because it has a numer of improvments over yours. The start file thing you did (with the startm and start) didn't make any sense, because minix-sh can run old start files, and sh can't run new start files, but that doesn't matter because if you are using this rc system you are using minix-sh anyway.

All in all, good job, and I hope you appreciate my edits.
Also, I don't think this would make bootup any slower.

_________________
iPodLinux Manager! (Now v1.1)
http://www.ipodlinux.org/forums/viewtopic.php?p=192609
View user's profileSend private messageSend e-mailVisit poster's websiteAIM AddressMSN Messenger
Keripo Test Account
Contributor


Joined: 11 Apr 2006

Location: Ontario, Canada

PostPosted: Thu Jul 13, 2006 3:06 pm Reply with quoteBack to top

Here with a few improvements from Ari. start files are run using minix shell by default (there's still the option for using the old shell if you're a non-believer), custom scripts are run by a folder like miscellaneous scripts and will be symlinked to the Fat32 partition for easy access, MPD toggle'r changed a bit, and a podzilla binary was added (actually a Floydzilla binay).

http://mysourcedump.org/upload.php?pid=54535801

Again, I remind that this is not for practical use at the moment but is rather just for feedback.

_________________
Project ZeroSlackr
http://sourceforge.net/projects/zeroslackr/
http://ipodlinux.org/forums/viewtopic.php?t=29636
View user's profileSend private messageSend e-mailVisit poster's websiteAIM AddressMSN Messenger
AriX



Joined: 22 Nov 2005

Location: Pennsylvania

PostPosted: Thu Jul 13, 2006 3:21 pm Reply with quoteBack to top

Keripo Test Account wrote:
Here with a few improvements from Ari. start files are run using minix shell by default (there's still the option for using the old shell if you're a non-believer), custom scripts are run by a folder like miscellaneous scripts and will be symlinked to the Fat32 partition for easy access, MPD toggle'r changed a bit, and a podzilla binary was added (actually a Floydzilla binay).

http://mysourcedump.org/upload.php?pid=54535801

Again, I remind that this is not for practical use at the moment but is rather just for feedback.


It's no longer exactly an rc system, I call it a userland add-on. Maybe you should call it that?

_________________
iPodLinux Manager! (Now v1.1)
http://www.ipodlinux.org/forums/viewtopic.php?p=192609
View user's profileSend private messageSend e-mailVisit poster's websiteAIM AddressMSN Messenger
Display posts from previous:      
Post new topicReply to topic


 Jump to:   



View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group :: FI Theme :: All times are GMT