Boot
Scripts

This is the final chapter in the base system. I considered just mixing
this chapter in when we installed sysvinit dynamically, but I can see
that over time, it will need modifications depending on the software that
is installed.
We'll just be doing a minimal install of the scripts for now, basically
everything necessary to be able to log in as a user and automatically
mount the root, proc and swap file systems as well as unmount them at
shutdown. Also, you will finally be able to execute the shutdown command
like normal.
First, go back into the sysvinit package. Go into the /debian/etc folder.
Copy everything inside this folder into your /etc folder on the
linux2 system by typing cp -dpR * /etc
Next, go into your /etc/init.d folder on your linux2 system. Find
a file in there called rcS. We'll need to edit this file with vi.
Find a line in there that reads [ -d /etc/rc.boot] && run-parts /etc/rc.boot
and put a # in front of it to comment it out. Also, on the very last
line of this file, you can add a line that says hostname NAME
where NAME is whatever you want your computer to be called (BYOLINUX
always looks nice). Save this file.
In this same folder, find a file in there called sendsigs. Use vi to
edit this file as well. There are 4 lines in there that begin with the
word echo. Comment these out as well. The reason for this is that bash
says these same comments so it would be showing up on your screen twice.
Feel free to see for yourself if you want, or even change what the scripts
are saying. I prefer just to let bash do the talking.
Next, go back in the sysvinit package. Go into the /debian/examples directory
and copy a file called default.rcS to your /etc/default folder
on the linux2 system and rename it to rcS. Also from this folder,
copy bootlogd, network, and powerfail to /etc/init.d
Next, we need to create symlinks to the files in /etc/init.d to the appropriate
runlevel directories. This is how linux knows what to load up at bootup
as well as what to do at shutdown or reboot depending on what runlevel
is selected.
First, goto /etc/rc6.d and type the following:
ln -s /etc/init.d/sendsigs S80sendsigs
ln -s /etc/init.d/umountfs S90umountfs
ln -s /etc/init.d/reboot S99reboot
Next, goto /etc/rc0.d and type the following:
ln -s /etc/init.d/sendsigs S80sendsigs
ln -s /etc/init.d/umountfs S90umountfs
ln -s /etc/init.d/halt S99halt
Next, goto /etc/rcS.d and type the following (these generally
load up no matter what runlevel your going to in /etc/inittab):
ln -s /etc/init.d/checkroot.sh S10checkroot.sh
ln -s /etc/init.d/checkfs.sh S20checkfs.sh
Next, create a /var/log directory.
Next, at the prompt, type touch /var/run/utmp and touch /var/log/wtmp
This creates a zero byte file that will be written to later. Linux
will complain without these files.
This next step is completely optional but I think it looks good, lets
change the way the ls command shows you directories and files. Use vi
to edit the /etc/profile file. Add the following line:
alias ls='ls --color=auto'
From now on (after your next reboot), files, directories, and symlinks
will be shown in different colors.
Essentially, this is the end of the project as far as a base system.
Congratulations.
What you install from this point on is generally up to you. At this point,
it would be nice if you could send me
an email to let me know of your achievment.
Make another backup of your hard work. This backup is different then
the last one we did because we are making the backup right from the same
filesystem we are currently in instead of linux1. Do a cd / to get to
the main (root) directory. Next, unmount Linux1 so you don't backup everything
on that filesystem as well. Type:
tar cvf backup3.tar *
This will create a file called backup3.tar
You should compress this file with gzip because it's huge by typing:
gzip backup3.tar
Try a normal reboot now by typing shutdown -r now and see what happens.
You may get an error regarding the swap. This is a one time error so don't
worry about it. Make sure you check out your /proc (assuming it's enabled
in your kernel) directory after reboot as well as try a alt-F2 through
F6 to make sure your consoles are working (assuming these are enabled
in your kernel).
|