mtp2.0_QueryService_linux.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/bin/bash
  2. export base=$HOME/build/git/MTP20_IF
  3. export GOROOT=/home/pub/go
  4. export GOPATH=/home/pub/gowebapi
  5. export GOBIN=$GOPATH/bin
  6. export GO111MODULE=on
  7. export GOPROXY=https://goproxy.cn
  8. export PATH=$PATH:$GOROOT/bin:$GOBIN
  9. export PKG_CONFIG_PATH=/home/pub/pkconfig
  10. export LD_LIBRARY_PATH=/home/pub/instantclient_11_2/
  11. function build()
  12. {
  13. local src=$1
  14. local oldpwd=`pwd`
  15. cd $src
  16. echo "Before switching: "
  17. git branch
  18. git reset --hard
  19. git clean -fdx
  20. git pull --rebase
  21. git checkout $branch_name
  22. echo "After switching: "
  23. git branch
  24. if [ $? -ne 0 ]; then
  25. echo "git update err:1"
  26. exit 1
  27. fi
  28. cd $src
  29. #sh $HOME/build/scripts/xml_to_j2.sh queryservice $src/
  30. echo "path:"$src
  31. go build -a -o bin/QueryService
  32. if [ $? -ne 0 ]; then
  33. echo "go build err: 2"
  34. exit 2
  35. fi
  36. mkdir -p bin/config
  37. cp -r $src/config/config.xml bin/config/
  38. cp -r $src/config/cfg.json bin/config/
  39. cp -r $src/config/config.j2 bin/config/
  40. cp -r $src/config/cfg.j2 bin/config/
  41. cp -r $src/config/pc_menu.json bin/config/
  42. cp -r $src/config/mobile_menu.json bin/config/
  43. cp -r $src/config/pcweb_menu bin/config/
  44. local datestr=`date +%Y%m%d%H%M%S`
  45. cd $src/bin/
  46. local zipfile=mtp2_queryservice_r20_${datestr}.zip
  47. local rsync_ip=192.168.30.153
  48. local rsync_project=mtp2.0_release
  49. zip -r $zipfile ./
  50. rsync -avh $src/bin/${zipfile} $rsync_ip::build/$rsync_project/${zipfile}
  51. echo "Storage path: \\\\$rsync_ip\\share\\build\\$rsync_project\\$zipfile"
  52. rm -rf $src/bin
  53. }
  54. #######################main function#########################
  55. build $base
  56. if [ $? -ne 0 ]; then
  57. exit -1
  58. fi