[Pkg-sysvinit-devel] Bug#441453: initscripts: checkfs and checkroot should warn if on_ac_power fails

Petter Reinholdtsen pere at hungry.com
Sun Dec 23 09:59:29 UTC 2007


I do not quite understand the patch proposed by Mark Purcell.  Why is
the dynamic check that will use the PATH to locate on_ac_power
replaced with a check to use a hardcoded location?  I tried merging
the two patches to handle exit code 255 and providing more output
while still keeping the dynamic PATH location part.  Will this patch
solve your problem?

It might be an idea to disable the log messages when VERBOSE=no, and I
am not sure if log_warning_msg is the best method to use for all these
messages.

Please test the patch and provide feedback.

Index: checkroot.sh
===================================================================
--- checkroot.sh	(revision 1084)
+++ checkroot.sh	(working copy)
@@ -190,13 +190,20 @@
 	fi
 
 	# See if we're on AC Power.  If not, we're not gonna run our
-	# check.  If on_ac_power (in /usr/) is unavailable, behave as
-	# before and check all file systems needing it.
+	# check.  If on_ac_power (in /sbin/) is unusable or
+	# unavailable, behave as before and check all file systems
+	# needing it.
 	if which on_ac_power >/dev/null 2>&1 && [ "$rootcheck" = yes ]
 	then
-		on_ac_power >/dev/null 2>&1
-		if [ "$?" -eq 1 ]
+		
+                on_ac_power >/dev/null 2>&1
+                if [ "$?" -eq 0 ]
 		then
+			log_warning_msg "On AC Power"
+		elif [ "$?" -eq 255 ]
+		then
+			log_warning_msg "Can't check power status (maybe missing ACPI support?)"
+		else
 			log_warning_msg "On battery power, so skipping file system check."
 			rootcheck=no
 		fi

Happy hacking,
-- 
Petter Reinholdtsen





More information about the Pkg-sysvinit-devel mailing list