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