Commit 5c47a044 authored by dengyufu's avatar dengyufu

modify tar_file/pinpoint-agent-1.7.3-yit_3.10-SNAPSHOT.tar.gz and download.sh

parent f86d6b2a
#!/usr/bin/env bash
SCRIPT_DIR=$(dirname ${BASH_SOURCE[0]})
cd $SCRIPT_DIR
DIR=`pwd`
AGENT_DIR="pinpoint-agent"
INIT_ENV_FILE_NAME="init_env"
function getFileName(){
if [ "$1" == "" ] ; then
TAR_FILE_NAME=`curl https://gitlab.yit.com/pub/com.yit.trace.yittrace-pinpoint-agent/raw/master/agent-latest.md\?inline\=false`
else
TAR_FILE_NAME=$1
fi
echo $TAR_FILE_NAME
}
function downloadTarFile(){
TAR_FILE_NAME=$1
wget "https://gitlab.yit.com/pub/com.yit.trace.yittrace-pinpoint-agent/raw/master/tar_file/$TAR_FILE_NAME"
}
function unZipTarFile(){
mkdir $AGENT_DIR
tar -zxvf $1 -C $AGENT_DIR
echo "install agent dir to : $DIR/$AGENT_DIR"
}
function copyInitEnvPage(){
cp $AGENT_DIR/script/$INIT_ENV_FILE_NAME ./
}
function initEnv(){
if [ -d init_env ] ; then
$AGENT_DIR/script/mac_init_env_replay.sh `cat $INIT_ENV_FILE_NAME`
fi
}
function printJavaagent(){
bootstrapJarName=`ls $AGENT_DIR | grep pinpoint-bootstrap`
echo "please init env use : $AGENT_DIR/mac_init_env_replay.sh"
}
function downloadTarFileIfEmpty(){
tar_file_name=`getFileName $1`
if [ -d $AGENT_DIR ] ; then
echo "$AGENT_DIR already exist"
echo "get newest Usage: $0 refresh"
exit 0
fi
if [ -f $tar_file_name ] ; then
echo "$tar_file_name already exist"
echo "get newest Usage: $0 refresh"
unZipTarFile $tar_file_name
exit 0
fi
downloadTarFile $tar_file_name
unZipTarFile $tar_file_name
printJavaagent
}
function refreshTarFile(){
tar_file_name=`getFileName $1`
if [ -d $AGENT_DIR ] ; then
copyInitEnvPage
rm -r $AGENT_DIR
fi
if [ -f $tar_file_name ] ; then
rm -r $tar_file_name
fi
downloadTarFile $tar_file_name
unZipTarFile $tar_file_name
initEnv
}
case "$1" in
refresh)
refreshTarFile $2
;;
*)
downloadTarFileIfEmpty $1
;;
esac
exit 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment