#!/bin/bash

#
# Script to install the NC devkit
#
# Must be executed from the directory in which the devkit image
# has been unpacked or installed.
#
# Note that cygwin must already be installed before running this script.
#

#
# Install $ROOT files
#
if [ "x" == "x$ROOT" ]; then
	echo ROOT environment variable is not set.
	exit 1
fi

if [ ! -d $ROOT ]; then
	echo Directory $ROOT does not exist:  please create it before running this script.
	exit 1
fi

tar cf - usr nitro nitro_dwc | (cd $ROOT; tar xf -)

(cd $ROOT; ln -s usr/doc/index.html .)

#
# If NITROSDK_ROOT is defined, install the Nitro source
#
if [ "x" == "x$NITROSDK_ROOT" ]; then
	echo NITROSDK_ROOT environment variable is not set.
	echo Skip installation of NetCard updates to the Nitro SDK.
	exit 1
fi

echo Installing Nitro source into NITROSDK_ROOT
(cd nitro; tar cf - .) | (cd $NITROSDK_ROOT; tar xf -)

#
# If NITRODWC_ROOT is defined, install the NitroDWC source
#
if [ "x" == "x$NITRODWC_ROOT" ]; then
	echo NITRODWC_ROOT environment variable is not set.
	echo Skip installation of NetCard updates to the NitroDWC SDK.
	exit 1
fi

echo Installing NitroDWC source into NITRODWC_ROOT
(cd nitro_dwc; tar cf - .) | (cd $NITRODWC_ROOT; tar xf -)
