control: tags -1 +patch

[2014-11-24 22:30] Petter Reinholdtsen <p...@hungry.com>
> Given that -f is force only for ext*, I suspect a more sensible
> approach is to only enable forcefsck for ext*, not disable it for
> btrfs.

Like this?

diff --git a/debian/src/initscripts/etc/init.d/checkroot.sh 
b/debian/src/initscripts/etc/init.d/checkroot.sh
index 9f70527a..c6c21344 100755
--- a/debian/src/initscripts/etc/init.d/checkroot.sh
+++ b/debian/src/initscripts/etc/init.d/checkroot.sh
@@ -22,6 +22,18 @@ FSCK_LOGFILE=/var/log/fsck/checkroot
 . /lib/lsb/init-functions
 . /lib/init/mount-functions.sh
 
+_want_force_fsck () {
+       set -- $(findmnt / | tail -n1)
+       case "$3" in
+       # Only ext* file systems support `-f' option to fsck. See #686895
+       (ext*)
+               [ -f /forcefsck ] || grep -q -s -w -i "forcefsck" /proc/cmdline
+               ;;
+       (*)
+               return 1
+       esac
+}
+
 do_start () {
        # Trap SIGINT so that we can handle user interrupt of fsck.
        trap "" INT
@@ -203,12 +215,8 @@ Will restart in 5 seconds."
        #
        if [ "$rootcheck" = yes ]
        then
-               if [ -f /forcefsck ] || grep -q -s -w -i "forcefsck" 
/proc/cmdline
-               then
-                       force="-f"
-               else
-                       force=""
-               fi
+               force=""
+               _want_force_fsck && force="-f"
 
                if [ "$FSCKFIX" = yes ]
                then

Reply via email to