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 # ident "@(#)cleanup.ksh 1.4 09/02/06 SMI" 28 # 29 30 DIR=$(dirname $0) 31 NAME=$(basename $0) 32 33 [[ :$SHAREMNT_DEBUG: == *:${NAME}:* \ 34 || :${SHAREMNT_DEBUG}: == *:all:* ]] && set -x 35 36 . $STF_SUITE/include/sharemnt.kshlib 37 38 # Cleanup the entries in auto_indirect map for possible next run 39 grep -v "^SM_" $STF_TMPDIR/auto_indirect.shmnt > $STF_TMPDIR/ind_tmp.$$ 40 mv $STF_TMPDIR/ind_tmp.$$ $STF_TMPDIR/auto_indirect.shmnt 41 if (( $? != 0 )); then 42 echo "$NAME: Failed to cleanup the entries from the" 43 echo "\tindirect map <$STF_TMPDIR/auto_indirect.shmnt>" 44 echo "\tRe-run this subdir may have unexpected automount results." 45 exit $STF_WARNING 46 fi 47 48 automount 49 50 # umount autofs by force if it is still mounted 51 for mnt in $(nfsstat -m | grep "^$AUTOIND/SM_" \ 52 | awk '{print $1}'); do 53 umount -f $mnt > $STF_TMPDIR/umnt.out.$$ 2>&1 54 if (( $? != 0 )); then 55 echo "$NAME: Warning - umount $mnt failed -" 56 cat $STF_TMPDIR/umnt.out.$$ 57 echo "\t... please clean it up manually." 58 fi 59 done 60 61 cleanup $STF_PASS 62