Sfoglia il codice sorgente

Added Dan Nicholson's patch for #2160, and cleaned up tab/spacing in changelog.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@8701 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
DJ Lucas 17 anni fa
parent
commit
ceed481524
2 ha cambiato i file con 46 aggiunte e 26 eliminazioni
  1. 30 22
      bootscripts/ChangeLog
  2. 16 4
      bootscripts/lfs/init.d/functions

+ 30 - 22
bootscripts/ChangeLog

@@ -1,7 +1,14 @@
+2008-10-26	Dan Nicholson	<dnicholson@linuxfromscratch.org>
+	* lfs/init.d/functions: Remove stale pid files when encountered
+	  in loadproc/killproc/reloadproc. When the bootscript specifies
+	  a pid file to use with the "-p pidfile" argument, *proc
+	  functions previously bailed out when the referenced file
+	  contains an invalid pid.
+
 2008-10-23	DJ Lucas	<dj@linuxfromscratch.org>
 2008-10-23	DJ Lucas	<dj@linuxfromscratch.org>
 	* lfs/init.d/console: Removed BROKEN_COMPOSE as kernel patch has
 	* lfs/init.d/console: Removed BROKEN_COMPOSE as kernel patch has
 	  been accepted upstream.
 	  been accepted upstream.
- 
+
 2008-05-21	Bryan Kadzban	<bryan@linuxfromscratch.org>
 2008-05-21	Bryan Kadzban	<bryan@linuxfromscratch.org>
 	* lfs/init.d/udev: lfs/init.d/udev_retry: Use new udevadm program.
 	* lfs/init.d/udev: lfs/init.d/udev_retry: Use new udevadm program.
 
 
@@ -100,7 +107,7 @@
 n/a - June 2, 2006
 n/a - June 2, 2006
 	* Removed console config file and makefile targets.
 	* Removed console config file and makefile targets.
 	* Removed references to /dev/bug and bugreport in udevand 
 	* Removed references to /dev/bug and bugreport in udevand 
-          udev_retry bootscripts. (DJ Lucas)
+	  udev_retry bootscripts. (DJ Lucas)
 n/a - April 17, 2006
 n/a - April 17, 2006
 	* Updated udev script to use the new udevsettle program.
 	* Updated udev script to use the new udevsettle program.
 	* Added udev_retry script for systems that have /usr on a different
 	* Added udev_retry script for systems that have /usr on a different
@@ -108,26 +115,26 @@ n/a - April 17, 2006
 
 
 n/a - April 15, 2006
 n/a - April 15, 2006
 	* Cleaned up contrib directory.  Removed: contrib/init.d, 
 	* Cleaned up contrib directory.  Removed: contrib/init.d, 
-          contrib/enhanced, contrib/livecd, contrib/hotplug, and raq2 
+	  contrib/enhanced, contrib/livecd, contrib/hotplug, and raq2 
 	  patch. (DJ Lucas)
 	  patch. (DJ Lucas)
 
 
 n/a - April 14, 2006
 n/a - April 14, 2006
-        * Merged changes from udev_update branch (DJ Lucas)
+	* Merged changes from udev_update branch (DJ Lucas)
 	* Replaced a return with an exit and reversed comment changes in 
 	* Replaced a return with an exit and reversed comment changes in 
-          udev bootscript. (Dan Nicholson)
+	  udev bootscript. (Dan Nicholson)
 	* Replaced walk_sysfs function in udev bootscript with new udevtrigger
 	* Replaced walk_sysfs function in udev bootscript with new udevtrigger
-          program and move wait_for_uevents function inline. (DJ Lucas)
+	  program and move wait_for_uevents function inline. (DJ Lucas)
 	* Removed extra evaluate_retval in udev bootscript. (Ken Moffat)
 	* Removed extra evaluate_retval in udev bootscript. (Ken Moffat)
-	* Wait for uevents to be processed in the udev script.  See ticket #1720
-	  for details. (Matthew Burgess)
+	* Wait for uevents to be processed in the udev script.  See ticket
+	  #1720 for details. (Matthew Burgess)
 
 
 n/a - March 21, 2006
 n/a - March 21, 2006
