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
Pocket Linux Guide
Chapter 6. Automating Startup & Shutdown
32