# Copyright 1998-2003 Sun Microsystems, Inc. All Rights Reserved.
# @(#)preremove	1.3	04/07/03	SMI

if [ -z "$PKG_INSTALL_ROOT" ]; then
  PKG_INSTALL_ROOT=""
fi

set -u

#
# Remove files created as side-effects of 
# scripts delivered by this package.
#

DIR="$PKG_INSTALL_ROOT/etc/opt/SUNWut"

/bin/rm -f $DIR/terminals \
	$DIR/auth.props.bu \
	$DIR/policy/utpolicy \
	$DIR/policy/utpolicy.bu

# 
# Run utrepair to remove modifications from 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="-r ${MODFILES}"

	${SUNWUTLIB}/utrepair ${repairargs} 
fi

#
# Edit pam.conf to remove any configuration for utnsclogin
# and utgulogin
#

NSCLOGIN=utnsclogin
GULOGIN=utgulogin
SRTAG="SunRay Server Software"

${SUNWUTLIB}/utpamcfg -u $NSCLOGIN -T "$SRTAG -- $NSCLOGIN"
${SUNWUTLIB}/utpamcfg -u $GULOGIN -T "$SRTAG -- $GULOGIN"

# Always succeeds
exit 0;
