#!/bin/bash

#
# $Id: slxt_install,v 1.17 1998/02/15 10:10:27 root Exp root $
#
# Install SPARC-Linux Xterminal package.
#
## 
## Copyright (c) 1997, 1998  John Little (gaijin@pobox.com)
## 
## Permission is hereby granted, free of charge, to any person obtaining a
## copy of this software and associated documentation files (the "Software"),
## to deal in the Software without restriction, including without limitation
## the rights to use, copy, modify, merge, publish, distribute, sublicense,
## and/or sell copies of the Software, and to permit persons to whom the
## Software is furnished to do so, subject to the following conditions:
## 
## The above copyright notice and this permission notice shall be included
## in all copies or substantial portions of the Software.
## 
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
## OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
## ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
## OTHER DEALINGS IN THE SOFTWARE.
##
#

set -h;
##set -x;					## Debug flag.

PATH=/bin:/usr/bin:/usr/sbin:/sbin;
PROGNAME=${0};
NAME=`basename ${PROGNAME}`;
export PATH NAME;

AWK=gawk;

REQ_FREE=7;					## Space required (MB).
FS_COUNT=0;
LC_REAL=;
#
#
################################################################################
#
PACKAGE_LIST=" \
	./add_xterm \
	./._functions.sh \
	./._hosts_update.sh \
	./rc.xterm \
	./Xaccess.Template \
	./Xsetup.Template \
	./xdm-config.Template \
	./Xservers.Template \
	./Xsession.Template \
	./Xresources.Template \
	./Ethers.Template \
	./SLXT.tar.gz \
";
ERROR_COUNT=0;
for FILE in ${PACKAGE_LIST};	do
	if [ ! -s ${FILE} ];	then
		echo -e "\a\n\tPackage incomplete. Missing: ${FILE}.";
		ERROR_COUNT=1;
	fi
done
[ ${ERROR_COUNT} -gt 0 ] && exit 255;

#include
. ./._functions.sh;						## Function lib.
. ./._hosts_update.sh;						## Function lib.

TFTP_DEFAULT=/tftpboot;
TFTPD_BIN=in.tftpd;
TCPD_BIN=/usr/sbin/tcpd;
INETD_TFTP=;
INETD_CONF=/etc/inetd.conf;
ETC_EXPORTS=/etc/exports;
ETC_ETHERS=/etc/ethers;
RC_LOCAL=/etc/rc.d/rc.local;
RC_XTERM=/etc/rc.d/rc.xterm;
RC_TEMPLATE=./rc.xterm;
ETHERS_TEMPL=./Ethers.Template;
CLIENT_TAR=./SLXT.tar.gz;
XTREE_HEAD=/usr/X11;
SCRIPT_DIR=/usr/local/bin;

X_TEMPLATES="xdm-config Xresources Xservers Xsession Xaccess";
X_SETUP_TEMPL="Xsetup.Template";

SUPPORT_SCRIPTS="._functions.sh ._hosts_update.sh add_xterm";

Header(){
	cat >/dev/tty <<- EO_HEAD


   This is the SPARC-Linux Xterminal package installation stage. You can
   abort from this program at almost any time by typing <CTRL>C
   (holding down the "Ctrl" key and hitting the "c" key). The exception
   to this is once the dialogue has been completed and the install program
   begins to create files and directories. At that point <CTRL>C will
   be disabled.

   NOTE:- Portions of this package are redistributed under the GNU General
          Public Licence. Please see the file "COPYING" for details.

	EO_HEAD
}

TFTP_Head(){
	cat > /dev/tty <<- EO_TFTP

   The TFTP directory is where the client filesystem will reside, as well
   as the SPARC-Linux kernel and the boot-link for each client machine.
   Other than the addition of a single link for each Xterminal client, this
   directory will not grow in size, but you do need approximately 10MB of
   space for the initial installation.

   Please note that while the TFTP directory can reside anywhere in the
   directory structure, a symbolic link from /tftpboot to it MUST exsist.
   This link will be created automatically by this install program.

	EO_TFTP
}

