Browse Source

Add statusproc back to bootscripts.
Remove doc/ files when stripping in Chapter 5.
Add --noclear to agetty for tty1 in inittab.


git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@9636 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

Bruce Dubbs 13 years ago
parent
commit
776f1dc3a4

+ 6 - 1
bootscripts/lfs/init.d/sysklogd

@@ -63,8 +63,13 @@ case "${1}" in
       ${0} start
       ;;
 
+   status)
+      statusproc /sbin/syslogd
+      statusproc klogd
+      ;;
+
    *)
-      echo "Usage: ${0} {start|stop|reload|restart}"
+      echo "Usage: ${0} {start|stop|reload|restart|status}"
       exit 1
       ;;
 esac

+ 55 - 1
bootscripts/lfs/lib/services/init-functions

@@ -417,7 +417,12 @@ pidofproc()
     if [ -z "${pidfile}" ]; then
         # Get the program's basename
         prefix=`echo "${program}" | sed 's/[^/]*$//'`
-        progname=`echo "${program}" | sed "s@${prefix}@@"`
+
+        if [ -z "${prefix}" ]; then 
+           progname="${program}"
+        else
+           progname=`echo "${program}" | sed "s@${prefix}@@"`
+        fi
 
         # If a PID file exists with that name, assume that is it.
         if [ -e "/var/run/${progname}.pid" ]; then
@@ -456,6 +461,55 @@ pidofproc()
     fi
 }
 
+################################################################################
+# statusproc()                                                                 #
+# Usage: statusproc [-p pidfile] pathname                                      #
+#                                                                              #
+# Purpose: This function prints the status of a particular daemon to stdout    #
+#                                                                              #
+# Inputs: -p pidfile, use the specified pidfile instead of pidof               #
+#         pathname, path to the specified program                              #
+#                                                                              #
+# Return values:                                                               #
+#       0 - Status printed                                                     #
+#       1 - Input error. The daemon to check was not specified.                #
+################################################################################
+statusproc()
+{
+   if [ "${#}" = "0" ]; then
+      echo "Usage: statusproc {program}"
+      exit 1
+   fi
+
+   if [ -z "${PIDFILE}" ]; then
+      pidlist=`pidofproc -p "${PIDFILE}" $@`
+   else
+      pidlist=`pidofproc $@`
+   fi
+
+   # Trim trailing blanks
+   pidlist=`echo "${pidlist}" | sed -r 's/ +$//'`
+
+   base="${1##*/}"
+
+   if [ -n "${pidlist}" ]; then
+      echo -e "${INFO}${base} is running with Process" \
+         "ID(s) ${pidlist}.${NORMAL}"
+   else
+      if [ -n "${base}" -a -e "/var/run/${base}.pid" ]; then
+         echo -e "${WARNING}${1} is not running but" \
+            "/var/run/${base}.pid exists.${NORMAL}"
+      else
+         if [ -n "${PIDFILE}" -a -e "${PIDFILE}" ]; then
+            echo -e "${WARNING}${1} is not running" \
+               "but ${PIDFILE} exists.${NORMAL}"
+         else
+            echo -e "${INFO}${1} is not running.${NORMAL}"
+         fi
+      fi
+   fi
+}
+
 ################################################################################
 # timespec()                                                                   #
 #                                                                              #

+ 16 - 0
chapter01/changelog.xml

@@ -36,6 +36,22 @@
     </listitem>
 
 -->
+    <listitem>
+      <para>2011-10-17</para>
+      <itemizedlist>
+        <listitem>
+          <para>[bdubbs] - Add statusproc back to bootscripts.</para>
+        </listitem>
+        <listitem>
+          <para>[bdubbs] - Also remove doc/ files when stripping in Chapter 5.
+          </para>
+        </listitem>
+        <listitem>
+          <para>[bdubbs] - Add --noclear to agetty for tty1 in inittab.</para>
+        </listitem>
+      </itemizedlist>
+    </listitem>
+
     <listitem>
       <para>2011-10-13</para>
       <itemizedlist>

+ 2 - 2
chapter05/stripping.xml

@@ -26,9 +26,9 @@ strip --strip-unneeded /tools/{,s}bin/*</userinput></screen>
   ones would be destroyed and the toolchain packages would need to be
   built all over again.</para>
 
-  <para>To save nearly 25 MB more, remove the documentation:</para>
+  <para>To save more, remove the documentation:</para>
 
-<screen><userinput>rm -rf /tools/{,share}/{info,man}</userinput></screen>
+<screen><userinput>rm -rf /tools/{,share}/{info,man,doc}</userinput></screen>
 
   <para>At this point, you should have at least 850 MB of free space in
   <envar>$LFS</envar> that can be used to build and install Glibc in the

+ 1 - 1
chapter07/usage.xml

@@ -73,7 +73,7 @@ ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
 
 su:S016:once:/sbin/sulogin
 
-1:2345:respawn:/sbin/agetty tty1 9600
+1:2345:respawn:/sbin/agetty --noclear tty1 9600
 2:2345:respawn:/sbin/agetty tty2 9600
 3:2345:respawn:/sbin/agetty tty3 9600
 4:2345:respawn:/sbin/agetty tty4 9600

+ 2 - 2
general.ent

@@ -1,5 +1,5 @@
-<!ENTITY version "SVN-20111013">
-<!ENTITY releasedate "Oct 13, 2011">
+<!ENTITY version "SVN-20111017">
+<!ENTITY releasedate "Oct 17, 2011">
 <!ENTITY copyrightdate "1999-2011"><!-- jhalfs needs a literal dash, not &ndash; -->
 <!ENTITY milestone "7.0">
 <!ENTITY generic-version "development"> <!-- Use "development", "testing", or "x.y[-pre{x}]" -->

+ 1 - 1
packages.ent

@@ -298,7 +298,7 @@
 <!ENTITY less-ch6-du "3.5 MB">
 <!ENTITY less-ch6-sbu "less than 0.1 SBU">
 
-<!ENTITY lfs-bootscripts-version "20111008">                 <!-- Scripts depend on this format -->
+<!ENTITY lfs-bootscripts-version "20111017">                 <!-- Scripts depend on this format -->
 <!ENTITY lfs-bootscripts-size "BOOTSCRIPTS-SIZE KB">         <!-- Updated in Makefile -->
 <!ENTITY lfs-bootscripts-url "&downloads-root;lfs-bootscripts-&lfs-bootscripts-version;.tar.bz2">
 <!ENTITY lfs-bootscripts-md5 "BOOTSCRIPTS-MD5SUM">           <!-- Updated in Makefile -->