SOURCES: nfsfs.init, nfsfs.sysconfig - replace hardcoded regexp (/|/usr) wi...

baggins baggins at pld-linux.org
Sun Mar 15 11:16:43 CET 2009


Author: baggins                      Date: Sun Mar 15 10:16:43 2009 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- replace hardcoded regexp (/|/usr) with a variable

---- Files affected:
SOURCES:
   nfsfs.init (1.39 -> 1.40) , nfsfs.sysconfig (1.5 -> 1.6) 

---- Diffs:

================================================================
Index: SOURCES/nfsfs.init
diff -u SOURCES/nfsfs.init:1.39 SOURCES/nfsfs.init:1.40
--- SOURCES/nfsfs.init:1.39	Tue Sep 25 17:57:59 2007
+++ SOURCES/nfsfs.init	Sun Mar 15 11:16:37 2009
@@ -35,6 +35,10 @@
 	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 @@
 	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: SOURCES/nfsfs.sysconfig
diff -u SOURCES/nfsfs.sysconfig:1.5 SOURCES/nfsfs.sysconfig:1.6
--- SOURCES/nfsfs.sysconfig:1.5	Tue Mar 20 16:16:46 2007
+++ SOURCES/nfsfs.sysconfig	Sun Mar 15 11:16:37 2009
@@ -10,6 +10,11 @@
 # 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
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/nfsfs.init?r1=1.39&r2=1.40&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/nfsfs.sysconfig?r1=1.5&r2=1.6&f=u



More information about the pld-cvs-commit mailing list