summaryrefslogtreecommitdiff
path: root/init.d
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-10-11 09:49:54 +0000
committerRoy Marples <roy@marples.name>2007-10-11 09:49:54 +0000
commit64d1dd9da0c80691a562dad932dbca37bcfd6195 (patch)
treea60690d2cdfec53ad9bbf85c8f53e250fc5920ea /init.d
parent07c8f8cfde375df0601020ecd656dc825571f17b (diff)
downloadopenrc-64d1dd9da0c80691a562dad932dbca37bcfd6195.tar.gz
openrc-64d1dd9da0c80691a562dad932dbca37bcfd6195.tar.bz2
openrc-64d1dd9da0c80691a562dad932dbca37bcfd6195.tar.xz
If / block device as in /etc/fstab does not exist, use /dev/root if it's available in checkroot, #171593.
Diffstat (limited to 'init.d')
-rwxr-xr-xinit.d/checkroot11
1 files changed, 7 insertions, 4 deletions
diff --git a/init.d/checkroot b/init.d/checkroot
index a392ea3..a45265c 100755
--- a/init.d/checkroot
+++ b/init.d/checkroot
@@ -36,7 +36,7 @@ root_rw() {
}
do_fsck() {
- local retval=0 opts=
+ local retval=0 opts= root=
case "${RC_UNAME}" in
FreeBSD) opts="-F";;
Linux) opts="-T -C0";;
@@ -52,9 +52,12 @@ do_fsck() {
return 0
fi
+ root=$(fstabinfo --blockdevice /)
+ [ ! -e "${root}" -a -e /dev/root ] && root=/dev/root
+
if [ -e /forcefsck ] || get_bootparam "forcefsck" ; then
ebegin "Checking root filesystem (full fsck forced)"
- fsck ${opts} -f -n /
+ fsck ${opts} -f -n "${root}"
# /forcefsck isn't deleted because checkfs needs it.
# it'll be deleted in that script.
retval=$?
@@ -63,7 +66,7 @@ do_fsck() {
local pass=$(fstabinfo --passno /)
if [ ${pass:-0} != "0" ] ; then
ebegin "Checking root filesystem"
- fsck ${opts} -p /
+ fsck ${opts} -p "${root}"
retval=$?
else
ebegin "Skipping root filesystem check" "(fstab's passno == 0)"
@@ -92,7 +95,7 @@ do_fsck() {
else
if [ "${RC_FORCE_AUTO}" = "yes" ] ; then
eend 2 "Rerunning fsck in force mode"
- fsck ${opts} -y /
+ fsck ${opts} -y "${root}"
retval=$?
else
eend 2 "Filesystem couldn't be fixed :("