package.sh 733 B

12345678910111213141516171819202122232425262728293031323334353637
  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. go build -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/lib
  14. mkdir -p $ROOT/tmp/watch-daemon/log
  15. cd $ROOT/tmp
  16. tar -zcf $ROOT/tmp/watch-daemon-installer/watch-daemon.tar.gz watch-daemon
  17. cd $ROOT
  18. if [ ! -d "release" ]; then
  19. mkdir -p release
  20. fi
  21. cd $ROOT/tmp
  22. tar -zcf $ROOT/release/watch-daemon-installer-v${cur_date}.tar.gz watch-daemon-installer
  23. rm -rf $ROOT/tmp/*
  24. rmdir $ROOT/tmp
  25. echo "打包成功"