#!/bin/bash
#

if [ $# -lt 1 ]
then 
echo "usage: upgrade.sh filename"
exit 1
fi

cd $GCP_ROOT
cd ..

FileName=$1
ExtName=${FileName##*.}

if [ $ExtName == "tar" ]
then
 tar xvf $1
 Ret = $?
elif [ $ExtName == "gz" ]
then
 tar zxvf $1
 Ret = $?
else
 exit 2
fi


if [ $Ret -eq 0 ]
then
 	cd $GCP_ROOT/scripts
 	chmod u+x *.sh
	sync
	sync
fi
sync
sync

exit $?
