#
#	Initialize variables 
#

TIADMIN=/usr/lib/ua/terminfo
TERMINFO=$TIADMIN/db
export TIADMIN TERMINFO

cd $TERMINFO

#
#	Mount the Terminfo Database disk
#

message -cu "Please insert the disk labeled\
\n\n\tTerminfo database\n\n"
if [ "$?" != "0" ]
then
	exit
fi

until 2>/dev/null mount /dev/fp021 /mnt -r && [ -f /mnt/att.ti ]
do
	dismount -f 1>/dev/null 2>&1
	clear
	message -cu "Please insert correct floppy, close door and try again !!"
	if [ "$?" != "0" ]
	then
		exit
	fi
done

#
#
#


#
#	Which Manufacturer
#

clear
eval set `shform -u $TIADMIN/MFG.menu`

if [ "$1" != "Enter" ]
then
	dismount -f 1>/dev/null 2>&1
	clear
	message -cu "Terminfo Database update canceled.\n\n\
You can remove the floppy now.\n"
	exit
fi

case "$2" in

"Adds" )
	TISRC=adds;;
"Ann Arbor" )
	TISRC=annarbor;;
"ANSI" )
	TISRC=ansi;;
"AT&T" )
	TISRC=att;;
"Beehive" )
	TISRC=beehive;;
"CDC" )
	TISRC=cdc;;
"Colorscan" )
	TISRC=colorscan;;
"Datamedia" )
	TISRC=datamedia;;
"DEC" )
	TISRC=dec;;
"Diablo" )
	TISRC=diablo;;
"Fortune" )
	TISRC=fortune;;
"General" )
	TISRC=general;;
"Hardcopy" )
	TISRC=hardcopy;;
"Hazeltine" )
	TISRC=hazeltine;;
"HDS" )
	TISRC=hds;;
"Heath" )
	TISRC=heath;;
"Home Brew" )
	TISRC=homebrew;;
"HP" )
	TISRC=hp;;
"LSI" )
	TISRC=lsi;;
"Microterm" )
	TISRC=microterm;;
"Misc" )
	TISRC=misc;;
"PC" )
	TISRC=pc;;
"Perkin Elmer" )
	TISRC=perkinelmer;;
"Print" )
	TISRC=print;;
"Special" )
	TISRC=special;;
"Sperry" )
	TISRC=sperry;;
"Tektronix" )
	TISRC=tektronix;;
"Teleray" )
	TISRC=teleray;;
"Televideo" )
	TISRC=televideo;;
"TI" )
	TISRC=ti;;
"Tymshare" )
	TISRC=tymshare;;
"Visual" )
	TISRC=visual;;
esac

#
#	Compile them all 
#
message -i "Entries being gathered from diskette\n\nPlease Stand By!!!" &

tic /mnt/$TISRC.ti 2>/dev/null

clear
kill $! 2>/dev/null

dismount -f 1>/dev/null 2>&1

#
#	Which terminals ???
#
eval set `shform -u $TIADMIN/$TISRC.m`

shift

for termname in $*
do
	find . -inum `getinum ?/$termname` -print |
	cpio -pdl /usr/lib/terminfo
done 2>/dev/null


clear
message -cu "All the selected entries have been installed.\
\nIt's all right to remove the floppy now."


#
#	Cleanup
#
rm -rf $TERMINFO/*


