]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
- refactor awk invocation in fs unmounting code
authorJan Rękorajski <baggins@pld-linux.org>
Sun, 15 Mar 2009 23:06:46 +0000 (23:06 +0000)
committerJan Rękorajski <baggins@pld-linux.org>
Sun, 15 Mar 2009 23:06:46 +0000 (23:06 +0000)
svn-id: @10210

rc.d/rc.shutdown

index 9acecd3384c353a21b8ee7d4044d672b8bb8f968..dc578e5cca22f447080a9bd316c59a4f0d25d0a4 100755 (executable)
@@ -64,7 +64,9 @@ if ! is_yes "$VSERVER"; then
        sig=-15
        retry=3
        force=
        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=$?
        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 @@ if ! is_yes "$VSERVER"; then
                fi
 
                sleep 2
                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
                [ -z "$remaining" ] && break
                fuser -k -m $sig $remaining > /dev/null
                sleep 5
This page took 0.272451 seconds and 4 git commands to generate.