1 #! /usr/bin/ksh -p
   2 #
   3 # CDDL HEADER START
   4 #
   5 # The contents of this file are subject to the terms of the
   6 # Common Development and Distribution License (the "License").
   7 # You may not use this file except in compliance with the License.
   8 #
   9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10 # or http://www.opensolaris.org/os/licensing.
  11 # See the License for the specific language governing permissions
  12 # and limitations under the License.
  13 #
  14 # When distributing Covered Code, include this CDDL HEADER in each
  15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16 # If applicable, add the following below this CDDL HEADER, with the
  17 # fields enclosed by brackets "[]" replaced with your own identifying
  18 # information: Portions Copyright [yyyy] [name of copyright owner]
  19 #
  20 # CDDL HEADER END
  21 #
  22 
  23 #
  24 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  25 # Use is subject to license terms.
  26 #
  27 
  28 DIR=$(dirname $0)
  29 NAME=$(basename $0)
  30 
  31 [[ :$SHAREMNT_DEBUG: == *:${NAME}:* \
  32         || :${SHAREMNT_DEBUG}: == *:all:* ]] && set -x
  33 
  34 . $STF_SUITE/include/sharemnt.kshlib
  35 
  36 # Cleanup the entries in auto_indirect map for possible next run
  37 grep -v "^SM_" $STF_TMPDIR/auto_indirect.shmnt > $STF_TMPDIR/ind_tmp.$$
  38 mv $STF_TMPDIR/ind_tmp.$$ $STF_TMPDIR/auto_indirect.shmnt
  39 if (( $? != 0 )); then
  40         echo "$NAME: Failed to cleanup the entries from the"
  41         echo "\tindirect map <$STF_TMPDIR/auto_indirect.shmnt>"
  42         echo "\tRe-run this subdir may have unexpected automount results."
  43         exit $STF_WARNING
  44 fi
  45 
  46 automount
  47 
  48 # umount autofs by force if it is still mounted
  49 for mnt in $(nfsstat -m | grep "^$AUTOIND/SM_" \
  50         | awk '{print $1}'); do
  51         umount -f $mnt > $STF_TMPDIR/umnt.out.$$ 2>&1
  52         if (( $? != 0 )); then
  53                 echo "$NAME: Warning - umount $mnt failed -"
  54                 cat $STF_TMPDIR/umnt.out.$$
  55                 echo "\t... please clean it up manually."
  56         fi
  57 done
  58 
  59 cleanup $STF_PASS