[Pkg-sysvinit-commits] r131 - sysvinit/trunk/debian/initscripts/etc/init.d

Thomas Hood jdthood-guest at costa.debian.org
Fri Nov 18 13:35:51 UTC 2005


Author: jdthood-guest
Date: 2005-11-18 13:35:51 +0000 (Fri, 18 Nov 2005)
New Revision: 131

Modified:
   sysvinit/trunk/debian/initscripts/etc/init.d/checkroot.sh
Log:
Use log_action_begin_msg and log_action_end_msg instead of log_begin_msg and log_end_msg; clean up log_failure_msg's ; exit 3 on bad argument a la LSB; add quotation marks around variable refs on LHS of string comparison ; improve wording

Modified: sysvinit/trunk/debian/initscripts/etc/init.d/checkroot.sh
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/checkroot.sh	2005-11-18 13:09:48 UTC (rev 130)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/checkroot.sh	2005-11-18 13:35:51 UTC (rev 131)
@@ -119,10 +119,10 @@
 	doswap=no
 	case "${KERNEL}:${RELEASE}" in
 		Linux:2.[0123].*)
-			if [ $swap_on_md = yes ] && grep -qs resync /proc/mdstat
+			if [ "$swap_on_md" = yes ] && grep -qs resync /proc/mdstat
 			then
 				[ "$VERBOSE" != no ] &&
-				  log_warning_msg "Not activating swap - RAID array resyncing"
+				  log_warning_msg "Not activating swap because RAID array is resyncing."
 			else
 				doswap=yes
 			fi
@@ -133,9 +133,9 @@
 	esac
 	if [ "$doswap" = yes ]
 	then
-		[ "$VERBOSE" != no ] && log_success_msg "Activating swap..."
+		[ "$VERBOSE" != no ] && log_action_begin_msg "Activating swap"
 		swapon -a 2> /dev/null
-		[ "$VERBOSE" != no ] && log_end_msg $?
+		[ "$VERBOSE" != no ] && log_action_end_msg $?
 	fi
 
 	#
@@ -168,18 +168,12 @@
 	#
 	if [ "$rootfatal" = yes ]
 	then
-		echo
-		log_failure_msg "The device node $rootdev for the root filesystem is missing,"
-		log_failure_msg "incorrect, or there is no entry for the root filesystem"
-		log_failure_msg "listed in /etc/fstab."
-		echo
-		log_failure_msg "The system is also unable to create a temporary node in"
-		log_failure_msg "/dev/shm to use as a work-around."
-		echo
-		log_failure_msg "This means you have to fix this manually."
-		echo
+		log_failure_msg "The device node $rootdev for the root filesystem is missing, incorrect,"
+		log_failure_msg "or there is no entry for the root filesystem listed in /etc/fstab."
+		log_failure_msg "The system is also unable to create a temporary node in /dev/shm."
+		log_failure_msg "This means you have to fix the problem manually."
+		log_failure_msg ""
 		log_failure_msg "CONTROL-D will exit from this shell and REBOOT the system."
-		echo
 		# Start a single user shell on the console
 		/sbin/sulogin $CONSOLE
 		reboot -f
@@ -187,11 +181,11 @@
 
 	# See if we're on AC Power
 	# If not, we're not gonna run our check
-	if [ -x /usr/bin/on_ac_power ] && [ $rootcheck = yes ]; then
+	if [ -x /usr/bin/on_ac_power ] && [ "$rootcheck" = yes ]; then
 	        /usr/bin/on_ac_power >/dev/null 2>&1
 	        if [ "$?" -eq 1 ]; then
-	             log_success_msg "On battery, not fscking!"
-	             rootcheck=no
+	        	log_warning_msg "On battery power, so skipping file system check."
+	        	rootcheck=no
 	        fi
 	fi
 
@@ -199,9 +193,9 @@
 	#	See if we want to check the root file system.
 	#
 	FSCKCODE=0
-	if [ -f /fastboot ] || [ $rootcheck = no ]
+	if [ -f /fastboot ]
 	then
