123456789101112131415161718192021222324252627282930313233343536 |
- #!/bin/bash
- set -e
- cur_date="`date +%Y-%m-%d`"
- ROOT=$(cd `dirname $0`; pwd)
- mkdir -p $ROOT/tmp
- rm -rf $ROOT/tmp/*
- # ----- Start build -----
- CGO_ENABLED=0 go build -o $ROOT/watch-daemon/watch-daemon $ROOT/
- cp -rf $ROOT/config $ROOT/watch-daemon/
- # ----- End build -----
- cp -rf $ROOT/watch-daemon $ROOT/tmp/
- cp -rf $ROOT/watch-daemon-installer $ROOT/tmp/
- mkdir -p $ROOT/tmp/watch-daemon/log
- cd $ROOT/tmp
- tar -zcf $ROOT/tmp/watch-daemon-installer/watch-daemon.tar.gz watch-daemon
- cd $ROOT
- if [ ! -d "release" ]; then
- mkdir -p release
- fi
- cd $ROOT/tmp
- tar -zcf $ROOT/release/watch-daemon-installer-v${cur_date}.tar.gz watch-daemon-installer
- rm -rf $ROOT/tmp/*
- rmdir $ROOT/tmp
- echo "打包成功"
|