Библиотека сайта rus-linux.net
6.3. Construction
There is a lot of typing to do in this section because of all of the start-up scripts that need to be created. Using a mouse to copy the text from this guide and paste it into a text editor can be a great time saving tool.
6.3.1. Create a GRUB configuration file
Insert and mount the floppy labeled "boot disk".
|
Use your favorite text editor to create the following file and save it as /mnt/boot/grub/menu.lst:
default 0 timeout 3 title Pocket Linux Boot Disk kernel (fd0)/boot/vmlinuz root=/dev/fd0 load_ramdisk=1 prompt_ramdisk=1 |
6.3.2. Install sysvinit utilities
Download the latest sysvinit source from ftp://ftp.cistron.nl/pub/people/miquels/software/
|
In the interest of speed we are skipping the steps for checking libraries and stripping binaries. The library requirements for sysvinit are very basic and the Makefile is configured to automatically strip the binaries. |
6.3.3. Create /etc/inittab file
Use a text editor to create the following file and save it as
~/staging/etc/inittab
# /etc/inittab - init daemon configuration file # # Default runlevel id:1:initdefault: # # System initialization si:S:sysinit:/etc/init.d/rc S # # Runlevel scripts r0:0:wait:/etc/init.d/rc 0 r1:1:respawn:/bin/sh r2:2:wait:/etc/init.d/rc 2 r3:3:wait:/etc/init.d/rc 3 r4:4:wait:/etc/init.d/rc 4 r5:5:wait:/etc/init.d/rc 5 r6:6:wait:/etc/init.d/rc 6 # # end of /etc/inittab |
6.3.4. Create /etc/init.d/rc script
Use a text editor to create the following file and save it as
~/staging/etc/init.d/rc
#!/bin/sh # # /etc/init.d/rc - runlevel change script # PATH=/sbin:/bin SCRIPT_DIR="/etc/rc$1.d" # # Check that the rcN.d directory really exists. if [ -d $SCRIPT_DIR ]; then # # Execute the kill scripts first. for SCRIPT in $SCRIPT_DIR/K*; do if [ -x $SCRIPT ]; then $SCRIPT stop; fi; done; # # Do the Start scripts last. for SCRIPT in $SCRIPT_DIR/S*; do if [ -x $SCRIPT ]; then $SCRIPT start; fi; done; fi # # end of /etc/init.d/rc |
Make the file executable.
|
6.3.5. Modify /etc/init.d/local_fs script
A case statement is added to allow the script to either mount or unmount local filesystems depending on the command-line argument given. The original script is contained inside the "start" portion of the case statement. The "stop" portion is new.
#!/bin/sh # # local_fs - check and mount local filesystems # PATH=/sbin:/bin ; export PATH case $1 in start) echo "Checking local filesystem integrity." fsck -ATCp if [ $? -gt 1 ]; then echo "Filesystem errors still exist! Manual intervention required." /bin/sh else echo "Remounting / as read-write." mount -n -o remount,rw / echo -n > /etc/mtab mount -f -o remount,rw / echo "Mounting local filesystems." mount -a -t nonfs,smbfs fi ;; stop) echo "Unmounting local filesystems." umount -a -r ;; *) echo "usage: $0 start|stop"; ;; esac # # end of local_fs |
6.3.6. Create a hostname script
Use a text editor to create the following script and save it as
~/staging/etc/init.d/hostname
#!/bin/sh # # hostname - set the system name to the name stored in /etc/hostname # PATH=/sbin:/bin ; export PATH echo "Setting hostname." if [ -f /etc/hostname ]; then hostname $(cat /etc/hostname) else hostname gnu-linux fi # # end of hostname |
6.3.7. Create halt & reboot scripts
Use a text editor to create
~/staging/etc/init.d/halt
as shown below.
#!/bin/sh # # halt - halt the system # PATH=/sbin:/bin ; export PATH echo "Initiating system halt." halt # # end of /etc/init.d/halt |
Create the following script and save it as
~/staging/etc/init.d/reboot
#!/bin/sh # # reboot - reboot the system # PATH=/sbin:/bin ; export PATH echo "Initiating system reboot." reboot # # end of /etc/init.d/reboot |
Flag all script files as executable.
|
6.3.8. Create rcN.d directories and links
|