]> git.pld-linux.org Git - packages/nfs-utils.git/commitdiff
- replace hardcoded regexp (/|/usr) with a variable
authorJan Rękorajski <baggins@pld-linux.org>
Sun, 15 Mar 2009 10:16:37 +0000 (10:16 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    nfsfs.init -> 1.40
    nfsfs.sysconfig -> 1.6

nfsfs.init
nfsfs.sysconfig

index 29e936c78726ee7ca8dc0cd304361881d82edf6d..46961a0d6c80419d4cf0e42f71b1e3ccc4256fbb 100644 (file)
@@ -35,6 +35,10 @@ if [ "$1" != "stop" ]; then
        check_portmapper || { nls "Error: portmap isn't running" && exit 0; }
 fi
 
+if [ -z "$NFSUMOUNT_IGNORE" ]; then
+       NFSUMOUNT_IGNORE="/ /usr"
+fi
+
 start() {
        if [ ! -f /var/lock/subsys/nfsfs ]; then
                # Set the ports lockd should listen on
@@ -72,20 +76,25 @@ stop() {
        show "Unmounting NFS filesystems"
        busy
        retry=3
-       remaining=$(awk '$3 ~ /^nfs(4$|$)/ && $2 !~ /^\/(usr$|$)/ {print $2}' $fsfile)
+       remaining=$(awk -v ig="^($NFSUMOUNT_IGNORE)$" 'BEGIN { gsub(/[\t ]+/, "|", ig); } \
+                       $3 ~ /^nfs(4$|$)/ && $2 !~ ig {print $2}' $fsfile)
        while [ -n "$remaining" -a $retry -gt 0 ]; do
-               fuser -msk -TERM `awk '$3 ~ /^nfs(4$|$)/ && $2 !~ /^\/(usr$|$)/ {print $2}' < $fsfile`
+               fuser -msk -TERM `awk -v ig="^($NFSUMOUNT_IGNORE)$" 'BEGIN { gsub(/[\t ]+/, "|", ig); } \
+                                       $3 ~ /^nfs(4$|$)/ && $2 !~ ig {print $2}' < $fsfile`
                sleep 2
-               fuser -msk -KILL `awk '$3 ~ /^nfs(4$|$)/ && $2 !~ /^\/(usr$|$)/ {print $2}' < $fsfile`
+               fuser -msk -KILL `awk -v ig="^($NFSUMOUNT_IGNORE)$" 'BEGIN { gsub(/[\t ]+/, "|", ig); } \
+                                       $3 ~ /^nfs(4$|$)/ && $2 !~ ig {print $2}' < $fsfile`
                # Sort filesystems to unmount in reverse order
                rem=""
-               for r in $(awk '$3 ~ /^nfs(4$|$)/ && $2 !~ /^\/(usr$|$)/ {print $2}' $fsfile) ; do
+               for r in $(`awk -v ig="^($NFSUMOUNT_IGNORE)$" 'BEGIN { gsub(/[\t ]+/, "|", ig); } \
+                               $3 ~ /^nfs(4$|$)/ && $2 !~ ig {print $2}' $fsfile) ; do
                        rem="$r $rem"
                done
                for fs in $rem ; do
                        umount $fs
                done
-               remaining=$(awk '$3 ~ /^nfs(4$|$)/ && $2 !~ /^\/(usr$|$)/ {print $2}' $fsfile)
+               remaining=$(awk -v ig="^($NFSUMOUNT_IGNORE)$" 'BEGIN { gsub(/[\t ]+/, "|", ig); } \
+                               $3 ~ /^nfs(4$|$)/ && $2 !~ ig {print $2}' $fsfile)
                retry=$(($retry-1))
        done
        ok
index 0de86bd4209a1d04022b973a054241eb799d762f..802ed73c5b65133b48405bfdef4fb51afa58e84f 100644 (file)
 # Options for NFSv4 rpcsec_gss daemon
 #RPCGSSOPTIONS=
 
+# Space separated list of mount points that init script should not even
+# try to umount because it will not work 
+# May contain regular expressions (ex. "/dev/union/.*")
+NFSUMOUNT_IGNORE="/ /usr"
+
 # Enable if you don't want rpm upgrade to remount Your NFS mounts
 # By default is on, because it's really dangerous to remount i.e. /home
 RPM_SKIP_AUTO_RESTART=yes
This page took 0.073045 seconds and 4 git commands to generate.