rcS.xml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <sect1 id="ch07-rcS">
  2. <title>Creating the rcS script</title>
  3. <para>The second main boot script is the <filename>rcS</filename> script.
  4. Create the <filename>/etc/init.d/rcS</filename> script by running the following
  5. command:</para>
  6. <para><screen><userinput>cat &gt; /etc/init.d/rcS &lt;&lt; "EOF"</userinput>
  7. #!/bin/sh
  8. # Begin /etc/init.d/rcS
  9. #
  10. # See the rc script for the extensive comments on the constructions
  11. # used here
  12. #
  13. source /etc/init.d/functions
  14. print_error_msg()
  15. {
  16. echo
  17. $FAILURE
  18. echo -n "You should not read this error message. It means "
  19. echo "that an unforeseen error "
  20. echo -n "took place and subscript $i exited with "
  21. echo "a return value "
  22. echo -n "of $error_value for an unknown reason. If you're able "
  23. echo "to trace this error down "
  24. echo -n "to a bug in one of the files provided by this book, "
  25. echo "please be so kind to "
  26. echo -n "inform us at lfs-discuss@linuxfromscratch.org"
  27. $NORMAL
  28. echo
  29. echo
  30. echo "Press a key to continue..."
  31. read
  32. }
  33. runlevel=S
  34. prevlevel=N
  35. umask 022
  36. export runlevel prevlevel
  37. trap ":" INT QUIT TSTP
  38. #
  39. # Collect all the S scripts in /etc/rcS.d and execute them
  40. #
  41. for i in /etc/rcS.d/S*
  42. do
  43. [ ! -f "$i" ] &amp;&amp; continue;
  44. $i start
  45. error_value=$?
  46. if [ $error_value != 0 ]
  47. then
  48. print_error_msg
  49. fi
  50. done
  51. # End /etc/init.d/rcS
  52. <userinput>EOF</userinput></screen></para>
  53. </sect1>