-        * Removed old references to boot_log function and arguments passed
-          to boot_mesg_flush in echo_* functions. (DJ Lucas)
+	* Removed old references to boot_log function and arguments passed
+	  to boot_mesg_flush in echo_* functions. (DJ Lucas)
 
 
 n/a - March 10, 2006
 n/a - March 10, 2006
 	* Moved src argument to ipv4-static-route service script and 
 	* Moved src argument to ipv4-static-route service script and 
-          removed from ipv4-static service script. (DJ Lucas)
+	  removed from ipv4-static service script. (DJ Lucas)
 
 
 n/a - March 8. 2006
 n/a - March 8. 2006
 	* Correct sourced path in checkfs script. (Matthew Burgess)
 	* Correct sourced path in checkfs script. (Matthew Burgess)
@@ -287,7 +294,8 @@ n/a - November 25, 2004
 	  related to boot_mesg changes (DJ Lucas, Alexander Patrakov)
 	  related to boot_mesg changes (DJ Lucas, Alexander Patrakov)
 	* syslog-ng is now installed by default (Jeremy Utley)
 	* syslog-ng is now installed by default (Jeremy Utley)
 	* hotplug is now installed by default (Jeremy Utley)
 	* hotplug is now installed by default (Jeremy Utley)
-	* udev now uses /sbin/hotplug as the default hotplug handler (Nathan Coulson)
+	* udev now uses /sbin/hotplug as the default hotplug handler
+	  (Nathan Coulson)
 	* udev now mounts a tmpfs instead of a ramfs onto /dev,
 	* udev now mounts a tmpfs instead of a ramfs onto /dev,
 	  as suggested by Greg K-H (Nathan Coulson)
 	  as suggested by Greg K-H (Nathan Coulson)
 	* Created contrib/lsb, and added a LSB compliant functions file
 	* Created contrib/lsb, and added a LSB compliant functions file
@@ -354,8 +362,8 @@ n/a - September 22, 2004
 	* All scriptes have been converted to use boot_mesg
 	* All scriptes have been converted to use boot_mesg
 
 
 n/a - September 21, 2004
 n/a - September 21, 2004
-	* boot_mesg has been enhanced.  Subsequent calls will overwrite previous
-	  text, and it will wrap text basedupon the variable ${WCOL}. 
+	* boot_mesg has been enhanced.  Subsequent calls will overwrite
+	  previous text, and it will wrap text basedupon the variable ${WCOL}. 
 	  (James Robertson)
 	  (James Robertson)
 	* Fixed mtu optional service typo (Kevin P Fleming)
 	* Fixed mtu optional service typo (Kevin P Fleming)
 	* Added SOURCE variable to ipv4-static-route (Kevin P Fleming)
 	* Added SOURCE variable to ipv4-static-route (Kevin P Fleming)
@@ -806,7 +814,7 @@ n/a - February 2, 2004:
 	* Fixed network shutdown script
 	* Fixed network shutdown script
 	* Fixed Makefile rc.6 to reboot
 	* Fixed Makefile rc.6 to reboot
 	* Added -s flag to grep command in rc.d/init.d/network -
 	* Added -s flag to grep command in rc.d/init.d/network -
-          suppresses an error if no ifconfig.* files exist
+	  suppresses an error if no ifconfig.* files exist
 
 
 n/a - January 30, 2004:
 n/a - January 30, 2004:
 
 
@@ -827,8 +835,8 @@ n/a - January 30, 2004:
 n/a - January 30, 2004:
 n/a - January 30, 2004:
 
 
 	* New maintainers for the lfs-bootscripts package are:
 	* New maintainers for the lfs-bootscripts package are:
-	Jeremy Utley (jeremy@linuxfromscratch.org)
-	Nathan Coulson (nathan@linuxfromscratch.org)
+	  Jeremy Utley (jeremy@linuxfromscratch.org)
+	  Nathan Coulson (nathan@linuxfromscratch.org)
 
 
 1.11 - February 3rd, 2003:
 1.11 - February 3rd, 2003:
 
 
@@ -838,7 +846,7 @@ n/a - January 30, 2004:
 1.10 - September 12th, 2002:
 1.10 - September 12th, 2002:
 
 
 	* Fixed up checkfs to work with non-ext2 filesystems too (such as
 	* Fixed up checkfs to work with non-ext2 filesystems too (such as
-	minix).
+	  minix).
 
 
 1.9 - April 5th, 2002:
 1.9 - April 5th, 2002:
 
 
