#!/usr/bin/bash

# This Script is intended for a buildserver to run. 

# Check for NRS variable
if [ "$NRS_ROOT" = "" ]; then
        echo "Error: NRS_ROOT is not set. Using Default."
	exit
fi

# Check for NRS_PATH variable
if [ "$NRS_PATH" = "" ]; then
        echo "Error: NRS_PATH is not set. Using Default."
	exit
fi

# Check for NRS_PATH_VERSION variable
if [ "$NRS_PATH_VERSION" = "" ]; then
        echo "Error: NRS_PATH_VERSION is not set. Using Default."
	exit
fi

cp $NRS_ROOT/$NRS_PATH/config.$NRS_PATH_VERSION ./config
cp $NRS_ROOT/$NRS_PATH/makefile.$NRS_PATH_VERSION ./makefile
make auto

# This tells the build server what we created
echo "TARGET_PACKAGE=package/FirmwareMerge.$NRS_PATH_VERSION.zip" > return_val.txt
