diff options
author | Renato Botelho <garga@FreeBSD.org> | 2014-05-05 10:20:26 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2014-05-05 10:20:26 -0300 |
commit | f5813962a286e61f633ede61beb506b0e33d9a2f (patch) | |
tree | d9abdf16e84f1bf758a745f756f6cf54bba13835 | |
parent | 4f0a5e57871a3d8683f224c571e8fe89ca0a8ecc (diff) | |
download | pfsense-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
-rwxr-xr-x | etc/rc | 35 |
1 files changed, 30 insertions, 5 deletions
@@ -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 |