Get_Free(){
	FILESYS=`df -k -t ext2`;
	[ ${?} -ne 0 -o -z "${FILESYS}" ] && \
		Fatal "Unable to identify any local, ext2 filesystems.";
	eval `echo "${FILESYS}" | ${AWK} '
	BEGIN {	REQ_FREE	= "'${REQ_FREE}'" * 1024;
		FS_COUNT	= 0 + 0;
	}
	/^#/ || /^$/ || /^Filesys/ { next; }
	$4 > REQ_FREE {
			FS_COUNT++;
			FSNAME[FS_COUNT]	= $6;
	}
	END {
		if (FS_COUNT > 0) {
			printf("FS_COUNT=%d;\n", FS_COUNT);
			for (i=1; i<=FS_COUNT; i++) {
				printf("FS_FREE=\"${FS_FREE}\"\"%s \";\n",
								FSNAME[i]);
			}
		}
	}'`
	return ${?};
}

#
# Check the /etc/inetd.conf file for an existing TFTP dir specification.
#
# Returns "0" for an existing TFTP directory and "1" for none.
#
Check_Inetd(){
	[ ! -f ${INETD_CONF} ] && \
		Fatal "No ${INETD_CONF} file. Cannot continue.";
	
	INETD_TFTP=`cat ${INETD_CONF} | egrep -v "^#" | egrep -w "in.tftpd"`;
	case ${?} in
		0)	TFTP_InUse "${INETD_TFTP}";
			return ${?};;

		1)	return 1;;

		*)	Fatal "Could not get TFTP info from ${INETD_CONF}.";;
	esac
}

Check_TFTP(){
	TFTP_DIR=;
	Check_Inetd;
	if [ ${?} -ne 0 ];	then
		if [ ! -d ${TFTP_DEFAULT} -a ! -L ${TFTP_DEFAULT} ];	then
			return 1;
		elif [ -L ${TFTP_DEFAULT} ];	then
			Link_Check ${TFTP_DEFAULT};
			case ${?} in
				0)	TFTP_DIR=${LC_REAL}; LC_REAL=;
					return 0;;
				*)	cat >/dev/tty <<- EO_BADLNK

   Although ${TFTP_DEFAULT} exists, it appears to be a link to a non
   existent directory (or to an ordinary file). Please fix this problem
   and then restart the installation program (the SPARC-Linux Xterminal
   client MUST be able to access /tftpboot, even if it is only a link
   to the real tftpboot directory).
					EO_BADLNK
					Fatal "Bad /tftpboot link.";;
			esac
		else
			TFTP_DIR=${TFTP_DEFAULT};
		fi
	else
		return 0;
	fi
}