@@ -884,9 +892,9 @@ n/a - January 30, 2004:
 1.6 - February 26th, 2002:
 1.6 - February 26th, 2002:
 
 
 	* replaced -o %PPID with -o $PPID throughout the functions script. This
 	* replaced -o %PPID with -o $PPID throughout the functions script. This
-	construct does what it's supposed to do (don't take PPID into account
-	because this would fail if a running daemon and the bootscript have
-	the same name).
+	  construct does what it's supposed to do (don't take PPID into account
+	  because this would fail if a running daemon and the bootscript have
+	  the same name).
 
 
 	* added 'restart' to the swap script
 	* added 'restart' to the swap script
 
 
@@ -914,7 +922,7 @@ n/a - January 30, 2004:
 	  variable is set
 	  variable is set
 
 
 	* removed the emptying of /etc/mtab since it's a symlink to
 	* removed the emptying of /etc/mtab since it's a symlink to
-	 /proc/mounts now
+	  /proc/mounts now
 
 
 	* added the mountproc script which mounts the proc system. This is done
 	* added the mountproc script which mounts the proc system. This is done
 	  because we need proc mounted even before the mountfs script is ran
 	  because we need proc mounted even before the mountfs script is ran

+ 16 - 4
bootscripts/lfs/init.d/functions

@@ -291,6 +291,12 @@ reloadproc()
 		pidofproc -s -p "${pidfile}" "${1}"
 		pidofproc -s -p "${pidfile}" "${1}"
 	fi
 	fi
 
 
+	# Warn about stale pid file
+	if [ "$?" = 1 ]; then
+		boot_mesg -n "Removing stale pid file: ${pidfile}. " ${WARNING}
+		rm -f "${pidfile}"
+	fi
+
 	if [ -n "${pidlist}" ];	then
 	if [ -n "${pidlist}" ];	then
 		for pid in ${pidlist}
 		for pid in ${pidlist}
 		do
 		do
@@ -504,7 +510,7 @@ getpids()
 #                     warning in stdout
 #                     warning in stdout
 #          return 4 - Program or service status is unknown
 #          return 4 - Program or service status is unknown
 #
 #
-# Dependencies: nice
+# Dependencies: nice, rm
 #
 #
 # Todo: LSB says this should be called start_daemon
 # Todo: LSB says this should be called start_daemon
 #       LSB does not say that it should call evaluate_retval
 #       LSB does not say that it should call evaluate_retval
@@ -567,8 +573,8 @@ loadproc()
 				return 0 # 4
 				return 0 # 4
 				;;
 				;;
 			1)
 			1)
-				log_warning_msg "Unable to continue: ${pidfile} exists"
-				return 0 # 4
+				boot_mesg "Removing stale pid file: ${pidfile}" ${WARNING}
+				rm -f "${pidfile}"
 				;;
 				;;
 			3)
 			3)
 				;;
 				;;
@@ -598,7 +604,7 @@ loadproc()
 #                     warning in stdout
 #                     warning in stdout
 #          return 4 - Unknown Status
 #          return 4 - Unknown Status
 #
 #
-# Dependencies: kill
+# Dependencies: kill, rm
 #
 #
 # Todo: LSB does not say that it should call evaluate_retval
 # Todo: LSB does not say that it should call evaluate_retval
 #       It checks for PIDFILE, which is deprecated.
 #       It checks for PIDFILE, which is deprecated.
@@ -648,6 +654,12 @@ killproc()
 		pidofproc -s -p "${pidfile}" "${1}"
 		pidofproc -s -p "${pidfile}" "${1}"
 	fi
 	fi
 
 
+	# Remove stale pidfile
+	if [ "$?" = 1 ]; then
+		boot_mesg "Removing stale pid file: ${pidfile}." ${WARNING}
+		rm -f "${pidfile}"
+	fi
+
     # If running, send the signal
     # If running, send the signal
     if [ -n "${pidlist}" ]; then
     if [ -n "${pidlist}" ]; then
 	for pid in ${pidlist}
 	for pid in ${pidlist}