#!/bin/sh
# $Header: /mit/layerdev/src/conf/decmips/RCS/login.add,v 1.2 1995/08/26 15:35:12 brlewis Exp $

STATE=$1
SRCDIR=$2

# Make /bin/csh be athena tcsh.  XXX Should we?
if [ ! -f /bin/csh.ultrix ]; then
	mv /bin/csh /bin/csh.ultrix
	ln -s /bin/athena/tcsh /bin/csh
fi

# Let login screen show that this is Layered Athena
if [ ! -f /etc/athena/login/bitmaps/owl.normal ]; then
	mv /etc/athena/login/bitmaps/owl /etc/athena/login/bitmaps/owl.normal
else
	rm -f /etc/athena/login/bitmaps/owl
fi
cp $SRCDIR/bitmaps/owl /etc/athena/login/bitmaps/owl


# Fix /etc/ttys

cat << EOL > /tmp/tty.line
console	"/etc/athena/dm /etc/athena/login/config ttyqf"	ansi on secure	
EOL

grep "^console" /etc/ttys > /tmp/tty.old

if cmp -s /tmp/tty.line /tmp/tty.old; then
	: nothing
else
	ed /etc/ttys << EOF
/^console/s/^/#/
/^:0/s/^/#/
/ttyqf/s/$/	secure/
w
q
EOF
	cat /tmp/tty.line >> /etc/ttys
fi

if [ ! -f /etc/athena/login/config ]; then
	cp -p $SRCDIR/etc/athena/login/config /etc/athena/login/config
	ed /etc/athena/login/config << EOF
/Xws/s/#X/X/
s,/etc/Xws,/usr/bin/Xws,
/^console/s/^/#/
/#ULTconsole/s/#ULT//
/^login/s/^/#/
/#ULT100login/s/#ULT100//
w
q
EOF
fi

# kill -HUP 1

exit 0
