Home | History | Annotate | Download | only in lib
      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 2007 Sun Microsystems, Inc.  All rights reserved.
     25 # Use is subject to license terms.
     26 #
     27 # ident	"@(#)ce_tool_exist.ksh	1.2	07/01/04 SMI"
     28 #
     29 
     30 # 
     31 # Function ce_tool_exist
     32 #
     33 # This function checks if the system supports the ce_tool_exist
     34 #
     35 function ce_tool_exist
     36 {
     37 	tool=$1
     38 
     39 	result=PASS
     40 	resultmsg=
     41 
     42 	# Check the argument and make sure it is as expected - abort
     43 	# otherwise
     44 	#
     45 	errmsg="ce_tool_exist expects a tool name (to check) as an argument"
     46 
     47         [[ $# -ne 1 ]] && abort $errmsg
     48 
     49 	# Set print information
     50 	#
     51 	req_label="tool must exist"
     52 	req_value="$tool"
     53 
     54 	# If operation is to dump info, dump and return
     55 	[[ $OPERATION = "dump" ]] && {
     56 		ce_tool_exist_doc
     57 		return $PASS
     58 	}
     59 
     60 	#
     61 	# Verify that the system meets requirements - set result=[PASS|FAIL]
     62 	#
     63 	[[ $OPERATION = "verify" ]] && {
     64 		[[ ! -x $tool ]] &&  result=FAIL
     65 	}
     66 	
     67 	# print results of checkenv
     68 	print_line $TASK "$req_label" "$req_value" "$result"
     69 
     70 	# return final result
     71 	eval return \$$result
     72 }
     73 
     74 function ce_tool_exist_doc
     75 {
     76 	cat >&1 << EOF
     77 
     78 Check ce_tool_exist ($TASK)
     79 ==============================
     80 Description: 
     81 	Check if a tool exists
     82 Arguments: 
     83 	#1 - name of the tool
     84 Requirement label (for this check): 
     85 	$req_label
     86 Requirement value (for this check): 
     87 	$req_value
     88 EOF
     89 }
     90