#!/bin/sh
if [ "$NOS" = "" ]
then
	echo "The variable NOS must be set to where you want the "
	echo "KA9Q unix NOS software to be installed."
	echo "If you are using /bin/sh use the command NOS xxxxx; export NOS"
	echo "Where xxxxx is the directory path where the net software"
	echo "installed.  If you are using /bin/csh use the command"
	echo " setenv NOS xxxxx"
	echo ""
	exit 1
fi
echo "The following directories and files will be created:"
echo "     $NOS/bin                         where the program is"
echo "     $NOS/public                      where transfer files are"
echo "     $NOS/bin/netserv                 the program"
echo "     $NOS/startup.nos                 the startup file"
echo "     $NOS/finger/n6xjj.txt            a finger example file"
echo "     $NOS/Domain.txt                  a sample domain file"
echo "     $NOS/ftpusers                    what users can ftp in"
echo

if [ ! -d "$NOS/bin" ]
then
	mkdir $NOS/bin
fi
if [ ! -d "$NOS/public" ]
then
	mkdir $NOS/public
fi
if [ ! -d "$NOS/finger" ]
then
	mkdir $NOS/finger
fi
if [ ! -f "netserv" ]
then
	echo "Making depend.out file"
 	if [ ! -f "depend.out" ]
	then
		>depend.out
	fi
	make depend
fi
echo "Checking and making necessary files"
make 

echo 
echo
echo "Copying files into their correct locations"

cp netserv $NOS/bin
cp ftp $NOS/bin
cp ping $NOS/bin
cp connect $NOS/bin
cp asy_rx $NOS/bin
cp finger $NOS/bin
cp nostimer $NOS/bin
cp telnet $NOS/bin
cp n6xjj.txt $NOS/finger
cp startup.net $NOS
cp domain.txt $NOS
cp ftpusers $NOS

echo
echo
echo "The installation of KA9Q net software is complete"
echo "Please edit the $NOS/startup.nos file for your configuration and"
echo "Amateur call sign.  Edit ftpusers for your group of users, "
echo "move and edit $NOS/finger/n6xjj.txt into $NOS/finger/yourcallsign.txt."
echo "Contact a packet person in your area for your current hosts.net/domain.txt"
echo "file.  "

exit 0
