You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

116 lines
2.6 KiB

#!/bin/bash
#set -e
SYSTEM=`uname -s`
BUILD_CONFIG=Debug
PUBLISH_CONFIG=Release
NETCOREVER=net5.0
RUNTIME_WIN=win-x64
RUNTIME_LINUX=ubuntu.16.04-x64
RUNTIME_MAC=osx-x64
RUNTIME=$RUNTIME_WIN
if [ $SYSTEM = "Linux" ] ; then
RUNTIME=$RUNTIME_LINUX;
elif [ $SYSTEM = "Darwin" ] ; then
RUNTIME=$RUNTIME_MAC;
fi
RESTORE=false
PUBLISH=false
DEBUG_OUTPUT=bin
RELEASE_OUTPUT=./publish/bin
build_one_proj_exe()
{
if [ $RESTORE = "true" ] ; then
dotnet restore ./$1
fi
if [ $PUBLISH = "true" ] ; then
dotnet publish $1 --configuration $PUBLISH_CONFIG --runtime $RUNTIME --output $RELEASE_OUTPUT --framework $NETCOREVER
else
dotnet build $1 --configuration $BUILD_CONFIG --runtime $RUNTIME --output $DEBUG_OUTPUT --framework $NETCOREVER
fi
if [ $? -ne 0 ]; then
echo "****************************** build error ******************************"
exit 0
fi
}
#usage: bin ip port
scp_to_destsvr()
{
echo "scp -P$3 $1 mmog@$2:~/sm_tools"
scp -P$3 $1 mmog@$2:~
}
cd ..
pwd
if [ "$1" = "rebuild" ] ; then
rm ./bin/* -rf
elif [ "$1" = "publish" ] ; then
RUNTIME=$RUNTIME_LINUX
PUBLISH=true
mkdir -p ./publish/bin
mkdir -p ./publish/cfg
mkdir -p ./publish/ctrl_sh
mkdir -p ./publish/data/centerPush
mkdir -p ./publish/data/centerRecv
mkdir -p ./publish/data/agentRecv
rm ./publish/bin/* -rf
rm ./publish/cfg/* -rf
rm ./publish/ctrl_sh/* -rf
cp ./cfg/* ./publish/cfg/ -rf
cp ./ctrl_sh/* ./publish/ctrl_sh/ -rf
rm ./publish/ctrl_sh/start_console.bat
fi
build_one_proj_exe SMConsole
build_one_proj_exe SMCenter
build_one_proj_exe SMAgent
build_one_proj_exe SMAgentUpdater
build_one_proj_exe SMWebServer
if [ $PUBLISH = "true" ] ; then
#rm ./publish/bin/*
if [ "$2" != "full" ] ; then
rm ./publish/bin/lib* -rf
rm ./publish/bin/Microsoft* -rf
rm ./publish/bin/System.* -rf
fi
BinName=sm_tools.tgz
rm ./$BinName
tar zcvf ./$BinName ./publish
if [ "$2" == "yinlf" ]||[ "$3" == "yinlf" ] ; then
scp_to_destsvr $BinName "192.168.1.80" 22
elif [ "$2" == "yuanvm" ]||[ "$3" == "yuanvm" ] ; then
scp_to_destsvr $BinName "192.168.1.159" 22
elif [ "$2" == "180" ]||[ "$3" == "180" ] ; then
scp_to_destsvr $BinName "111.231.250.180" 56000
elif [ "$2" == "xjp" ]||[ "$3" == "xjp" ] ; then
scp_to_destsvr $BinName "119.28.105.46" 56000
elif [ "$2" == "us" ]||[ "$3" == "us" ] ; then
scp_to_destsvr $BinName "170.106.98.187" 56000
elif [ "$2" == "gz2" ]||[ "$3" == "gz2" ] ; then
scp_to_destsvr $BinName "106.52.93.60" 56000
elif [ "$2" == "gz3" ]||[ "$3" == "gz3" ] ; then
scp_to_destsvr $BinName "119.29.167.4" 56000
else
scp_to_destsvr $BinName "111.231.250.180" 56000
fi
md5sum ./$BinName
fi