From: Marcin Krol Date: Tue, 21 May 2024 19:23:38 +0000 (+0200) Subject: - PLD merge: umount remaining filesystems one by one (using -R) option which helps... X-Git-Tag: 0.5.4~3 X-Git-Url: https://git.tld-linux.org/?a=commitdiff_plain;h=4d0d99b9003b973c89c2264cc0652d267d3404d4;p=rc-scripts.git - PLD merge: umount remaining filesystems one by one (using -R) option which helps in cases when we have chroot mounted somewhere with proc, sys etc inside. Also when doing final -a umount skip tmpfs (used by /run) and dev* (used in /dev). --- diff --git a/rc.d/rc.shutdown b/rc.d/rc.shutdown index db226b5..8c86fa4 100755 --- a/rc.d/rc.shutdown +++ b/rc.d/rc.shutdown @@ -80,8 +80,20 @@ remaining=$(awk -v ig="^($UMOUNT_IGNORE)$" 'BEGIN { gsub(/[\t ]+/, "|", ig); } \ && $1 !~ /^(none|\/dev\/root)$/ \ && $2 !~ ig {print $2}' /proc/mounts) while [ -n "$remaining" -a "$retry" -gt 0 ]; do - show "Unmounting file systems"; busy - ERRORS=$(umount -a $force -t noproc,nosysfs 2>&1); rc=$? + for mnt in $remaining; do + run_cmd "$(nls 'Umounting file system: %s' $mnt)" umount $force -R $mnt + + # 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 + done + + show "Unmounting remainging file systems"; busy + ERRORS=$(umount -a $force -t noproc,nosysfs,notmpfs,nodevpts,nodevtmpfs 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) @@ -95,7 +107,10 @@ while [ -n "$remaining" -a "$retry" -gt 0 ]; do ok else fail - [ -n "$ERRORS" ] && echo "$ERRORS" + if [ -n "$ERRORS" ]; then + nls "Umount errors:" + echo "$ERRORS" + fi fi sleep 2