#!/bin/sh
. ../../target.def
model_temp=`echo $MODEL | cut -f2 -d_`
#******************** Edimax ( 00 ) ********************
if [ "$1" = "edimax" ]; then	
	rm -rf ./web-gw/file ./web-gw/set.css ./web ./LINUX/config-gw.txt
	ln -s web-gw web
	cp -rf ./vsion-gw/edimax ./web/file
	if [ $? != 0 ]; then
		echo "copy file error!!"
		exit 1
	fi
	cp -f ./vsion-gw/edimax.css ./web/set.css
	if [ $? != 0 ]; then
		echo "copy file error!!"
		exit 1
	fi
	if [ "$MODEL" = "-D_6104K_" ] || [ "$MODEL" = "-D_6104KPS_" ] || [ "$MODEL" = "-D_6104KP_" ] || [ "$MODEL" = "-D_6104HS_" ]; then	#copy configure
		cp -f ./vsion-gw/config/config-6104k-edi.txt ./LINUX/config-gw.txt
	else
		cp -f ./vsion-gw/config/config-gw-edi.txt ./LINUX/config-gw.txt
	fi
	if [ $? != 0 ]; then
		echo "copy configure file error!!"
		exit 1
	fi
	rm -rf web/file/CVS
	mv web/file/index.asp web
	if [ "$MODEL" = "-D_6104WBB_" ] || [ "$MODEL" = "-D_6104IPC_" ] || [ "$MODEL" = "-D_6104WB_" ]; then #copy security
		cp -f ./vsion-gw/security/* ./web
	else
		if [ -f web/wlsec0.asp ]; then
			cd web
			rm -f wl1x.asp wlars.asp wlsec0.asp wlsec.asp wlpsk.asp wlwep.asp wlwsk.asp
		fi
	fi
	echo "Set version to $model_temp of English Edimax successfully..."
	exit 0
fi

#******************** Generic ( 01 ) ********************
if [ "$1" = "general" ]; then
	rm -rf ./web-gw/file ./web-gw/set.css ./web ./LINUX/config-gw.txt
	ln -s web-gw web
	cp -rf ./vsion-gw/general ./web/file
	if [ $? != 0 ]; then
		echo "copy file error!!"
		exit 1
	fi
	cp -f ./vsion-gw/general.css ./web/set.css
	if [ $? != 0 ]; then
		echo "copy file error!!"
		exit 1
	fi
	if [ "$MODEL" = "-D_6104K_" ] || [ "$MODEL" = "-D_6104KPS_" ] || [ "$MODEL" = "-D_6104KP_" ] || [ "$MODEL" = "-D_6104HS_" ]; then
		cp -f ./vsion-gw/config/config-6104k-edi.txt ./LINUX/config-gw.txt
	else
		cp -f ./vsion-gw/config/config-gw-edi.txt ./LINUX/config-gw.txt
	fi
	if [ $? != 0 ]; then
		echo "copy configure file error!!"
		exit 1
	fi
	rm -rf web/file/CVS
	mv web/file/index.asp web
	if [ "$MODEL" = "-D_6104WBB_" ] || [ "$MODEL" = "-D_6104IPC_" ] || [ "$MODEL" = "-D_6104WB_" ]; then #copy security
		cp -f ./vsion-gw/security/* ./web
	else
		if [ -f web/wlsec0.asp ]; then
			cd web
			rm -f wl1x.asp wlars.asp wlsec0.asp wlsec.asp wlpsk.asp wlwep.asp wlwsk.asp
		fi
	fi
	echo "Set version to $model_temp of English Generic successfully..."
	exit 0
fi

#******************** SimpGeneric ( 04 ) ********************
if [ "$1" = "simpGeneral" ]; then
	rm -rf ./web-gw-simplified/file ./web-gw-simplified/set.css ./web ./LINUX/config-gw.txt
	ln -s web-gw-simplified web
	cp -rf ./vsion-gw/simpGeneral ./web/file
	if [ $? != 0 ]; then
		echo "copy file error!!"
		exit 1
	fi
	cp -f ./vsion-gw/simpGeneral.css ./web/set.css
	if [ $? != 0 ]; then
		echo "copy file error!!"
		exit 1
	fi
	if [ "$MODEL" = "-D_6104K_" ] || [ "$MODEL" = "-D_6104KPS_" ] || [ "$MODEL" = "-D_6104KP_" ]; then
		cp -f ./vsion-gw/config/config-6104k-edi.txt ./LINUX/config-gw.txt
	else
		cp -f ./vsion-gw/config/config-gw-edi.txt ./LINUX/config-gw.txt
	fi
	if [ $? != 0 ]; then
		echo "copy configure file error!!"
		exit 1
	fi
	rm -rf web/file/CVS
	mv web/file/index.asp web
	if [ "$MODEL" = "-D_6104WBB_" ] || [ "$MODEL" = "-D_6104IPC_" ] || [ "$MODEL" = "-D_6104WB_" ]; then #copy security
		cp -f ./vsion-gw/security/* ./web
	else
		if [ -f web/wlsec0.asp ]; then
			cd web
			rm -f wl1x.asp wlars.asp wlsec0.asp wlsec.asp wlpsk.asp wlwep.asp wlwsk.asp
		fi
	fi
	echo "Set version to $model_temp of Simplified Chinese Generic successfully..."
	exit 0
fi

#******************** netmate ( 05 ) ********************
if [ "$1" = "netmate" ]; then
	rm -rf ./web-gw/file ./web-gw/set.css ./web ./LINUX/config-gw.txt
	ln -s web-gw web
	cp -rf ./vsion-gw/netmate ./web/file
	if [ $? != 0 ]; then
		echo "copy file error!!"
		exit 1
	fi
	cp -f ./vsion-gw/netmate.css ./web/set.css
	if [ $? != 0 ]; then
		echo "copy file error!!"
		exit 1
	fi
	rm -rf web/file/CVS
	mv web/file/index.asp web
	if [ "$MODEL" = "-D_6104K_" ] || [ "$MODEL" = "-D_6104KPS_" ] || [ "$MODEL" = "-D_6104KP_" ]; then
		cp -f ./vsion-gw/config/config-6104k-netmate.txt ./LINUX/config-gw.txt
	else
		cp -f ./vsion-gw/config/config-gw-netmate.txt ./LINUX/config-gw.txt
	fi
	if [ $? != 0 ]; then
		echo "copy configure file error!!"
		exit 1
	fi
	if [ "$MODEL" = "-D_6104WBB_" ] || [ "$MODEL" = "-D_6104IPC_" ] || [ "$MODEL" = "-D_6104WB_" ]; then #copy security
		cp -f ./vsion-gw/security/* ./web
	else
		if [ -f web/wlsec0.asp ]; then
			cd web
			rm -f wl1x.asp wlars.asp wlsec0.asp wlsec.asp wlpsk.asp wlwep.asp wlwsk.asp
		fi
	fi
	echo "Set version to $model_temp of English NETmate successfully..."
	exit 0
fi

#******************** planet ( 07 ) ********************
if [ "$1" = "planet" ]; then
	rm -rf ./web-gwp/file ./web-gwp/set.css ./web ./LINUX/config-gw.txt
	ln -s web-gwp web
	cp -rf ./vsion-gw/planet ./web/file
	if [ $? != 0 ]; then
		echo "copy file error!!"
		exit 1
	fi
	cp -f ./vsion-gw/planet.css ./web/set.css
	if [ $? != 0 ]; then
		echo "copy file error!!"
		exit 1
	fi
	rm -rf web/file/CVS
	mv web/file/index.asp web
	if [ "$MODEL" = "-D_6104K_" ] || [ "$MODEL" = "-D_6104KPS_" ] || [ "$MODEL" = "-D_6104KP_" ]; then
		cp -f ./vsion-gw/config/config-6104k-planet.txt ./LINUX/config-gw.txt
		mv ./web/file/title-6104k.asp ./web/file/title.asp
		rm -f ./web/file/title-6104b.asp
	else
		cp -f ./vsion-gw/config/config-gw-planet.txt ./LINUX/config-gw.txt
		mv ./web/file/title-6104b.asp ./web/file/title.asp
		rm -f ./web/file/title-6104k.asp
	fi
	if [ $? != 0 ]; then
		echo "copy configure file error!!"
		exit 1
	fi
	if [ "$MODEL" = "-D_6104WBB_" ] || [ "$MODEL" = "-D_6104IPC_" ] || [ "$MODEL" = "-D_6104WB_" ]; then #copy security
		cp -f ./vsion-gw/security/* ./web
	else
		if [ -f web/wlsec0.asp ]; then
			cd web
			rm -f wl1x.asp wlars.asp wlsec0.asp wlsec.asp wlpsk.asp wlwep.asp wlwsk.asp
		fi
	fi
	echo "Set version to $model_temp of English Planet successfully..."
	exit 0
fi

#******************** DDC ( 0B ) ********************
if [ "$1" = "ddc" ]; then
	rm -rf ./web-gw/file ./web-gw/set.css ./web ./LINUX/config-gw.txt
	ln -s web-gw web
	cp -rf ./vsion-gw/ddc ./web/file
	if [ $? != 0 ]; then
		echo "copy file error!!"
		exit 1
	fi
	cp -f ./vsion-gw/ddc.css ./web/set.css
	if [ $? != 0 ]; then
		echo "copy file error!!"
		exit 1
	fi
	if [ "$MODEL" = "-D_6104K_" ] || [ "$MODEL" = "-D_6104KPS_" ] || [ "$MODEL" = "-D_6104KP_" ]; then
		cp -f ./vsion-gw/config/config-6104k-edi.txt ./LINUX/config-gw.txt
	else
		cp -f ./vsion-gw/config/config-gw-edi.txt ./LINUX/config-gw.txt
	fi
	if [ $? != 0 ]; then
		echo "copy configure file error!!"
		exit 1
	fi
	rm -rf web/file/CVS
	mv web/file/index.asp web
	if [ "$MODEL" = "-D_6104WBB_" ] || [ "$MODEL" = "-D_6104IPC_" ] || [ "$MODEL" = "-D_6104WB_" ]; then #copy security
		cp -f ./vsion-gw/security/* ./web
	else
		if [ -f web/wlsec0.asp ]; then
			cd web
			rm -f wl1x.asp wlars.asp wlsec0.asp wlsec.asp wlpsk.asp wlwep.asp wlwsk.asp
		fi
	fi
	echo "Set version to $model_temp of English DDC successfully..."
	exit 0
fi

#******************** tradEdimax ( 0C ) ********************
if [ "$1" = "tradEdimax" ]; then
	rm -rf ./web-gwt/file ./web-gwt/set.css ./web ./LINUX/config-gw.txt
	ln -s web-gwt web
	cp -rf ./vsion-gw/tradEdimax ./web/file
	if [ $? != 0 ]; then
		echo "copy file error!!"
		exit 1
	fi
	cp -f ./vsion-gw/tradEdimax.css ./web/set.css
	if [ $? != 0 ]; then
		echo "copy file error!!"
		exit 1
	fi
	if [ "$MODEL" = "-D_6104K_" ] || [ "$MODEL" = "-D_6104KPS_" ] || [ "$MODEL" = "-D_6104KP_" ]; then
		cp -f ./vsion-gw/config/config-6104k-edi.txt ./LINUX/config-gw.txt
	else
		cp -f ./vsion-gw/config/config-gw-edi.txt ./LINUX/config-gw.txt
	fi
	if [ $? != 0 ]; then
		echo "copy configure file error!!"
		exit 1
	fi
	rm -rf web/file/CVS
	mv web/file/index.asp web
	if [ "$MODEL" = "-D_6104WBB_" ] || [ "$MODEL" = "-D_6104IPC_" ] || [ "$MODEL" = "-D_6104WB_" ]; then #copy security
		cp -f ./vsion-gw/tradSec/* ./web
	else
		if [ -f web/wlsec0.asp ]; then
			cd web
			rm -f wl1x.asp wlars.asp wlsec0.asp wlsec.asp wlpsk.asp wlwep.asp wlwsk.asp
		fi
	fi
	echo "Set version to $model_temp of Traditional Chinese Edimax successfully..."
	exit 0
fi

#******************** tradGeneric ( 0D ) ********************
if [ "$1" = "tradGeneral" ]; then
	rm -rf ./web-gwt/file ./web-gwt/set.css ./web ./LINUX/config-gw.txt
	ln -s web-gwt web
	cp -rf ./vsion-gw/tradGeneral ./web/file
	if [ $? != 0 ]; then
		echo "copy file error!!"
		exit 1
	fi
	cp -f ./vsion-gw/tradGeneral.css ./web/set.css
	if [ $? != 0 ]; then
		echo "copy file error!!"
		exit 1
	fi
	if [ "$MODEL" = "-D_6104K_" ] || [ "$MODEL" = "-D_6104KPS_" ] || [ "$MODEL" = "-D_6104KP_" ]; then
		cp -f ./vsion-gw/config/config-6104k-edi.txt ./LINUX/config-gw.txt
	else
		cp -f ./vsion-gw/config/config-gw-edi.txt ./LINUX/config-gw.txt
	fi
	if [ $? != 0 ]; then
		echo "copy configure file error!!"
		exit 1
	fi
	rm -rf web/file/CVS
	mv web/file/index.asp web
	if [ "$MODEL" = "-D_6104WBB_" ] || [ "$MODEL" = "-D_6104IPC_" ] || [ "$MODEL" = "-D_6104WB_" ]; then #copy security
		cp -f ./vsion-gw/tradSec/* ./web
	else
		if [ -f web/wlsec0.asp ]; then
			cd web
			rm -f wl1x.asp wlars.asp wlsec0.asp wlsec.asp wlpsk.asp wlwep.asp wlwsk.asp
		fi
	fi
	echo "Set version to $model_temp of Traditional Chinese Generic successfully..."
	exit 0
fi

#******************** korNetmate ( 0E ) ********************
if [ "$1" = "korNetmate" ]; then
	rm -rf ./web-gwk/file ./web-gwk/set.css ./web ./LINUX/config-gw.txt
	ln -s web-gwk web
	cp -rf ./vsion-gw/korNetmate ./web/file
	if [ $? != 0 ]; then
		echo "copy file error!!"
		exit 1
	fi
	cp -f ./vsion-gw/korNetmate.css ./web/set.css
	if [ $? != 0 ]; then
		echo "copy file error!!"
		exit 1
	fi
	if [ "$MODEL" = "-D_6104K_" ] || [ "$MODEL" = "-D_6104KPS_" ] || [ "$MODEL" = "-D_6104KP_" ]; then
		cp -f ./vsion-gw/config/config-6104k-netmate.txt ./LINUX/config-gw.txt
	else
		cp -f ./vsion-gw/config/config-gw-netmate.txt ./LINUX/config-gw.txt
	fi
	if [ $? != 0 ]; then
		echo "copy configure file error!!"
		exit 1
	fi
	rm -rf web/file/CVS
	mv web/file/index.asp web
	if [ "$MODEL" = "-D_6104WBB_" ] || [ "$MODEL" = "-D_6104IPC_" ] || [ "$MODEL" = "-D_6104WB_" ]; then #copy security
		cp -f ./vsion-gw/security/* ./web
	else
		if [ -f web/wlsec0.asp ]; then
			cd web
			rm -f wl1x.asp wlars.asp wlsec0.asp wlsec.asp wlpsk.asp wlwep.asp wlwsk.asp
		fi
	fi
	echo "Set version to $model_temp of Korean Netmate successfully..."
	exit 0
fi

#******************** blitzz ( 10 ) ********************
if [ "$1" = "blitzz" ]; then
	rm -rf ./web-gw/file ./web-gw/set.css ./web ./LINUX/config-gw.txt
	ln -s web-gw web
	cp -rf ./vsion-gw/blitzz ./web/file
	if [ $? != 0 ]; then
		echo "copy file error!!"
		exit 1
	fi
	cp -f ./vsion-gw/blitzz.css ./web/set.css
	if [ $? != 0 ]; then
		echo "copy file error!!"
		exit 1
	fi
	if [ "$MODEL" = "-D_6104K_" ] || [ "$MODEL" = "-D_6104KPS_" ] || [ "$MODEL" = "-D_6104KP_" ]; then
		cp -f ./vsion-gw/config/config-6104k-blitzz.txt ./LINUX/config-gw.txt
	else
		cp -f ./vsion-gw/config/config-gw-blitzz.txt ./LINUX/config-gw.txt
	fi
	if [ $? != 0 ]; then
		echo "copy configure file error!!"
		exit 1
	fi
	rm -rf web/file/CVS
	mv web/file/index.asp web
	if [ "$MODEL" = "-D_6104WBB_" ] || [ "$MODEL" = "-D_6104IPC_" ] || [ "$MODEL" = "-D_6104WB_" ]; then #copy security
		cp -f ./vsion-gw/security/* ./web
	else
		if [ -f web/wlsec0.asp ]; then
			cd web
			rm -f wl1x.asp wlars.asp wlsec0.asp wlsec.asp wlpsk.asp wlwep.asp wlwsk.asp
		fi
	fi
	echo "Set version to $model_temp of English Blitzz successfully..."
	exit 0
fi

#******************** Tulip ( 13 ) ********************
if [ "$1" = "tulip" ]; then	
	rm -rf ./web-gw/file ./web-gw/set.css ./web ./LINUX/config-gw.txt
	ln -s web-gw web
	cp -rf ./vsion-gw/concept ./web/file
	if [ $? != 0 ]; then
		echo "copy file error!!"
		exit 1
	fi
	cp -f ./vsion-gw/concept.css ./web/set.css
	if [ $? != 0 ]; then
		echo "copy file error!!"
		exit 1
	fi
	if [ "$MODEL" = "-D_6104K_" ] || [ "$MODEL" = "-D_6104KPS_" ] || [ "$MODEL" = "-D_6104KP_" ]; then	#copy configure
		cp -f ./vsion-gw/config/config-6104k-edi.txt ./LINUX/config-gw.txt
	else
		cp -f ./vsion-gw/config/config-gw-edi.txt ./LINUX/config-gw.txt
	fi
	if [ $? != 0 ]; then
		echo "copy configure file error!!"
		exit 1
	fi
	rm -rf web/file/CVS
	mv web/file/index.asp web
	if [ "$MODEL" = "-D_6104WBB_" ] || [ "$MODEL" = "-D_6104IPC_" ] || [ "$MODEL" = "-D_6104WB_" ]; then #copy security
		cp -f ./vsion-gw/security/* ./web
	else
		if [ -f web/wlsec0.asp ]; then
			cd web
			rm -f wl1x.asp wlars.asp wlsec0.asp wlsec.asp wlpsk.asp wlwep.asp wlwsk.asp
		fi
	fi
	echo "Set version to $model_temp of English Conceptronic successfully..."
	exit 0
fi

if [ "$1" = "help" ]; then
	echo " usage: set [arg]"
	echo " edimax          Set version to English Edimax, Model number is 00."
	echo " general         Set version to English Generic, Model number is 01."
	echo " simpGeneral     Set version to simplified Chinese Generic, Model number is 04."
	echo " netmate         Set version to English NETmate, Model number is 05."
	echo " planet          Set version to English Planet, Model number is 07."
	echo " ddc             Set version to English DDC, Model number is 0B."
	echo " tradGeneral     Set version to Traditional Chinese Generic, Model number is 0C."
	echo " korNetmate      Set version to Korean NETmate, Model number is 0E."
	echo " blitzz          Set version to English Blitzz, Model number is 10."
	echo " tulip           Set version to English Tulip, Model number is 13."
	echo " help            Show help for you"
	exit 1
fi

echo "Module no support!!"
exit 1
	