#
TFTP_InUse(){
	[ ${#} -ne 1 -o -z "${1}" ] && Fatal "Bad arg passed to TFTP_InUse().";
	TFTP_LINE="${1}";
	TFTP_LOC=`echo "${TFTP_LINE}" | ${AWK} '{i=NF; print $i}'`;
	[ ${?} -ne 0 -o -z "${TFTP_LOC}" ] && \
		Fatal "Could not determine TFTP location: ${TFTP_LINE}.";
	if [ ! -d ${TFTP_LOC} ];	then
		cat >/dev/tty <<- EO_NOTFTP

   Bad ${INETD_CONF} entry. The tftpd line specifies a non-existent
   directory:-

     ${TFTP_LINE}

   Please fix (or comment out) this entry and restart the installation
   program.

   NOTE:- You should also check the /etc/exports file for a spurious
          /tftpboot entry before restarting.

		EO_NOTFTP
		Fatal "Bad ${INETD_CONF} entry.";
	fi
	TFTP_DIR=${TFTP_LOC};
	return 0;
}
	
Get_TFTP(){
	Check_TFTP;
	if [ ! -z "${TFTP_DIR}" ];	then
		Totty "Found an existing TFTP dir: ${TFTP_DIR}.";
		cat >/dev/tty <<- EO_USE_TFTP
	
   -WARNING- If you use this directory as the install directory for
   your SPARC-Linux Xterminals, it is possible that any existing 
   diskless or Xterminal configurations might be overwritten. If you
   are quite sure that this is permissible then continue, otherwise
   you should abort the installation now and make a back-up of the
   existing ${TFTP_DIR} directory, or move it to another location.

		EO_USE_TFTP

		YorN "Continue?";
		[ ${?} -ne 0 ] && exit 0;
	else
		while [ "${TFTP_DIR:-NoTSeT}" = "NoTSeT" ];	do
			echo -n "	TFTP Directory: "	>/dev/tty;
			read TFTP_DIR				</dev/tty;

			if [ `basename "${TFTP_DIR:-NoTSeT}"` != "tftpboot" ];
			then
				cat >/dev/tty <<- EO_NMERR

   Please choose a TFTP directory name ending in "tftpboot". While this
   is not strictly essential, it will make administration simpler.

				EO_NMERR
				TFTP_DIR=;
			fi
		done
	fi

	TFTP_TOP=`dirname ${TFTP_DIR}`;
        if [ ! -d ${TFTP_TOP} ];	then
		cat >/dev/tty <<- EO_TOP_ERR

   ${TFTP_TOP} does not exist. Please create it and restart the install
   program,  or choose another TFTP install directory.

		EO_TOP_ERR
		exit 255;
	fi

	#
	# Check that the selected TFTP directory is on a filesystem
	# with enough free space.
	#
	TFTP_FS=`df -t ext2 ${TFTP_TOP} | \
		${AWK} '$1 !~ /^Filesystem/ {i=NF; print $i}'`;
	[ ${?} -ne 0 -o -z "${TFTP_FS}" ] &&
		Fatal "Could not ascertain filesystem for ${TFTP_DIR}.";
	SEL_FS=0;
	for FS in ${FS_FREE};	do
		if [ "${FS}" = "${TFTP_FS}" ];	then
			SEL_FS=`expr ${SEL_FS} + 1`;
		fi
	done
	case ${SEL_FS} in
		0)	Fatal \
			"No space in ${TFTP_FS}. Choose again from list.";;

		1)	return 0;;

		*)	Fatal "${TFTP_FS} matches multiple filesystems.";
	esac
}

Crt_TFTP_Dir(){
	if [ ! -d ${TFTP_DIR} ];	then
		mkdir ${TFTP_DIR};
		[ ${?} -ne 0 ] && \
			Fatal "Could not create TFTP dir: ${TFTP_DIR}.";
	fi
	if [ "${TFTP_DIR}" != "${TFTP_DEFAULT}" -a \
				! -L ${TFTP_DEFAULT} ];	then
		ln -s ${TFTP_DIR} /;
		[ ${?} -ne 0 ] && Fatal "Could not link ${TFTP_DIR} to /";
	fi
	return 0;
}

Update_RCLocal(){
	[ ! -f ${RC_LOCAL} ] && Fatal "Cannot locate file: ${RC_LOCAL}.";
	[ ! -w ${RC_LOCAL} ] && Fatal "Cannot write to: ${RC_LOCAL}.";

	Totty "Installing ${RC_XTERM}...";
	[ ! -r ${RC_TEMPLATE} ] && \
			Fatal "${RC_TEMPLATE} system start-up file not found.";
	if [ -f ${RC_XTERM} ];	then
		diff ${RC_XTERM} ${RC_TEMPLATE} >/dev/null 2>&1;
		if [ ${?} -ne 0 ];	then
			Save_Original ${RC_XTERM};
			[ ${?} -ne 0 ] && \
				Fatal "Save of original failed: ${RC_XTERM}.";
		fi
		chmod -x ${RC_XTERM}_*	>/dev/null 2>&1;
	fi
	cp ${RC_TEMPLATE} ${RC_XTERM};
	[ ${?} -ne 0 ] && Fatal "Installation of ${RC_XTERM} failed.";
	chmod +x ${RC_XTERM} >/dev/null 2>&1;
	[ ${?} -ne 0 ] && Error "Please add execute perms to: ${RC_XTERM}.";
	
	Totty "Updating ${RC_LOCAL}...";
	RC_FILE_ENTRY=`cat ${RC_LOCAL} | egrep -v "^#" | egrep ${RC_XTERM}`;
	if [ ${?} -eq 0 -a ! -z "${RC_FILE_ENTRY}" ];	then
		Totty "NOTE: An ${RC_LOCAL} entry already exists:-";
		echo -e "\t\t${RC_FILE_ENTRY}"		>/dev/tty;
		echo -en "\n\n<CR> to continue: "	>/dev/tty;
		read < /dev/tty >/dev/null;
		echo " "				>/dev/tty;
		return 0;
	fi
	RC_INFO=`echo -en "\n#\n#\tSPARC-Linux Xterminal Support.\n#\tLines"`;
	RC_INFO=`echo -en "${RC_INFO} added by ${NAME}.\n#\n[ -x ${RC_XTERM}"`;
	RC_INFO=`echo -e  "${RC_INFO} ] && ${RC_XTERM}"`;
	
	Save_Original ${RC_LOCAL};
	[ ${?} -ne 0 ] && Fatal "Cannot continue. Save failed: ${RC_LOCAL}.";
	chmod -x ${RC_LOCAL}_* >/dev/null 2>&1;
	echo "${RC_INFO}" >> ${RC_LOCAL};
	[ ${?} -ne 0 ] && Fatal "Update of ${RC_LOCAL} failed.";
	return 0;
}
	
