#!/bin/sh
##############################################################################
# $Id$
##############################################################################
# Init script installed by JumpStart to install recommended patch cluster
# for this version of Solaris
##############################################################################
# $Log$
##############################################################################

echo
echo "Start of $0"
echo '  $Id$'

echo "  Installing Sun Recommended & Security patches for `uname -sr`"

mkdir -p /mnt/patches
mount watt.ee.washington.edu:/jumpstart/patches /mnt/patches

if [ -d $BASE/mnt/patches/`uname -r`_Recommended ]
then
	cd /mnt/patches/`uname -r`_Recommended
	./install_cluster -nosave -q
else
	echo "  Recommended patch directory for `uname -r` not found" >&2
	exit
fi

cd /
umount /mnt/patches
rmdir /mnt/patches

rm $0

# On department boxes, /usr/bin/passwd is replaced with a link to a shell
# script (/usr/bin/ssh_to_menu) which ssh's the user to the menu box.  It
# is not uncommon for there to be a patch which replaces passwd with an
# updated binary, thus overwriting our link.  This puts it back.
if [ -f /usr/bin/ssh_to_menu ]
then
	if [ ! -h /usr/bin/passwd ]
	then
		mv /usr/bin/passwd /usr/bin/passwd.orig
		chmod 700 /usr/bin/passwd.orig
		ln -s ssh_to_menu /usr/bin/passwd
	fi
fi

echo "End of $0, rebooting system"
reboot

