diff options
| author | Pavel Filipensky <Pavel.Filipensky@Sun.COM> | 2008-12-19 11:45:03 +0000 |
|---|---|---|
| committer | Pavel Filipensky <Pavel.Filipensky@Sun.COM> | 2008-12-19 11:45:03 +0000 |
| commit | 5fad3ade0b6bf1454149b5f22a06ce99e9c1e4ff (patch) | |
| tree | 018a8f3b37cd95d33b1750c5a3749f7a53925875 /usr/src/cmd/initpkg | |
| parent | c8268b2c32246a4fd927df00921c772baab114e0 (diff) | |
| download | illumos-joyent-5fad3ade0b6bf1454149b5f22a06ce99e9c1e4ff.tar.gz | |
6779275 umountall(1M) -Z ... limit unmounting action(s) to the non-global zones
Diffstat (limited to 'usr/src/cmd/initpkg')
| -rw-r--r-- | usr/src/cmd/initpkg/umountall.sh | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/usr/src/cmd/initpkg/umountall.sh b/usr/src/cmd/initpkg/umountall.sh index 32737fb155..839a1f83a3 100644 --- a/usr/src/cmd/initpkg/umountall.sh +++ b/usr/src/cmd/initpkg/umountall.sh @@ -32,8 +32,8 @@ usage () { if [ -n "$1" ]; then echo "umountall: $1" 1>&2 fi - echo "Usage:\n\tumountall [-k] [-s] [-F FSType] [-l|-r] [-n]" 1>&2 - echo "\tumountall [-k] [-s] [-h host] [-n]" 1>&2 + echo "Usage:\n\tumountall [-k] [-s] [-F FSType] [-l|-r] [-Z] [-n]" 1>&2 + echo "\tumountall [-k] [-s] [-h host] [-Z] [-n]" 1>&2 exit 2 } @@ -66,7 +66,6 @@ MNTTAB=/etc/mnttab # /usr/bin/sleep -k, to sleep after an fuser -c -k on the mountpoint # /usr/sbin/fuser -k, to kill processes keeping a mount point busy # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. # In addition, we use /usr/bin/tail if it is available; if not we use # slower shell constructs to reverse a file. @@ -84,12 +83,13 @@ RFLAG= LFLAG= SFLAG= KFLAG= +ZFLAG= NFLAG= LOCALNAME= UMOUNTFLAG= -while getopts ?rslkF:h:n c +while getopts ?rslkF:h:Zn c do case $c in r) RFLAG="r";; @@ -113,6 +113,7 @@ do usage "FSType ${FSType} exceeds 8 characters" esac; ;; + Z) ZFLAG="z";; n) NFLAG="n" # Alias any commands that would perform real actions to # something that tells what action would have been performed @@ -198,7 +199,7 @@ fi # Take advantage of parallel unmounting at this point if we have no # criteria to match and we are in the global zone # -if [ -z "${SFLAG}${LFLAG}${RFLAG}${HFLAG}${KFLAG}${FFLAG}" -a \ +if [ -z "${SFLAG}${LFLAG}${RFLAG}${HFLAG}${KFLAG}${FFLAG}${ZFLAG}" -a \ "$ZONENAME" = "global" ]; then umount -a ${UMOUNTFLAG} exit # with return code of the umount -a @@ -304,6 +305,24 @@ doumounts () { if [ "$option" != "zone=$ZONENAME" ]; then continue fi + # we are called from the global zone + else + for option in `echo $mode | tr , '\012'`; do + case "$option" in + zone=*) + option="zone=" + break + ;; + esac + done + # skip mounts from non-global zones if ZFLAG is not set + if [ "$option" = "zone=" -a -z "$ZFLAG" ]; then + continue + fi + # skip mounts from the global zone if ZFLAG is set + if [ "$option" != "zone=" -a -n "$ZFLAG" ]; then + continue + fi fi if [ -n "${KFLAG}" ]; then fuser -c -k $mountp 1>&2 |