Update_InetdConf(){
	[ ${#} -ne 1 -o -z "${1}" ] && \
		Fatal "Bad arg passwd to Update_InetdConf().";
	[ ! -w ${INETD_CONF} ] && Fatal "Cannot write to ${INETD_CONF}.";
	[ ! -x /usr/sbin/${TFTPD_BIN} ] && \
		Fatal "/usr/sbin/${TFTPD_BIN} not executable. Cannot continue.";

	Totty "Updating ${INETD_CONF}...";
	#
	# Modify the inetd.conf entry depending upon whether the TCPD
	# wrapper is avaiable or not.
	#
	INETD_INFO=`echo -e "#\n#\tLines added by \"${NAME}\" program.\n#"`;
	INETD_INFO=`echo -e "${INETD_INFO}\ntftp\tdgram\tudp\twait\tnobody\t"`;
	if [ -x ${TCPD_BIN} ];	then
		INETD_INFO="${INETD_INFO} ${TCPD_BIN} ${TFTPD_BIN} ${TFTP_DIR}";
	else
		INETD_INFO="${INETD_INFO} /usr/sbin/${TFTPD_BIN} ${TFTP_DIR}";
	fi

	Save_Original ${INETD_CONF};
	[ ${?} -ne 0 ] && Fatal "Cannot continue. Save failed: ${INETD_CONF}.";
	echo "${INETD_INFO}" >> ${INETD_CONF};
	[ ${?} -ne 0 ] && Fatal "Update of ${INETD_CONF} failed.";
	return 0;
}

Update_EExports(){
	[ ${#} -ne 1 -o -z "${1}" ] && \
		Fatal "Bad arg passwd to Update_EExports().";
	EE_FILE=${1};
	
	Totty "Updating ${EE_FILE}...";
	[ ! -f ${EE_FILE} ] && touch ${EE_FILE};
	[ ! -w ${EE_FILE} ] && Fatal "Cannot write to ${EE_FILE}.";
	EE_FILE_ENTRY=`cat ${EE_FILE} | egrep -v "^#" | egrep ${TFTP_DIR}`;
	if [ ${?} -eq 0 ];	then
		cat >/dev/tty <<- EO_EXP

   << P L E A S E   N O T E >>

   There is already an entry in the ${EE_FILE} file for
   ${TFTP_DIR}. 

               ${EE_FILE_ENTRY}

   Please make sure that your client has mount permissions, otherwise 
   the boot sequence will fail. If your client fails to mount the root 
   directory it will then attempt to mount a floppy as the root 
   filesystem. This will always fail, but it is a good indicator that 
   the ${EE_FILE} entry is incorrect. If this happens, you should
   manually edit the file to allow your client mount access.

		EO_EXP
		echo -en "\n<CR> to continue: "		>/dev/tty;
		read < /dev/tty >/dev/null;
		echo " "				>/dev/tty;
		return 0;
	fi
	EE_INFO=`echo -e "#\n#\tLines added by \"${NAME}\" program.\n#"`;
	EE_INFO=`echo -e "${EE_INFO}\n${TFTP_DIR}\t(ro,all_squash)\n"`;

	Save_Original ${EE_FILE};
	[ ${?} -ne 0 ] && Fatal "Cannot continue. Save failed: ${EE_FILE}.";
	echo "${EE_INFO}" >> ${EE_FILE};
	[ ${?} -ne 0 ] && Fatal "Update of ${EE_FILE} failed.";
	return 0;
}

Check_Free() {
	Get_Free;
	[ ${?} -ne 0 ] && Error "Filesystem information may be incorrect.";

	if [ ${FS_COUNT} -gt 0 ];	then
		Totty "These filesystems have enough free space:-"
		for FS in ${FS_FREE};	do
			echo -e "\t\t\t\t- ${FS}";
		done
		Totty "";
	else
		cat > /dev/tty <<- EO_SPACE

   There are no filesystems with enough available space for the
   installation of this package. Please free up some space and run 
   this installation program again.

		EO_SPACE
		exit 255;
	fi
}

#
# This is just a cursory check for the existence of an X11 directory
# structure.
#
Check_XTree(){
	[ ${#} -ne 1 -o -z "${1}" ] && Fatal "Bad arg passed to Check_XTree().";
	CXT_DIR=${1};
	pushd ${CXT_DIR} >/dev/null 2>&1;
	if [ ${?} -ne 0 ];	then
		cat >/dev/tty 2>&1 <<- EO_X11

   The default X11 directory ${CXT_DIR} does not seem to be accessible.
   If you have X11 installed in a different directory then please make a
   symbolic link between that directory and ${CXT_DIR}. The SPARC-Linux
   Xterminal package requires access to the X11 tree at that location.
		EO_X11
		popd >/dev/null 2>&1;
		Fatal "Cannot access X11 tree.";
	fi
	if [ ! -d ./bin -o ! -d ./lib ];	then
		cat >/dev/tty 2>&1 <<- EO_XINC

   The X11 directory structure at ${CXT_DIR} seems to be incomplete. The
   SPARC-Linux Xterminal package requires that the server have an X11R6
   installation, including the XDM and the XFS (X-Font-Server) packages.

   If your "live" X11 tree does not reside in ${CXT_DIR}, then please 
   make a symbolic link between the real location and ${CXT_DIR} and then
   restart the installation program.
		EO_XINC
		popd >/dev/null 2>&1;
		Fatal "Incomplete or corrupt X11 directory tree.";
	fi
	popd >/dev/null 2>&1;
	return 0;
}

Unpack_ClientFS(){
	[ ${#} -ne 1 -o -z "${1}" ] && \
		Fatal "Bad arg passed to Unpack_ClientFS().";
	UCFS_DIR=${1};
	[ ! -d ${UCFS_DIR} ] && Fatal "Cannot access directory: ${UCFS_DIR}.";
	[ ! -r ${CLIENT_TAR} ] && Fatal "Cannot read tarfile: ${CLIENT_TAR}.";
	pushd ${UCFS_DIR} >/dev/null 2>&1;
	[ ${?} -ne 0 ] && Fatal "Unaccessible directory: ${UCFS_DIR}.";
	popd >/dev/null 2>&1;

	Totty "Unpacking client tarfile into ${UCFS_DIR}...";
	gunzip -c ${CLIENT_TAR} | ( cd ${UCFS_DIR} ; tar xvpf - );
	[ ${?} -ne 0 ] && Fatal "Unpack of client files failed.";
	return 0;
}

Install_Ethers(){
	Totty "Installing ${ETC_ETHERS}...";
	if [ -s ${ETC_ETHERS} ];	then
		Totty "${ETC_ETHERS} already exists.";
		return 0;
	fi
	cp ${ETHERS_TEMPL} ${ETC_ETHERS};
	[ ${?} -ne 0 ] && return 2;
	return 0;
}

#
# Install the X-Template files in the XDM directory. If there are existing
# files, save them to a back-up file before overwriting.
#
Install_XSupport(){
	[ -z "${X_TEMPLATES}" ] && Fatal "No templates in list. Bad package.";
	Totty "Installing XDM support files...";
	for X_FILE in ${X_TEMPLATES};	do
		if [ ! -f ./${X_FILE}.Template ];	then
			Error "Template file ${X_FILE}.Template missing.";
			continue;
		else
			XTEMPL=./${X_FILE}.Template;
			XTARG=${XTREE_HEAD}/lib/X11/xdm/${X_FILE};
		fi
		if [ -f ${XTARG} ];	then
			diff ${XTARG} ${XTEMPL} >/dev/null 2>&1;
			if [ ${?} -ne 0 ];	then
				Save_Original ${XTARG};
				[ ${?} -ne 0 ] && \
					Fatal "Save of ${XTARG} failed.";
			fi
		fi
		cp ${XTEMPL} ${XTARG};
		[ ${?} -ne 0 ] && Error "Update of ${XTARG} failed.";
		chmod +x ${XTARG} >/dev/null 2>&1;
	done
	XSU_XTEMPL=${XTREE_HEAD}/lib/X11/xdm/${X_SETUP_TEMPL};
	if [ -f ${XSU_XTEMPL} ];	then
		diff ${XSU_XTEMPL} ./${X_SETUP_TEMPL} >/dev/null 2>&1;
		if [ ${?} -ne 0 ];	then
			Save_Original ${XSU_XTEMPL};
			[ ${?} -ne 0 ] && \
				Fatal "Save of ${XSU_XTEMPL} failed.";
		fi
	fi
	cp ./${X_SETUP_TEMPL} ${XSU_XTEMPL};
	[ ${?} -ne 0 ] && Error "Update of ${XSU_XTEMPL} failed.";
	return 0;
}

Install_Scripts(){
	[ -z "${SUPPORT_SCRIPTS}" ] && Fatal "Script list empty. Bad package.";
	for S_FILE in ${SUPPORT_SCRIPTS};	do
		[ ! -f ./${S_FILE} ] && Fatal "Script file ${S_FILE} missing.";
		STARG=${SCRIPT_DIR}/${S_FILE};
		if [ -f ${STARG} ];	then
			diff ${STARG} ./${S_FILE} >/dev/null 2>&1;
			if [ ${?} -ne 0 ];	then
				Save_Original ${STARG};
				[ ${?} -ne 0 ] && \
					Fatal "Save of ${STARG} failed.";
			fi
		fi
		cp ./${S_FILE} ${STARG};
		[ ${?} -ne 0 ] && Error "Update of ${STARG} failed.";
		case "${S_FILE}" in
			._*)	continue;;		## Function libs.

			*)	chmod +x ${STARG} >/dev/null 2>&1;;
		esac
	done
	return 0;
}

#
# Now that we have all of the information and all of the checks are
# done, attempt to do the actual writes.
#
Do_Install(){
	Crt_TFTP_Dir;
	[ -z "${INETD_TFTP}" ] && Update_InetdConf "${TFTP_DIR}";
	Unpack_ClientFS "${TFTP_DIR}";
	Install_Ethers;
	Update_EExports "${ETC_EXPORTS}";
	Update_RCLocal;

	Install_XSupport;
	Install_Scripts;
}

#
################################################################################
#
#  main()
#
################################################################################
#
clear;
Check_UID;
Header;
YorN "Continue?";
[ ${?} -ne 0 ] && exit 0;
Totty "Checking X11 installation...";
Check_XTree ${XTREE_HEAD};
Totty "Done."
TFTP_Head;
YorN "Continue?";
[ ${?} -ne 0 ] && exit 0;
Totty "Checking disk space...";
Check_Free;
Get_TFTP;

#
#  Actual update starts from here...
#
cat >/dev/tty <<- EO_INST

   About to start actual install operations. From this point onwards
   the install program will write the updated information you have
   just supplied and install the SPARC-Linux package. You will not be
   able to interrupt the install process after this point.
EO_INST
YorN "Continue?";
[ ${?} -ne 0 ] && exit 0;
trap "" 1 2 3 15;
Do_Install;
trap 1 2 3 15;
Totty;
cat > /dev/tty <<- EO_INSTALL

   The SPARC-Linux Xterminal package install is now complete. 

   You need to re-boot your system to ensure that the XDM (X Display
   Manager), XFS (X Font Server), ARP/RARP and NFS/mountd services
   are all started correctly and that the client filesystem is exported.

   After re-booting, run the program "add_xterm" to configure a SPARC
   machine as an Xterminal client of this server.
EO_INSTALL

Totty "Done.";
exit 0;
