Petter Reinholdtsen wrote:

One way to do this is by adding this function to /etc/default/rcS:

  on_ac_power() { true; }

It should make sure the function is used instead of the binary.


But it would affect other startup scripts as well, e.g. anacron.
Below you can find a patch.


Harri

[EMAIL PROTECTED]:init.d 598} diff -u checkfs.sh~ checkfs.sh
--- checkfs.sh~ 2007-12-31 12:38:49.000000000 +0100
+++ checkfs.sh  2008-01-12 17:01:40.000000000 +0100
@@ -24,7 +24,7 @@
        # 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.
-       if which on_ac_power >/dev/null 2>&1
+       if [ "$FSCK_ON_BATTERY" != "yes" ] && which on_ac_power >/dev/null 2>&1
        then
                on_ac_power >/dev/null 2>&1
                if [ $? -eq 1 ]
[EMAIL PROTECTED]:init.d 599} diff -u checkroot.sh~ checkroot.sh
--- checkroot.sh~       2007-12-31 12:38:49.000000000 +0100
+++ checkroot.sh        2008-01-12 17:02:16.000000000 +0100
@@ -192,7 +192,7 @@
        # 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.
-       if which on_ac_power >/dev/null 2>&1 && [ "$rootcheck" = yes ]
+       if [ "$FSCK_ON_BATTERY" != "yes" ] && which on_ac_power >/dev/null 2>&1 && [ "$rootcheck" = yes ]
        then
                on_ac_power >/dev/null 2>&1
                if [ "$?" -eq 1 ]
[EMAIL PROTECTED]:init 600} diff -u vars.sh~ vars.sh
--- vars.sh~    2007-12-31 12:38:49.000000000 +0100
+++ vars.sh     2008-01-12 17:03:11.000000000 +0100
@@ -20,3 +20,6 @@
 # But allow both rcS and the kernel options 'quiet' to be overrided
 # when INIT_VERBOSE=yes is used as well.
 [ "$INIT_VERBOSE" ] && VERBOSE="$INIT_VERBOSE" || true
+
+# set to "yes" to run fsck when on battery
+FSCK_ON_BATTERY=yes

Reply via email to