#!/bin/bash

# $1 is tar name
# $2 is base dir

if [ $# -ne 2 ];then
    echo "the number of paramater is not 2!"
    exit -1
fi

echo "installed tar is $1"
echo "the path of exe is $2"

bdt_exe_path=$2
tar_path=$2/$1
release_path=$2/release

tar xf $tar_path

rm $release_path/bdt_upgrade
killall bdt_gui

cp -rf $release_path/* $bdt_exe_path

rm -rf $release_path/*
rmdir $release_path

rm $bdt_exe_path/upgrade_install.sh
rm $tar_path

killall bdt_upgrade

$bdt_exe_path/bdt_gui

