# Copyright (c) 1995 by the Student Information Processing Board
# 	  of the Massachusetts Institute of Technology
#  
# Permission to use, copy, modify, and distribute this software
# and its documentation for any purpose and without fee is
# hereby granted, provided that the above copyright notice
# appear in all copies and that both that copyright notice and
# this permission notice appear in supporting documentation,
# and that the names of M.I.T. and the M.I.T. S.I.P.B. not be
# used in advertising or publicity pertaining to distribution
# of the software without specific, written prior permission.
# M.I.T. and the M.I.T. S.I.P.B. make no representations about
# the suitability of this software for any purpose.  It is
# provided "as is" without express or implied warranty.
#
#	$Id: subscribe.sh,v 1.3 1995/12/26 10:27:35 ghudson Exp ghudson $
#	$Source: /mit/netbsd/dev/install/server/RCS/subscribe.sh,v $

# /tmp/vars outputs:
#	subscribed	whether user subscribed to netbsd-announce

. /utils

echo ""
echo "SIPB maintains a low-traffic mailing list netbsd-announce@mit.edu for"
echo "announcements about the NetBSD Athena port and NetBSD at MIT in general."
echo "As a convenience, you may get Kerberos tickets and subscribe to"
echo "netbsd-announce from this script."
echo ""
echo -n "Would you like to subscribe to netbsd-announce? [yes] "
yesno yes

if [ "$resp" = yes ]; then
	# Get username
	echo ""
	username=
	while [ "$username" = "" ]; do
		echo -n "What is your username? "
		read username
	done

	trap "break" 2
	export KRBTKFILE="/tmp/tkt_${username}_null"
	while [ ! -f "$KRBTKFILE" ]; do
		/etc/athena/gettime -s time > /dev/null
		kinit "$username"
	done
	trap 2

	if [ -f "$KRBTKFILE" ]; then
		echo -n "Subscribing... "
		blanche -a $username netbsd-announce
		echo "done."
		kdestroy
		subscribed="yes ($username)"
	fi
fi

cat >> /tmp/vars << EOM
subscribed="$subscribed"
EOM

