echo "Building logs"
if test ! -d /var/log/users ; then mkdir /var/log/users ; chmod 700 /var/log/users ; fi
if test ! -d /var/log/archive ; then mkdir /var/log/archive ; chmod 700 /var/log/archive ; fi
if test ! -f /var/log/users/login ; then echo -n >/var/log/users/login ; fi
if test ! -f /var/log/users/nologin ; then echo -n >/var/log/users/nologin ; fi
if test ! -f /var/log/users/download ; then echo -n >/var/log/users/download ; fi
if test ! -f /var/log/users/upload ; then echo -n >/var/log/users/upload ; fi
if test ! -f /usr/spool/uucp/modem.log ; then echo -n >/usr/spool/uucp/modem.log; fi
if test ! -f /var/log/users/doorway ; then echo -n >/var/log/users/doorway ; fi
if test ! -f /var/log/users/ipdemand ; then echo -n >/var/log/users/ipdemand ; fi

echo "Installing .conf"
mv $2/conf/* /usr/lib/tycho
rm -r $2/conf

echo "Installing browse"
if test ! -d /usr/lib/browse ; then mkdir /usr/lib/browse ; fi
mv $2/browse/* /usr/lib/browse
rm -r $2/browse

echo "Installing newuser"
if test ! -d /usr/lib/newuser ; then mkdir /usr/lib/newuser ; fi
mv $2/newuser/* /usr/lib/newuser
rm -r $2/newuser

echo "Installing goodbye"
if test ! -d /usr/lib/goodbye ; then mkdir /usr/lib/goodbye ; fi
mv $2/goodbye/* /usr/lib/goodbye
rm -r $2/goodbye

if test ! -d /usr/lib/news
then echo "You do not already have a news system.  Configuring VU BBS news!"
	 echo "You may later choose to install and use c-news or inn instead."
     if test ! -d /usr/lib/news ; then mkdir /usr/lib/news ; fi
	 if test ! -d /usr/spool/news ; then mkdir /usr/spool/news ; fi
	 chown news /usr/lib/news /usr/spool/news
	 cp $2/news/* /usr/lib/news
	 cp $2/news/news.conf /usr/lib/tycho
	 cp $2/news/news.cron /usr/spool/cron/crontabs/news
	 add_newsgrp local.announce y "Local System Announcements"
fi
rm -r $2/news

cat $2/vubbs.cron >>/usr/spool/cron/crontabs/root

echo "Installing rc.vubbs and commented out inittab stubs"
cp $2/rc.vubbs /etc/rc.d
cat $2/inittab >>/etc/inittab

echo "Installing terminal support"
cat $2/terminals/*.tcap >>/etc/termcap
cp $2/terminals/*.tic /usr/lib/terminfo
rm -r $2/terminals
cd /usr/lib/terminfo ; tic qnx2.tic ; tic ansipc.tic

cd /usr/lib/tycho

cp -f news.conf news.orig
cp -f mail.conf mail.orig
cp -f hello.conf hello.orig
cp -f feedback.conf feedback.orig

echo
echo "Please enter the fully qualified net mail name of your host computer.  For"
echo "example: spies.com,  nobody.UUCP, tycho.com, etc..."
echo -n "HOSTNAME: "
read LOCALHOST

sed s/LOCALHOST/${LOCALHOST}/ news.orig >news.conf
sed s/LOCALHOST/${LOCALHOST}/ mail.orig >mail.conf
sed s/LOCALHOST/${LOCALHOST}/ hello.orig >hello.conf
cp hello.conf hello.orig
cp menu.conf menu.orig
cp news.conf news.orig

echo
echo "Please enter the e-mail address for the system operator (usually 'root')" 
echo -n "SYSOP: "
read SYSOP

sed s/SYSOP/${SYSOP}/ feedback.orig >feedback.conf

echo
echo "Please enter the primary phone number for your BBS system"
echo -n "PHONE #: "
read PHONE

sed "s/PHONE/${PHONE}/" hello.orig >hello.conf
sed "s/PHONE/${PHONE}/" news.orig >news.conf
sed "s/PHONE/${PHONE}/" mail.orig >mail.conf
cp hello.conf hello.orig
cp news.conf news.orig
cp mail.conf mail.orig
cp menu.conf menu.orig

echo
echo "Please enter the name of your BBS system"
echo -n "BBSNAME: "
read BBSNAME

sed "s/BBSNAME/${BBSNAME}/" hello.orig >hello.conf
sed "s/BBSNAME/${BBSNAME}/" news.orig >news.conf
sed "s/BBSNAME/${BBSNAME}/" mail.orig >mail.conf
sed "s/BBSNAME/${BBSNAME}/" menu.orig >menu.conf
cp dscan.conf dscan.orig

# echo
# echo "Please enter path for public file area.  This can be the same as your" #echo "ftp file area if you wish"
# echo -n "PUBLIC: "
# read PUBLIC

# if test ! -d $PUBLIC ; then mkdir $PUBLIC ; fi

# sed "s/PUBLIC/${PUBLIC}/" dscan.orig >dscan.conf
# cp dscan.conf dscan.orig

# echo
# echo "Please enter path to public r/w upload directory.  This can be the same" echo "as your 'incoming' ftp directory."
# echo -n "UPLOAD: "
# read UPLOAD

# if test ! -d $UPLOAD ; then mkdir $UPLOAD ; chmod 777 $UPLOAD ; fi

# sed "s/UPLOAD/${UPLOAD}/" dscan.orig >dscan.conf

if test ! -f /bin/.login
then	echo
		echo "Do you wish to use VU BBS visual login for telnet access?"
		echo -n "(y/n): "
		read TELNET

		if test $TELNET = "y"
		then
			mv /bin/login /bin/.login
			ln -s /usr/sbin/doorway /bin/login
		fi
fi


	
