summaryrefslogtreecommitdiffstats
path: root/etc/rc
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2014-05-05 10:20:26 -0300
committerRenato Botelho <garga@FreeBSD.org>2014-05-05 10:20:26 -0300
commitf5813962a286e61f633ede61beb506b0e33d9a2f (patch)
treed9abdf16e84f1bf758a745f756f6cf54bba13835 /etc/rc
parent4f0a5e57871a3d8683f224c571e8fe89ca0a8ecc (diff)
downloadpfsense-f5813962a286e61f633ede61beb506b0e33d9a2f.zip
pfsense-f5813962a286e61f633ede61beb506b0e33d9a2f.tar.gz
Sometimes fsck requires a second run, teach rc script to call it more than once when it's necessary
Diffstat (limited to 'etc/rc')
-rwxr-xr-xetc/rc35
1 files changed, 30 insertions, 5 deletions
diff --git a/etc/rc b/etc/rc
index e5a6589..01df7d2 100755
--- a/etc/rc
+++ b/etc/rc
@@ -72,9 +72,26 @@ else
# Mount /. If it fails run a fsck.
if [ "$PLATFORM" = "nanobsd" ]; then
export PKG_TMPDIR=/root/
- /sbin/mount -uw / || (/sbin/fsck -y /; /sbin/fsck -y /cf; /sbin/mount -uw /)
- else
- /sbin/mount -a || (/sbin/fsck -y /; /sbin/mount -a)
+ /sbin/mount -uw / 2>/dev/null
+ mount_rc=$?
+ attempts=0
+ while [ ${mount_rc} != 0 -a ${attempts} -lt 3 ]; do
+ /sbin/fsck -y /
+ /sbin/fsck -y /cf
+ /sbin/mount -uw / 2>/dev/null
+ mount_rc=$?
+ attempts=$((attempts+1))
+ done
+ else
+ /sbin/mount -a 2>/dev/null
+ mount_rc=$?
+ attempts=0
+ while [ ${mount_rc} != 0 -a ${attempts} -lt 3 ]; do
+ /sbin/fsck -y /
+ /sbin/mount -a 2>/dev/null
+ mount_rc=$?
+ attempts=$((attempts+1))
+ done
fi
# If /conf is a directory, convert it to a symlink to /cf/conf
@@ -92,8 +109,16 @@ else
# If it fails to mount then run a fsck -y
if grep -q cf /etc/fstab; then
/sbin/mount -w /cf 2>/dev/null
- /sbin/mount -uw /cf || \
- (/sbin/umount /cf; /sbin/fsck -y /cf; /sbin/mount -w /cf)
+ /sbin/mount -uw /cf 2>/dev/null
+ mount_rc=$?
+ attempts=0
+ while [ ${mount_rc} != 0 -a ${attempts} -lt 3 ]; do
+ /sbin/umount /cf
+ /sbin/fsck -y /cf
+ /sbin/mount -w /cf 2>/dev/null
+ mount_rc=$?
+ attempts=$((attempts+1))
+ done
fi
fi
OpenPOWER on IntegriCloud