# them; rflags is guaranteed to not be empty
rflags="${rootopts:+"${rootopts},"}${rflags}"
- umount "$NEWROOT"
-
# backslashes are treated as escape character in fstab
# esc_root=$(echo ${root#block:} | sed 's,\\,\\\\,g')
# printf '%s %s %s %s 1 1 \n' "$esc_root" "$NEWROOT" "$rootfs" "$rflags" >/etc/fstab
+ ran_fsck=0
if [ -z "$fastboot" -a "$READONLY" != "yes" ] && ! strstr "${rflags},${rootopts}" _netdev; then
+ umount "$NEWROOT"
fsck_single "${root#block:}" "$rootfs" "$fsckoptions"
_ret=$?
[ $_ret -ne 255 ] && echo $_ret >/run/initramfs/root-fsck
+ ran_fsck=1
fi
- info "Remounting ${root#block:} with -o ${rflags}"
- mount -t "$rootfs" -o "$rflags" "${root#block:}" "$NEWROOT" 2>&1 | vinfo
+ if [ -n "$rootopts" -o "$ran_fsck" = "1" ]; then
+ info "Remounting ${root#block:} with -o ${rflags}"
+ umount "$NEWROOT" &>/dev/null
+ mount -t "$rootfs" -o "$rflags" "${root#block:}" "$NEWROOT" 2>&1 | vinfo
+ fi
[ -f "$NEWROOT"/forcefsck ] && rm -f "$NEWROOT"/forcefsck 2>/dev/null
[ -f "$NEWROOT"/.autofsck ] && rm -f "$NEWROOT"/.autofsck 2>/dev/null