# Copyright 08/10/00 Sun Microsystems, Inc. All Rights Reserved.
# @(#)postinstall	1.1 08/30/00

PATH=/bin:/usr/bin:/sbin:/usr/sbin

# if PKG_INSTALL_ROOT is not assigned from the env then
# set it to an empty string, set -u in effect below
#
if [ -z "$PKG_INSTALL_ROOT" ]; then
	PKG_INSTALL_ROOT=""
fi

set -eu

# 
# Run utrepair to initialise all CDE / Solaris files 
# for use with Sun Ray
#

SUNWUTLIB="${PKG_INSTALL_ROOT}/${BASEDIR}/SUNWut/lib"
PROTODIR="${SUNWUTLIB}/prototype"

#
# List of files to be updated by utrepair
#
MODFILES="/usr/dt/config/Xstartup  /usr/dt/config/Xsetup  /usr/dt/config/Xreset  /usr/openwin/server/etc/OWconfig  /etc/inet/services  /etc/inet/inetd.conf"

if [ -x ${SUNWUTLIB}/utrepair ]; then
	
	#
	# Build the argument list for utrepair
	#
	repairargs="-a -d ${PROTODIR} ${MODFILES}"

	${SUNWUTLIB}/utrepair ${repairargs}
fi

#
# Edit pam.conf to add a line for utnsclogin authentication.
# If it already exists, then leave it as is.
#

ETCFILE="/etc/pam.conf"

isconf=`sed -n  's/^.*utnsclogin//p' $ETCFILE`

if [ -z "$isconf" ]
then
        echo "utnsclogin auth required   /usr/lib/security/pam_unix.so.1" >> $ETCFILE
fi

exit 0;
