All pastes #40216 Raw Edit

Stuff

public text v1 · immutable
#40216 ·published 2006-02-05 22:44 UTC
rendered paste body
--- ../checkroot.sh     2006-01-27 12:39:29.000000000 +0100
+++ checkroot.sh        2006-02-05 23:43:35.000000000 +0100
@@ -24,7 +24,6 @@
 exec 9>&0 </etc/fstab
 rootmode=rw
 rootopts=rw
-rootcheck=no
 swap_on_md=no
 devfs=
 while read fs mnt type opts dump pass junk
@@ -47,7 +46,7 @@
        test "$type" = devfs && devfs="$fs"
        test "$mnt" != / && continue
        rootopts="$opts"
-       test "$pass" = 0 -o "$pass" = "" && rootcheck=no
+       test "$pass" = 0 -o "$pass" = "" && ROOTFSCK=no
        case "$opts" in
                ro|ro,*|*,ro|*,ro,*)
                        rootmode=ro
@@ -60,33 +59,26 @@
 # Activate the swap device(s) in /etc/fstab. This needs to be done
 # before fsck, since fsck can be quite memory-hungry.
 #
-doswap=no
-test -d /proc/1 || mount -n /proc
-case "`uname -r`" in
-       2.[0123].*)
-               if test $swap_on_md = yes && grep -qs resync /proc/mdstat
-               then
-                       test "$VERBOSE" != no && echo "Not activating swap - RAID array resyncing"
-               else
-                       doswap=yes
-               fi
-               ;;
-       *)
-               doswap=yes
-               ;;
-esac
-if test $doswap = yes
+# We don't test whether we're running a 2.[0123].x kernel and md
+# since that's plain too old.
+
+if test $DOSWAP = yes
 then
-       test "$VERBOSE" != no && echo "Activating swap"
-       swapon -a 2> /dev/null
+       swaps="$(blkid -t TYPE=swap -o device 2>/dev/null)"
+       if test -n "$swaps"
+       then
+               swapon $swaps 2>/dev/null
+       else
+               swapon -a 2> /dev/null
+       fi
 fi

 #
 # Check the root filesystem.
 #
-if test -f /fastboot || test $rootcheck = no
+if test -f /fastboot || test $ROOTFSCK != yes
 then
-  test $rootcheck = yes && echo "Fast boot, no filesystem check"
+  test $ROOTFSCK = yes && echo "Fast boot, no filesystem check"
 else
   #
   # Ensure that root is quiescent and read-only before fsck'ing.
@@ -110,7 +102,6 @@
     case "$TERM" in
         dumb|network|unknown|"") spinner="" ;;
     esac
-    test `uname -m` = s390 && spinner="" # This should go away
     test "$VERBOSE" != no && echo "Checking root filesystem..."
     fsck $spinner $force $fix /
     #
@@ -133,6 +124,7 @@
       echo
       echo "CONTROL-D will exit from this shell and REBOOT the system."
       echo
+      /bin/beep -r 5
       # Start a single user shell on the console
       /sbin/sulogin $CONSOLE
       reboot -f
@@ -149,7 +141,7 @@
 #      is on a ro fs until the remount succeeded. Then clean up old mtabs
 #      and finally write the new mtab.
 #
-mount -n -o remount,$rootmode /
+mount -n -o remount,$rootopts /
 if test "$rootmode" = rw
 then
        if test ! -L /etc/mtab
@@ -159,6 +151,7 @@
        fi
        mount -f -o remount /
        mount -f /proc
+       mount -f /sys
        test "$devfs" && grep -q '^devfs /dev' /proc/mounts && mount -f "$devfs"
 fi