#!/bin/bash

# This script creates the basic tcpbw100.html page needed by
# the NDT server.
#
# First prompt the user for some local data variables, site name
# and location, email address and subject line for reports, and
# the local link connection info.
#
# Then create the html file using the tcpbw100.template file 
# modified by sed.
#
# Richard Carlson
# rcarlson@internet2.edu
# August 1, 2006
#

# bring in NPT functions for later use
ENV="env -i PATH=/lib/init:/bin:/sbin:/usr/bin"
. /lib/init/nptoolkit-functions.sh

echo "NPAD server configuration program.  "
echo ""

# using the config.py script that came with the NPAD tool
pushd /usr/local/npad-1.3
./config.py -p
make
make install
popd


mount_NPT_drives
select_NPT_drive

if [ "$DRVS" == "" ] ; then
	echo "Error: No drive available for customization files"
else
	cnt=0
	pushd /usr/local/npad-dist/www
	for DRV in $DRVS ; do
		save_NPT_file $DRV diag_form.html diag_form.html
		if [ $cnt == 1 ] ; then
			echo "Warning: multiple drives are being configured"
		fi
		echo "NPAD customization files are being saved to '$DRV'"
		/bin/tar -cjf /UNIONFS/media/$DRV/NPTools/npad-data.bz2 ServerData
		cnt=`expr $cnt + 1`
	done
	popd
fi

