From 4c5eaf346f8d91e1cff512477fb79ddb07965b0e Mon Sep 17 00:00:00 2001 From: bdubbs Date: Tue, 18 Oct 2011 00:03:30 +0000 Subject: [PATCH] Add statusproc back to bootscripts. Remove doc/ files when stripping in Chapter 5. Add --noclear to agetty for tty1 in inittab. git-svn-id: svn://svn.linuxfromscratch.org/LFS/trunk/BOOK@9636 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- bootscripts/lfs/init.d/sysklogd | 7 +++- bootscripts/lfs/lib/services/init-functions | 56 ++++++++++++++++++++++++++++- chapter01/changelog.xml | 16 +++++++++ chapter05/stripping.xml | 4 +-- chapter07/usage.xml | 2 +- general.ent | 4 +-- packages.ent | 2 +- 7 files changed, 83 insertions(+), 8 deletions(-) diff --git a/bootscripts/lfs/init.d/sysklogd b/bootscripts/lfs/init.d/sysklogd index 72e349744..eb76dfc13 100644 --- a/bootscripts/lfs/init.d/sysklogd +++ b/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 diff --git a/bootscripts/lfs/lib/services/init-functions b/bootscripts/lfs/lib/services/init-functions index 93931dca9..4ba623adc 100644 --- a/bootscripts/lfs/lib/services/init-functions +++ b/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 @@ -457,6 +462,55 @@ pidofproc() } ################################################################################ +# 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() # # # # Purpose: An internal utility function to format a timestamp # diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index bf5a84b98..e651c2fd8 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -37,6 +37,22 @@ --> + 2011-10-17 + + + [bdubbs] - Add statusproc back to bootscripts. + + + [bdubbs] - Also remove doc/ files when stripping in Chapter 5. + + + + [bdubbs] - Add --noclear to agetty for tty1 in inittab. + + + + + 2011-10-13 diff --git a/chapter05/stripping.xml b/chapter05/stripping.xml index 916ad6596..5a1de46a2 100644 --- a/chapter05/stripping.xml +++ b/chapter05/stripping.xml @@ -26,9 +26,9 @@ strip --strip-unneeded /tools/{,s}bin/* ones would be destroyed and the toolchain packages would need to be built all over again. - To save nearly 25 MB more, remove the documentation: + To save more, remove the documentation: -rm -rf /tools/{,share}/{info,man} +rm -rf /tools/{,share}/{info,man,doc} At this point, you should have at least 850 MB of free space in $LFS that can be used to build and install Glibc in the diff --git a/chapter07/usage.xml b/chapter07/usage.xml index 259c839e4..c2e7290be 100644 --- a/chapter07/usage.xml +++ b/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 diff --git a/general.ent b/general.ent index 1ad58b61b..bc7bbedc5 100644 --- a/general.ent +++ b/general.ent @@ -1,5 +1,5 @@ - - + + diff --git a/packages.ent b/packages.ent index 9f144847d..fbc35161f 100644 --- a/packages.ent +++ b/packages.ent @@ -298,7 +298,7 @@ - + -- 2.11.4.GIT