package-arm64.sh 791 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/bash
  2. set -e
  3. cur_date="`date +%Y-%m-%d`"
  4. ROOT=$(cd `dirname $0`; pwd)
  5. mkdir -p $ROOT/tmp
  6. rm -rf $ROOT/tmp/*
  7. # ----- Start build -----
  8. CGO_ENABLED=0 GOARCH=arm64 go build -ldflags "-X \"main.buildtime=`date '+%Y-%m-%d %H:%M:%S'`\"" -o $ROOT/watch-daemon/watch-daemon $ROOT/
  9. cp -rf $ROOT/config $ROOT/watch-daemon/
  10. # ----- End build -----
  11. cp -rf $ROOT/watch-daemon $ROOT/tmp/
  12. cp -rf $ROOT/watch-daemon-installer $ROOT/tmp/
  13. mkdir -p $ROOT/tmp/watch-daemon/log
  14. cd $ROOT/tmp
  15. tar -zcf $ROOT/tmp/watch-daemon-installer/watch-daemon.tar.gz watch-daemon
  16. cd $ROOT
  17. if [ ! -d "release" ]; then
  18. mkdir -p release
  19. fi
  20. cd $ROOT/tmp
  21. tar -zcf $ROOT/release/watch-daemon-arm64-installer-v${cur_date}.tar.gz watch-daemon-installer
  22. rm -rf $ROOT/tmp/*
  23. rmdir $ROOT/tmp
  24. echo "打包成功"