#!/bin/ksh

BASEDIR=$(readlink -f "$0")
BASE=$(dirname "$BASEDIR")
FIPER_HOME=`cd "$BASE/../.."; \pwd`
export FIPER_HOME

cd $FIPER_HOME/..
mkdir -p config
cd config

touch DSLicSrv.txt
dslsFile=$FIPER_HOME/../config/DSLicSrv.txt


if [ "$1" != "" ] ; then
	server1=$1
	count="$(echo "$server1" | grep -o ":" | wc -l)"
	if [ "$count" == "1" ] ; then
		if [ -f $dslsFile ] ; then 
			echo "$server1" > "$dslsFile"
		fi
	else
		if [ -f $dslsFile ] ; then 
			echo "$server1:4085" > "$dslsFile"
		fi
	fi
fi

if [ "$2" != "" ] ; then
	server2=$2
	count="$(echo "$server2" | grep -o ":" | wc -l)"
	if [ "$count" == "1" ] ; then
		if [ -f $dslsFile ] ; then 
			echo "$server2" >> "$dslsFile"
		fi
	else
		if [ -f $dslsFile ] ; then 
			echo "$server2:4085" >> "$dslsFile"
		fi
	fi
fi

if [ "$3" != "" ] ; then
	server3=$3
	count="$(echo "$server3" | grep -o ":" | wc -l)"
	if [ "$count" == "1" ] ; then
		if [ -f $dslsFile ] ; then 
			echo "$server3" >> "$dslsFile"
		fi
	else
		if [ -f $dslsFile ] ; then 
			echo "$server3:4085" >> "$dslsFile"
		fi
	fi
fi


touch licenseSystem.dat
licenseFile=$FIPER_HOME/../config/licenseSystem.dat
echo DSLS > "$licenseFile"

