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 #
  29 # cleanup script for nfs server environment
  30 #
  31 
  32 . ${STF_SUITE}/include/nfsgen.kshlib
  33 
  34 NAME=$(basename $0)
  35 DIR=$(dirname $0)
  36 
  37 [[ :$NFSGEN_DEBUG: = *:${NAME}:* || :${NFSGEN_DEBUG}: = *:all:* ]] && set -x
  38 
  39 [[ $SETUP == "none" ]] && exit $STF_PASS
  40 
  41 # now cleanup the SERVER
  42 RSH root $SERVER "/usr/bin/ksh ${SRV_TMPDIR}/recov_setserver -c; \
  43         rm -f ${SRV_TMPDIR}/recov_setserver ${SRV_TMPDIR}/nfs-smf.kshlib" \
  44         > ${STF_TMPDIR}/rsh.out.$$ 2>&1
  45 grep "OKAY" ${STF_TMPDIR}/rsh.out.$$ | grep -v echo > /dev/null 2>&1
  46 if (( $? != 0 )); then
  47         grep ERROR ${STF_TMPDIR}/rsh.out.$$ | grep -v echo > /dev/null 2>&1
  48         if (( $? == 0 )); then
  49                 echo "$NAME: cleanup $SERVER failed:"
  50                 cat ${STF_TMPDIR}/rsh.out.$$
  51         fi
  52         cleanup $STF_FAIL "" ${STF_TMPDIR}/rsh.out.$$
  53 else
  54         # If server returned some warning, print it out
  55         grep "STF_WARNING" $STF_TMPDIR/rsh.out.$$ | grep -v echo > /dev/null 2>&1
  56         if (( $? == 0 )); then
  57                 cat $STF_TMPDIR/rsh.out.$$
  58         fi
  59 fi
  60 
  61 [[ :$NFSGEN_DEBUG: = *:${NAME}:* || :${NFSGEN_DEBUG}: = *:all:* ]] \
  62         && cat $STF_TMPDIR/rsh.out.$$
  63 echo "$NAME: $SERVER rec_cleanup OK!! "
  64 
  65 cleanup $STF_PASS "" "${STF_TMPDIR}/*.out.$$ \
  66         ${STF_TMPDIR}/S99nfs4red \
  67         ${STF_TMPDIR}/nfs4red \
  68         ${STF_TMPDIR}/recov_setserver \
  69         ${STF_TMPDIR}/recov_setclient2"