diff options
Diffstat (limited to 'openembedded/packages/initscripts/initscripts-1.0/checkroot.sh')
| -rwxr-xr-x | openembedded/packages/initscripts/initscripts-1.0/checkroot.sh | 165 |
1 files changed, 0 insertions, 165 deletions
diff --git a/openembedded/packages/initscripts/initscripts-1.0/checkroot.sh b/openembedded/packages/initscripts/initscripts-1.0/checkroot.sh deleted file mode 100755 index 8255038c32..0000000000 --- a/openembedded/packages/initscripts/initscripts-1.0/checkroot.sh +++ /dev/null | |||
| @@ -1,165 +0,0 @@ | |||
| 1 | # | ||
| 2 | # checkroot.sh Check to root filesystem. | ||
| 3 | # | ||
| 4 | # Version: @(#)checkroot.sh 2.84 25-Jan-2002 miquels@cistron.nl | ||
| 5 | # | ||
| 6 | |||
| 7 | . /etc/default/rcS | ||
| 8 | |||
| 9 | # | ||
| 10 | # Set SULOGIN in /etc/default/rcS to yes if you want a sulogin to be spawned | ||
| 11 | # from this script *before anything else* with a timeout, like SCO does. | ||
| 12 | # | ||
| 13 | test "$SULOGIN" = yes && sulogin -t 30 $CONSOLE | ||
| 14 | |||
| 15 | # | ||
| 16 | # Ensure that bdflush (update) is running before any major I/O is | ||
| 17 | # performed (the following fsck is a good example of such activity :). | ||
| 18 | # | ||
| 19 | test -x /sbin/update && update | ||
| 20 | |||
| 21 | # | ||
| 22 | # Read /etc/fstab. | ||
| 23 | # | ||
| 24 | exec 9>&0 </etc/fstab | ||
| 25 | rootmode=rw | ||
| 26 | rootopts=rw | ||
| 27 | rootcheck=no | ||
| 28 | swap_on_md=no | ||
| 29 | devfs= | ||
| 30 | while read fs mnt type opts dump pass junk | ||
| 31 | do | ||
| 32 | case "$fs" in | ||
| 33 | ""|\#*) | ||
| 34 | continue; | ||
| 35 | ;; | ||
| 36 | /dev/md*) | ||
| 37 | # Swap on md device. | ||
| 38 | test "$type" = swap && swap_on_md=yes | ||
| 39 | ;; | ||
| 40 | /dev/*) | ||
| 41 | ;; | ||
| 42 | *) | ||
| 43 | # Might be a swapfile. | ||
| 44 | test "$type" = swap && swap_on_md=yes | ||
| 45 | ;; | ||
| 46 | esac | ||
| 47 | test "$type" = devfs && devfs="$fs" | ||
| 48 | test "$mnt" != / && continue | ||
| 49 | rootopts="$opts" | ||
| 50 | test "$pass" = 0 -o "$pass" = "" && rootcheck=no | ||
| 51 | case "$opts" in | ||
| 52 | ro|ro,*|*,ro|*,ro,*) | ||
| 53 | rootmode=ro | ||
| 54 | ;; | ||
| 55 | esac | ||
| 56 | done | ||
| 57 | exec 0>&9 9>&- | ||
| 58 | |||
| 59 | # | ||
| 60 | # Activate the swap device(s) in /etc/fstab. This needs to be done | ||
| 61 | # before fsck, since fsck can be quite memory-hungry. | ||
| 62 | # | ||
| 63 | doswap=no | ||
| 64 | test -d /proc/1 || mount -n /proc | ||
| 65 | case "`uname -r`" in | ||
| 66 | 2.[0123].*) | ||
| 67 | if test $swap_on_md = yes && grep -qs resync /proc/mdstat | ||
| 68 | then | ||
| 69 | test "$VERBOSE" != no && echo "Not activating swap - RAID array resyncing" | ||
| 70 | else | ||
| 71 | doswap=yes | ||
| 72 | fi | ||
| 73 | ;; | ||
| 74 | *) | ||
| 75 | doswap=yes | ||
| 76 | ;; | ||
| 77 | esac | ||
| 78 | if test $doswap = yes | ||
| 79 | then | ||
| 80 | test "$VERBOSE" != no && echo "Activating swap" | ||
| 81 | swapon -a 2> /dev/null | ||
| 82 | fi | ||
| 83 | |||
| 84 | # | ||
| 85 | # Check the root filesystem. | ||
| 86 | # | ||
| 87 | if test -f /fastboot || test $rootcheck = no | ||
| 88 | then | ||
| 89 | test $rootcheck = yes && echo "Fast boot, no filesystem check" | ||
| 90 | else | ||
| 91 | # | ||
| 92 | # Ensure that root is quiescent and read-only before fsck'ing. | ||
| 93 | # | ||
| 94 | mount -n -o remount,ro / | ||
| 95 | if test $? = 0 | ||
| 96 | then | ||
| 97 | if test -f /forcefsck | ||
| 98 | then | ||
| 99 | force="-f" | ||
| 100 | else | ||
| 101 | force="" | ||
| 102 | fi | ||
| 103 | if test "$FSCKFIX" = yes | ||
| 104 | then | ||
| 105 | fix="-y" | ||
| 106 | else | ||
| 107 | fix="-a" | ||
| 108 | fi | ||
| 109 | spinner="-C" | ||
| 110 | case "$TERM" in | ||
| 111 | dumb|network|unknown|"") spinner="" ;; | ||
| 112 | esac | ||
| 113 | test `uname -m` = s390 && spinner="" # This should go away | ||
| 114 | test "$VERBOSE" != no && echo "Checking root filesystem..." | ||
| 115 | fsck $spinner $force $fix / | ||
| 116 | # | ||
| 117 | # If there was a failure, drop into single-user mode. | ||
| 118 | # | ||
| 119 | # NOTE: "failure" is defined as exiting with a return code of | ||
| 120 | # 2 or larger. A return code of 1 indicates that filesystem | ||
| 121 | # errors were corrected but that the boot may proceed. | ||
| 122 | # | ||
| 123 | if test "$?" -gt 1 | ||
| 124 | then | ||
| 125 | # Surprise! Re-directing from a HERE document (as in | ||
| 126 | # "cat << EOF") won't work, because the root is read-only. | ||
| 127 | echo | ||
| 128 | echo "fsck failed. Please repair manually and reboot. Please note" | ||
| 129 | echo "that the root filesystem is currently mounted read-only. To" | ||
| 130 | echo "remount it read-write:" | ||
| 131 | echo | ||
| 132 | echo " # mount -n -o remount,rw /" | ||
| 133 | echo | ||
| 134 | echo "CONTROL-D will exit from this shell and REBOOT the system." | ||
| 135 | echo | ||
| 136 | # Start a single user shell on the console | ||
| 137 | /sbin/sulogin $CONSOLE | ||
| 138 | reboot -f | ||
| 139 | fi | ||
| 140 | else | ||
| 141 | echo "*** ERROR! Cannot fsck root fs because it is not mounted read-only!" | ||
| 142 | echo | ||
| 143 | fi | ||
| 144 | fi | ||
| 145 | |||
| 146 | # | ||
| 147 | # If the root filesystem was not marked as read-only in /etc/fstab, | ||
| 148 | # remount the rootfs rw but do not try to change mtab because it | ||
| 149 | # is on a ro fs until the remount succeeded. Then clean up old mtabs | ||
| 150 | # and finally write the new mtab. | ||
| 151 | # | ||
| 152 | mount -n -o remount,$rootmode / | ||
| 153 | if test "$rootmode" = rw | ||
| 154 | then | ||
| 155 | if test ! -L /etc/mtab | ||
| 156 | then | ||
| 157 | rm -f /etc/mtab~ /etc/nologin | ||
| 158 | : > /etc/mtab | ||
| 159 | fi | ||
| 160 | mount -f -o remount / | ||
| 161 | mount -f /proc | ||
| 162 | test "$devfs" && grep -q '^devfs /dev' /proc/mounts && mount -f "$devfs" | ||
| 163 | fi | ||
| 164 | |||
| 165 | : exit 0 | ||
