#!/bin/sh
# utils.sh

##########################################################################
# (C) Copyright 2005 The Open Group
#
# All rights reserved.  No part of this source code may be reproduced,
# stored in a retrieval system, or transmitted, in any form or by any
# means, electronic, mechanical, photocopying, recording or otherwise,
# except as stated in the end-user licence agreement, without the prior
# permission of the copyright owners.
#
# X/Open and the 'X' symbol are trademarks of X/Open Company Limited in
# the UK and other countries.
#
#       PRODUCT:        /tset/initd/misc/utils/utils.sh
#       AUTHOR:         Andrew Josey, The Open Group
#       DATE CREATED:   20 June 2005
##########################################################################

tet_startup="startup"			# startup function
tet_cleanup="cleanup"			# cleanup function
iclist="ic1 ic2 ic3"
ic1="tp1"
ic2="tp2"
ic3="tp3"

tp1()
{
        tpstart "Reference 20.3-1 (A)" 
        tet_infoline "The implementation provides an exec-able version of the install_initd"
        tet_infoline "utility in the /usr/lib/lsb/ directory. "
	lsb_execwithpriv test -x /usr/lib/lsb/install_initd 2>out.stderr
	check_exit_value $? 0
	check_nostderr
        tpresult                        # set result code
}

tp2()
{
        tpstart "Reference 20.3-2 (A)" 
        tet_infoline "The implementation provides an exec-able version of the remove_initd"
        tet_infoline "utility in the /usr/lib/lsb/ directory. "
	lsb_execwithpriv test -x /usr/lib/lsb/install_initd 2>out.stderr
	check_exit_value $? 0
	check_nostderr
        tpresult                        # set result code
}


tp3()
{
	tpstart "Reference 20.3-3(A), The /etc/init.d directory exists, and may be a symbolic link"
	if [ ! -e /etc/init.d ]
	then
		FAIL=Y
	fi
        tpresult                        # set result code
}

startup() # startup function
{
     rm -f out.stdout out.stderr out.experr dev.out fail.out >/dev/null 2>&1
}

cleanup() # clean-up function
{
     rm -f out.stdout out.stderr out.experr dev.out fail.out >/dev/null 2>&1
}

# source common shell functions

. $TET_EXECUTE/LIB/shfuncs.sh
. $TET_EXECUTE/LIB/lsbfuncs.sh

# execute shell test case manager - must be last line
. $TET_ROOT/lib/xpg3sh/tcm.sh
