#!/bin/ksh -p
#
# ident "@(#)utlib64ctl.ksh	1.3	06/06/22 SMI"
#
# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#

set -u

########################################################################
#
# Installs the 64bit libraries onto the system.
#
# NOTE: the libraries will be symbolically link to the target library.
#
########################################################################



########################################################################
#
# Operation entry points, one for each keyword.  This is where the
# specific work for this feature happens.
#
########################################################################


#
# disable()
#
disable() {

	typeset REMOVED=false

	if [ ! -d ${TARGET_DIR} ]; then
		# target directory not found, nothing to disable
		return 0
	fi

	for F in $LIBRARY_LIST
	do
		if [ -L ${TARGET_DIR}/$F ] ; then
			/bin/rm -rf ${TARGET_DIR}/$F
			REMOVED=true
		fi
	done
	if $VERB && $REMOVED; then
		print "64bit libraries disabled"
	fi
	return 0
}

#
# enable()
# NOTE: always overwriting any existing link.
#
enable() {
	if [ ! -d ${TARGET_DIR} ]; then
		# target directory not found, nothing to enable
		return 0
	fi

	for F in $LIBRARY_LIST
	do
		/bin/ln -s -f ${SRC_DIR}/$F ${TARGET_DIR}/$F
	done
	if $VERB; then
		print "64bit libraries enabled"
	fi
	return 0
}


#########################################
# LOCAL VARIABLES
# They must defined here to resolve the some of parameter resolution
# problem
#########################################
local_variables() {
	TARGET_DIR=/usr/lib64
	SRC_DIR=${SUNWUT}/lib64
	LIBRARY_LIST=libc_ut.so
}


#########################################
#
# Configurable parameter
#
#########################################
# NONE

#########################################
#
# variables used in the shared script utctl-shlib
#
#########################################
DESCR="sets up the 64bit libraries for Sun Ray programs"


########################################################################
#
# Execution starts here
#

PROGPATH=`dirname $0`
. $PROGPATH/utctl-shlib
