- while [ -n "$remaining" -a "$retry" -gt 0 ]; do
- show "Unmounting file systems"; busy
- ERRORS=$(umount -a $force -t noproc 2>&1); rc=$?
-
- # we might had unmounted /usr, recheck $TPUT availability
- # but well. we need tput only for show() and busy() (ok() and fail() messages are already cached)
- # TODO: look ahead the messages?
- if is_yes "$TPUT"; then
- TPUT=
- rc_gettext_init
- fi
-
- if [ $rc = 0 ]; then
- ok
- else
- fail
- [ -n "$ERRORS" ] && echo "$ERRORS"
- fi
-
- sleep 2
- remaining=$(awk -v ig="^($UMOUNT_IGNORE)$" 'BEGIN { gsub(/[\t ]+/, "|", ig); } \
- $3 !~ /^(proc|loopfs|devpts|devtmpfs|shm|iso9660|ramfs|tmpfs|sysfs|securityfs|squashfs)$/ \
- && $1 !~ /^(none|\/dev\/root)$/ \
- && $2 !~ ig {print $2}' /proc/mounts)
- [ -z "$remaining" ] && break
- fuser -k -m $sig $remaining > /dev/null
- sleep 5
- retry=$(($retry-1))
- sig=-9
- force="-f"
- done
-
- run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
-
- if [ -x /sbin/vgchange ]; then
- lvmversion=$(LC_ALL=C /sbin/vgchange --version 2>/dev/null | awk '/LVM version:/{if ($3 >= 2) print "2"}')
- if [ "$lvmversion" = "2" ]; then
- lvmsysinit="--sysinit"
- else
- lvmsysinit=""
- fi
- /sbin/vgchange -a n $lvmsysinit > /dev/null 2>&1
- fi