#!/bin/csh -f
#
# Network Installation Kit
#
# install.zephyr: install zhm
#
# Tom Coppeto
# MIT Network Group
# 17 September 1994
#
# Last Modified 10 November 1995 by jyp
#

set pltfrm = `/usr/bin/uname`

source $util/aliases

top:

vclear
vecho "INSTALL"
vecho ""
vecho "                            Zephyr"
vecho $bar
vecho ""
vecho ""
vecho "New files: "
vecho "               /etc/athena/zhm        /bin/athena/zstat"
vecho "               /bin/athena/zwrite     /bin/athena/zwgc"
vecho "               /bin/athena/zctl       /bin/athena/zlocate"

if ($pltfrm == "SunOS") then
	vecho "               /bin/athena/zinit      /bin/athena/zaway"
	vecho "               /bin/athena/znol"
endif

vecho "Modified files: "
if ($pltfrm == "SunOS") then
	vecho "               /etc/athena/rc.conf"
else
	vecho "               /etc/init.d/athena"
	vecho "               /etc/configs/zhm"
endif

vecho "Disk consumed:"
if ($pltfrm == "SunOS") then
	vecho "               /usr       958K"
else
	vecho "               /usr       1170K"
endif

vecho ""
df /usr | vcat
vecho ""
if ($interactive == true) then
	get_response "continue? (yes/no) " "yes" "no"
	if ($status == 2) then
		exit -1
	endif
endif

if ($preset_zinstall != "") then
	set zinstall = $preset_zinstall
else
	echo "You have the option of installing the zephyr clients"
        echo "on your local disk. Normally, these would be accessed"
        echo "through the afs file system."
        echo ""
        get_response "would you like these installed? (yes/no) " "yes" "no"
        if($status == 2) then
		set zinstall = no
	else
		set zinstall = yes
	endif
endif

vlog "**  running install.zephyr:"
vecho ""
vecho "     installing..."

#
# create directories
#

vecho "     creating directories and afs cache..."
if(! -d /bin/athena) mkdir /bin/athena
if(! -d /etc/athena) mkdir /etc/athena

#
# install binaries
#

vecho "     installing binaries..."
install -c -m 555 $zephyr/zhm /etc/athena
if ($zinstall == "yes") then
	install -c -m 555 $zephyr/zctl /bin/athena
	install -c -m 555 $zephyr/zlocate /bin/athena
	install -c -m 555 $zephyr/zstat /bin/athena
	install -c -m 555 $zephyr/zwgc /bin/athena
	install -c -m 555 $zephyr/zwrite /bin/athena
	if ($pltfrm == "SunOS") then
		install -c -m 555 $zephyr/zaway /bin/athena
		install -c -m 555 $zephyr/zinit /bin/athena
        	install -c -m 555 $zephyr/zleave /bin/athena
	endif
endif

if ($pltfrm == "IRIX") then
	install -c -m 644 $zephyr/zephyr.vars /etc/athena
	if (! -f /bin/athena/attach) install -c -m 4755 $afs/attach /bin/athena
	if (! -f /etc/athena/zinit) ln -s /bin/athena/attach /etc/athena/zinit
endif

vlog "     zephyr: installed binaries"

#
# configure rc.conf for SunOS (rc for IRIX)
#

vecho "     updating rc and version..."

if ($pltfrm == "SunOS") then
	install.rc
	config.rc ZCLIENT true
	version add ZephyrClient $zephyrversion
else
	config.rc zhm true
	version add ZephyrClient 1
endif

vlog "     zephyr: updated rc and version"
vecho "done."
vlog "zephyr: done"

if($interactive == true) then
	echo ""
	get_response "Press <return> to continue..." "<return>"
else
	sleep 5
endif

exit 0
