Boot scripts

As far as i know, bootscripts aren't things you can just download, so i'm gonna make my own bootscripts, and will expand this structure when i add functionality.
Since there is not really a reason to stop processes, i just make scripts that start things. The only thing i'll be stopping nicely is my ppp connection.

To follow the standards as much as possible, i will create some scripts in /etc/init.d, which are called by init.
For this i need to change the /etc/inittab, my new inittab:
l3:3:wait:/etc/init.d/rc 3
Now the first script, /etc/init.d/boot. I don't really know anything that i want to put into this, so let's use a empty script for now:
# Put anything over here that has to be executed directly after booting

The /etc/init.rc/rc will be some more difficult. It takes the first parameter, and switches to that runlevel by executing scripts in /etc/init.d/rc[runlevel].d/ On a normal system these are symbolic links to the real scripts. Because i will only use 2 runlevels (One for booting, one for shutdown), i won't use that construction.
This is what i use as a /etc/init.d/rc:
# Runlevel change script called by init
# First argument is the runlevel to switch to.
if [ -z "$1" ]
 echo "This script needs 1 argument, which is the runlevel to switch to"

This leaves us with creating the seperate scripts for doing all the things we need. The first thing we should do, is remounting the filesystem read-write. This will enable us to experiment with some things if the system is booted (and many processes like to write). Remember, this is just an image which will be loaded into memory, and changes will be made in memory, so changing anything is never permanent.

Because (see the inittab) our default runlevel is 3, i need to make this in /etc/init.d/rc3.d and i'll call it 00_remount_root. The numbers in the beginning of the filename are to determine the order of execution (else the order will be aphabetical).
The remount_root is quite easy:
echo "Remounting root filesystem to read/write..."
mount -n /dev/ram0 / -o remount,rw

Now, the next thing to do will be mounting the virtual filesystems, in my case /dev/pts and /proc. I called this script 00_mount_filesystems:
echo "Mounting virtual filesystems"
mount -t proc proc /proc
mount -t devpts devpts /dev/pts

And ofcourse a /etc/fstab according would be nice:
devpts  /dev/pts        devpts  defaults 0 0
proc    /proc   proc    defaults 0 0

Last but not least, i have to create the mountpoint:
mkdir /proc
mkdir /dev/pts

So, now the most basic things are done. From now i will start numbering the scripts from 5 and increase by 5, so if any script comes between two older, i don't have to rename everything.

Next thing will be setting up the network. This includes the local loopback and the ethernet (or any other) interface.
I'll call this script 05_configure_network:
echo "Configuring network interfaces ..."
ifconfig lo netmask
ifconfig eth0 netmask
ifconfig eth0:0 netmask                                 

The first ifconfig is for the loopback interface, the second is my ethernet card, and the third is an alias (second ip address) for the ethernet card.

Maybe it's time for a boot now, just to see if the scripts work as expected.

For me ... it didn't. I used the same scripts as on my old router image, which used all the "official" tools instead of busybox. Result is that the remounting fails. For some reason it seems to depend on the /proc diretcory. So i need to swap the mounting of virutal systems and remounting the root (Just change 00 to 01 and 01 to 00).