From fbfef504e077f4f6bfd065afea1d7547cfff785d Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Thu, 10 Jan 2008 20:29:45 +0000 Subject: fix root fs check to catch 'rw,ordered,noatime,etc.' properly (#334171) --- rc.d/rc.sysinit | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'rc.d/rc.sysinit') diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit index 97746d82..2d282b07 100755 --- a/rc.d/rc.sysinit +++ b/rc.d/rc.sysinit @@ -679,12 +679,27 @@ if [ -z "$fastboot" -a "$READONLY" != "yes" ]; then fi fi +remount_needed() { + local state oldifs + [ "$READONLY" = "yes" ] && return 1 + state=`LC_ALL=C awk '/ \/ / && ($3 !~ /rootfs/) { print $4 }' /proc/mounts` + oldifs=$IFS + IFS="," + for opt in $state ; do + if [ "$opt" = "rw" ]; then + IFS=$oldifs + return 1 + fi + done + IFS=$oldifs + return 0 +} # Remount the root filesystem read-write. update_boot_stage RCmountfs -state=`LC_ALL=C awk '/ \/ / && ($3 !~ /rootfs/) { print $4 }' /proc/mounts` -[ "$state" != "rw" -a "$READONLY" != "yes" ] && \ +if remount_needed ; then action $"Remounting root filesystem in read-write mode: " mount -n -o remount,rw / +fi # Clean up SELinux labels if [ -n "$SELINUX_STATE" ]; then -- cgit v1.2.1