#!/bin/sh

if [ $# -lt 5 ]
then
	echo -e "Usage:\n\t$0 component_directory ci_file executable linkage component_name"
	exit 1
fi

RSC=`dirname \`echo $CTL_LOC|awk '{print $1}'\``
TMP=`mktemp /tmp/tmp.XXXXXX`

export PATH=$PATH:$RSC &&
cd $RSC &&
./deploy $1/$2 $1/$3 $4 $5 >$TMP 2>&1

if [ $? -ne 0 ]
then
	cat $TMP
else
	echo "Component '$5' added successfully."
fi

rm -f $TMP
