SVN: rc-scripts/trunk/rc.d/rc.shutdown

baggins baggins at pld-linux.org
Mon Mar 16 00:06:46 CET 2009


Author: baggins
Date: Mon Mar 16 00:06:46 2009
New Revision: 10210

Modified:
   rc-scripts/trunk/rc.d/rc.shutdown
Log:
- refactor awk invocation in fs unmounting code


Modified: rc-scripts/trunk/rc.d/rc.shutdown
==============================================================================
--- rc-scripts/trunk/rc.d/rc.shutdown	(original)
+++ rc-scripts/trunk/rc.d/rc.shutdown	Mon Mar 16 00:06:46 2009
@@ -64,7 +64,9 @@
 	sig=-15
 	retry=3
 	force=
-	remaining=$(awk '!/(^#| proc | loopfs | devpts | shm | iso9660 | ramfs | tmpfs | sysfs | securityfs | squashfs |^none|^\/dev\/root| \/ )/ {print $2}' /proc/mounts)
+	remaining=$(awk '$3 !~ /^(proc|loopfs|devpts|shm|iso9660|ramfs|tmpfs|sysfs|securityfs|squashfs)$/ \
+			&& $1 !~ /^(none|\/dev\/root)$/ \
+			&& $2 !~ /^\/$/ {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=$?
@@ -85,7 +87,9 @@
 		fi
 
 		sleep 2
-		remaining=$(awk '!/(^#| proc | loopfs | devpts | shm | iso9660 | ramfs | tmpfs | sysfs | securityfs | squashfs |^none|^\/dev\/root| \/ )/ {print $2}' /proc/mounts)
+		remaining=$(awk '$3 !~ /^(proc|loopfs|devpts|shm|iso9660|ramfs|tmpfs|sysfs|securityfs|squashfs)$/ \
+				&& $1 !~ /^(none|\/dev\/root)$/ \
+				&& $2 !~ /^\/$/ {print $2}' /proc/mounts)
 		[ -z "$remaining" ] && break
 		fuser -k -m $sig $remaining > /dev/null
 		sleep 5


More information about the pld-cvs-commit mailing list