blob: 94fc7ff1d306ac2790c09eaea65002d4fd0cd8c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#!/bin/sh
rootmode=rw
rootopts=rw
rootcheck=yes
udevfs=
# read the fstab
sed 's/#.*//' /etc/fstab | while read fs mnt type opts dump pass junk
do
[ "$type" = udevfs ] && udefs="$fs"
[ "$mnt" != / ] && continue
rootopts="$opts"
[ "$pass" = 0 -o "$pass" = "" ] && rootcheck=no
case "$opts" in
ro|ro,*|*,ro|*,ro,*)
rootmode=ro
;;
esac
done
if [ "$rootcheck" = yes ] ; then
if grep "^$fs" /proc/mounts ; then
echo "$fs is mounted. Something is wrong. Please fix and reboot."
echo "sorry newbies..."
echo
echo "CONTROL-D will exit from this shell and reboot the system."
echo
/sbin/sulogin $CONSOLE
reboot -f
elif ! fsck -C "$fs" ; then
echo "fsck failed. Please repair manually and reboot. Please note"
echo "that the root file system is currently mounted read-only. To"
echo "remount it read-write:"
echo
echo " # mount -n -o remount,rw /"
echo
echo "CONTROL-D will exit from this shell and REBOOT the system."
echo
/sbin/sulogin $CONSOLE
reboot -f
fi
fi
mount -o remount,$rootmode /
|