From 4cc198ff5f8fe29bd4ef51142d5470ace272bb03 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20R=C4=99korajski?= Date: Sun, 15 Mar 2009 23:09:35 +0000 Subject: [PATCH] - added UMOUNT_IGNORE option svn-id: @10211 --- rc.d/rc.shutdown | 15 +++++++++++---- sysconfig/system | 5 +++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/rc.d/rc.shutdown b/rc.d/rc.shutdown index dc578e5c..7a39fb89 100755 --- a/rc.d/rc.shutdown +++ b/rc.d/rc.shutdown @@ -64,9 +64,15 @@ if ! is_yes "$VSERVER"; then sig=-15 retry=3 force= - remaining=$(awk '$3 !~ /^(proc|loopfs|devpts|shm|iso9660|ramfs|tmpfs|sysfs|securityfs|squashfs)$/ \ + if [ -z "$UMOUNT_IGNORE" ]; then + UMOUNT_IGNORE="/" + else + UMOUNT_IGNORE="/ $UMOUNT_IGNORE" + fi + remaining=$(awk -v ig="^($UMOUNT_IGNORE)$" 'BEGIN { gsub(/[\t ]+/, "|", ig); } \ + $3 !~ /^(proc|loopfs|devpts|shm|iso9660|ramfs|tmpfs|sysfs|securityfs|squashfs)$/ \ && $1 !~ /^(none|\/dev\/root)$/ \ - && $2 !~ /^\/$/ {print $2}' /proc/mounts) + && $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 2>&1); rc=$? @@ -87,9 +93,10 @@ if ! is_yes "$VSERVER"; then fi sleep 2 - remaining=$(awk '$3 !~ /^(proc|loopfs|devpts|shm|iso9660|ramfs|tmpfs|sysfs|securityfs|squashfs)$/ \ + remaining=$(awk -v ig="^($UMOUNT_IGNORE)$" 'BEGIN { gsub(/[\t ]+/, "|", ig); } \ + $3 !~ /^(proc|loopfs|devpts|shm|iso9660|ramfs|tmpfs|sysfs|securityfs|squashfs)$/ \ && $1 !~ /^(none|\/dev\/root)$/ \ - && $2 !~ /^\/$/ {print $2}' /proc/mounts) + && $2 !~ ig {print $2}' /proc/mounts) [ -z "$remaining" ] && break fuser -k -m $sig $remaining > /dev/null sleep 5 diff --git a/sysconfig/system b/sysconfig/system index 617d016b..de417858 100644 --- a/sysconfig/system +++ b/sysconfig/system @@ -98,6 +98,11 @@ RC_PROMPT=yes # chroot properly) #SYSTEM_CHROOTS= +# List (space separated) of special mount points that must not be unmounted +# on system shutdown. +# May contain regular exporessions (eg. "/dev/rootunion/.*") +#UMOUNT_IGNORE= + # Enable cpusets support? CPUSETS=no -- 2.44.0