#!/bin/sh
#pragma ident	"@(#)postinstall	1.6	98/10/06 SMI"
#
# Copyright (c) 1998, by Sun Microsystems, Inc.
# All rights reserved.
#

target=$PKG_INSTALL_ROOT/etc/krb5/kdc.conf
tmp=/tmp/k$$

if [ $KDC_CONF_REPLACE -eq 1 ]
then

	cat $target |
	sed "s/___default_realm___/$KDC_CONF_REALM/g" |
	sed "s/___ticket_life___/$KDC_CONF_TLIFE/g" |
	sed "s/___rticket_life___/$KDC_CONF_RLIFE/g" > $tmp

	if [ $? = 0 ]
	then
		cp $tmp $target
		rm -f $tmp
	else
		echo
		printf "`gettext 'Configuration of %s failed.'`\n" $target
		echo
		rm -f $tmp
		exit 1
	fi
fi

target=$PKG_INSTALL_ROOT/etc/krb5/kpropd.acl

if [ $KPROPD_ACL_REPLACE -eq 1 ]
then

	(
		echo host/${KPROPD_ACL_MASTER}@$KPROPD_ACL_REALM

		for i in $KPROPD_ACL_SLAVES
		do
			echo host/${i}@$KPROPD_ACL_REALM
		done
	)  > $tmp

	if [ $? = 0 ]
	then
		cp $tmp $target
		rm -f $tmp
	else
		echo
		printf "`gettext 'Configuration of %s failed.'`\n" $target
		echo
		rm -f $tmp
		exit 1
	fi
fi
 
exit 0
