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