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 . ${STF_SUITE}/include/nfs-util.kshlib
  29 
  30 # Check if SETUP is set
  31 if  [[ -z $SETUP ]]; then
  32         echo "SETUP=<$SETUP> variable must be set, exiting."
  33         echo "SETUP variable must be set, (e.g. one of none,nfsv4)"
  34         exit 1
  35 fi
  36 
  37 if [[ $SETUP == none ]]; then
  38         # Check MNTDIR
  39         if [[ -z $MNTDIR ]] || ! [[ -d $MNTDIR ]]; then
  40                 echo "MNTDIR is either unset or invalid, exiting"
  41                 exit 1
  42         fi
  43         # Check TUSER01 and TUSER02
  44         if [[ -z $TUSER01 ]] \
  45             || ! getent passwd $TUSER01 >/dev/null 2>&1; then
  46                 echo "TUSER01=<$TUSER01> is either unset or invalid, exiting"
  47                 exit 1
  48         fi
  49         if [[ -z $TUSER02 ]] \
  50             || ! getent passwd $TUSER02 >/dev/null 2>&1; then
  51                 echo "TUSER02=<$TUSER02> is either unset or invalid, exiting"
  52                 exit 1
  53         fi
  54         exit 0
  55 fi
  56 
  57 # Check SERVER is reachable
  58 if  [[ -z $SERVER ]]; then
  59         echo "SERVER variable must be set, exiting."
  60         exit 1
  61 fi
  62 
  63 RUN_CHECK /usr/sbin/ping $SERVER || exit 1
  64 
  65 RUN_CHECK /usr/bin/ssh root@$SERVER /bin/true || exit 1
  66 
  67 # Check ZONE_PATH setting for TX
  68 ce_is_system_labeled
  69 if [[ $? == 0 ]]; then
  70         if [[ -z $ZONE_PATH ]]; then
  71             echo "ZONE_PATH not set, exiting."
  72             echo "You are running the suite over a CIPSO connection, \c"
  73             echo "you MUST set ZONE_PATH with /zone/<zone name>"
  74             exit 1
  75         fi
  76 else
  77         if [[ -n $ZONE_PATH ]]; then
  78             echo "ZONE_PATH is set without TX, exiting."
  79             exit 1
  80         fi
  81 fi
  82 
  83 
  84 if [[ $OPERATION == list ]] \
  85     && [[ -f $testsuite/bin/$SETUP/checkenv_def ]] ; then
  86         $0 -w -l -t $TASK -f bin/$SETUP/checkenv_def -T $testsuite \
  87             || exit 1
  88 elif [[ $OPERATION == verify ]] \
  89     && [[ -f $testsuite/bin/$SETUP/checkenv_def ]]; then
  90         $0 -w -e -v -t $TASK -f bin/$SETUP/checkenv_def -T $testsuite \
  91             || exit 1
  92 fi
  93 
  94 # do check for krb5 testing
  95 if [[ $IS_KRB5 == 1 ]]; then
  96         # need valid DNS server
  97         ce_host_reachable $DNS_SERVER 1> /dev/null; save_results $?
  98 
  99         # need krb5 support
 100         ce_file_exist /usr/bin/krb5-config >/dev/null ; save_results $?
 101 
 102         # need krb5tools
 103         ce_tool_exist $KRB5TOOLS_HOME/bin/kdccfg; save_results $?
 104         ce_tool_exist $KRB5TOOLS_HOME/bin/kdc_clientcfg; save_results $?
 105         ce_tool_exist $KRB5TOOLS_HOME/bin/krb5nfscfg; save_results $?
 106         ce_tool_exist $KRB5TOOLS_HOME/bin/princadm; save_results $?
 107 fi
 108 
 109 exit 0