[projects/rc-scripts] Umount remaining filesystems one by one (using -R) option which helps in cases when we have chroot m
arekm
arekm at pld-linux.org
Sun Apr 14 16:38:29 CEST 2024
commit 5a02578c97b0a2c01cc453344397645efc437f18
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Sun Apr 14 16:00:06 2024 +0200
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).
rc.d/rc.shutdown | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/rc.d/rc.shutdown b/rc.d/rc.shutdown
index a3807dd7..be5c7857 100755
--- a/rc.d/rc.shutdown
+++ b/rc.d/rc.shutdown
@@ -81,8 +81,20 @@ if ! is_yes "$VSERVER"; then
&& $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)
@@ -96,7 +108,10 @@ if ! is_yes "$VSERVER"; then
ok
else
fail
- [ -n "$ERRORS" ] && echo "$ERRORS"
+ if [ -n "$ERRORS" ]; then
+ nls "Umount errors:"
+ echo "$ERRORS"
+ fi
fi
sleep 2
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/rc-scripts.git/commitdiff/5a02578c97b0a2c01cc453344397645efc437f18
More information about the pld-cvs-commit
mailing list