| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 | <sect1 id="ch07-rcS"><title>Creating the rcS script</title><?dbhtml filename="rcs.html" dir="chapter07"?><para>The second main boot script is the <filename>rcS</filename> script. Create the <filename>/etc/init.d/rcS</filename> script by running the followingcommand:</para><para><screen><userinput>cat > /etc/init.d/rcS << "EOF"</userinput>#!/bin/sh# Begin /etc/init.d/rcS## See the rc script for the extensive comments on the constructions# used here#source /etc/init.d/functionsprint_error_msg(){         echo        $FAILURE        echo -n "You should not read this error message. It means "        echo "that an unforeseen error "        echo -n "took place and subscript $i exited with "        echo "a return value "        echo -n "of $error_value for an unknown reason. If you're able "        echo "to trace this error down "        echo -n "to a bug in one of the files provided by this book, "        echo "please be so kind to "        echo -n "inform us at lfs-dev@linuxfromscratch.org"        $NORMAL        echo        echo        echo "Press a key to continue..."        read}runlevel=Sprevlevel=Numask 022export runlevel prevleveltrap ":" INT QUIT TSTP## Collect all the S scripts in /etc/rcS.d and execute them#for i in /etc/rcS.d/S*do        [ ! -f  "$i" ] && continue;                $i start                error_value=$?                if [ $error_value != 0 ]                then                        print_error_msg                fidone# End /etc/init.d/rcS<userinput>EOF</userinput></screen></para></sect1>
 |