-		[ $rootcheck = yes ] && log_success_msg "Fast boot, no file system check"
+		[ "$rootcheck" = yes ] && log_warning_msg "Fast boot enabled, so skipping file system check."
 		rootcheck=no
 	fi
 
@@ -223,7 +217,7 @@
 		if ! mount -n -o remount,ro $rootdev / 2>/dev/null &&
 		   ! mount -n -o remount,ro /
 		then
-			log_failure_msg "Cannot fsck root fs because it is not mounted read-only!"
+			log_failure_msg "Cannot check root file system because it is not mounted read-only!"
 			rootcheck=no
 		fi
 	fi
@@ -257,9 +251,9 @@
 		then
 			spinner=""
 		fi
-		log_begin_msg "Checking root file system..."
+		log_action_begin_msg "Checking root file system"
 		fsck $spinner $force $fix -T -t $roottype $rootdev
-		log_end_msg $?
+		log_action_end_msg $?
 		FSCKCODE=$?
 	fi
 
@@ -275,18 +269,16 @@
 	then
 		# Surprise! Re-directing from a HERE document (as in
 		# "cat << EOF") won't work, because the root is read-only.
-		echo 
-		log_failure_msg "An automatic fsck upon the root filesystem failed."
-		log_failure_msg "A manual fsck must be performed, and the system rebooted. "
+		log_failure_msg "An automatic file system check of the root filesystem failed."
+		log_failure_msg "A manual fsck must be performed, then the system rebooted."
 		log_failure_msg "This fsck can be performed in maintenance mode."
-		echo 
-		log_failure_msg "Please note, the root filesystem is currently mounted read-only."
+		log_failure_msg ""
+		log_failure_msg "Please note that the root filesystem is currently mounted read-only."
 		log_failure_msg "The fsck should only be performed while the root filesystem is "
 		log_failure_msg "mounted read-only. However, the command to remount it read-write "
 		log_failure_msg "is:"
-		echo
-		log_failure_msg "  # mount -n -o remount,rw /"
-		echo
+		log_failure_msg "    # mount -n -o remount,rw /"
+		log_failure_msg ""
 		log_failure_msg "In order to exit from the maintenance shell, press CONTROL-D"
 		log_failure_msg "and the system will REBOOT."
 		# Start a single user shell on the console
@@ -294,12 +286,10 @@
 		reboot -f
 	elif [ $FSCKCODE -gt 1 ]
 	then
-		echo
-		log_failure_msg "fsck corrected errors on the root partition, but requested that"
-		log_failure_msg "the system be rebooted (exit code $FSCKCODE)."
-		echo
+		log_failure_msg "The file system check program corrected errors on the root partition,"
+		log_failure_msg "but requested that the system be rebooted (exit code $FSCKCODE)."
+		log_failure_msg ""
 		log_failure_msg "Automatic reboot in 5 seconds."
-		echo
 		sleep 5
 		reboot -f
 	fi
@@ -336,9 +326,9 @@
 		"")
 			[ -L /etc/mtab ] && MTAB_PATH="`readlink /etc/mtab`"
 			if [ "$MTAB_PATH" ] ; then
-				log_failure_msg "checkroot.sh: cannot initialize $MTAB_PATH" >&2
+				log_failure_msg "Cannot initialize $MTAB_PATH"
 			else
-				log_failure_msg "checkroot.sh: cannot initialize the mtab file" >&2
+				log_failure_msg "Cannot initialize the mtab file"
 			fi
 			;;
 	esac
@@ -362,14 +352,14 @@
         do_start
         ;;
     restart|reload|force-reload)
-        echo "error: '$0 $1' not supported"
-        exit 1
+        echo "Error: '$1' argument not supported" >&2
+        exit 3
         ;;
     stop)
         ;;
     *)
-        echo "Usage: $0 start|stop|restart|reload|force-reload"
-        exit 1
+        echo "Usage: $0 start|stop" >&2
+        exit 3
         ;;
 esac
 




More information about the Pkg-sysvinit-commits mailing list