Home | History | Annotate | Download | only in nfsgen
      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	"@(#)unconfigure.ksh	1.1	09/04/27 SMI"
     28 #
     29 
     30 DIR=$(dirname $0)
     31 NAME=$(basename $0)
     32 
     33 . ${STF_SUITE}/include/nfsgen.kshlib
     34 
     35 # Turn on debug info, if requested
     36 export _NFS_STF_DEBUG=$_NFS_STF_DEBUG:$NFSGEN_DEBUG
     37 [[ :$NFSGEN_DEBUG: = *:${NAME}:* || :${NFSGEN_DEBUG}: = *:all:* ]] \
     38        && set -x
     39 
     40 if [[ $SETUP == "none" ]]; then
     41 	echo "$NAME: SETUP=<$SETUP>, user manual setup"
     42 	echo "\tonly cleanup TMPDIR, user should do other manual cleanup"
     43 	rm -rf $STF_TMPDIR
     44 	exit $STF_PASS
     45 fi
     46 
     47 #
     48 # Setup-specific cleanup
     49 #
     50 
     51 RUN_CHECK ${STF_SUITE}/setup/$SETUP/unconfigure
     52 
     53 #
     54 # General client side cleanup
     55 #    - removing test user
     56 #    - restoring mapid domain
     57 #
     58 
     59 # Restore mapid domain on client
     60 restore_nfs_property NFSMAPID_DOMAIN $STF_TMPDIR/mapid_backup
     61 
     62 # Delete test user and group on client
     63 RUN_CHECK userdel $TUSER01
     64 RUN_CHECK userdel $TUSER02
     65 RUN_CHECK groupdel $TGROUP
     66 
     67 #
     68 # General server side cleanup
     69 #    - removing test user
     70 #    - restoring mapid domain
     71 #
     72 
     73 # Run server setup script to do cleanup, pass down env varialbes it needs
     74 RUN_CHECK RSH root $SERVER "$SRV_TMPDIR/srv_setup -c"
     75 
     76 # Cleanup the kerberos if needed
     77 [[ $IS_KRB5 == 1 ]] && RUN_CHECK krb5_config -c
     78  
     79 # Remove temp dir on server
     80 RUN_CHECK RSH root $SERVER "rm -rf $SRV_TMPDIR"
     81 
     82 if [[ -n $CLIENT2 && $CLIENT2 != $SERVER && $CLIENT2 != $CLIENT ]]; then
     83 	RUN_CHECK RSH root $CLIENT2 "$SRV_TMPDIR/srv_setup -c"
     84 	RUN_CHECK RSH root $CLIENT2 "rm -rf $SRV_TMPDIR"
     85 fi
     86 
     87 rm -rf $STF_TMPDIR
     88 
     89 exit $STF_PASS
     90