package.sh 914 B

123456789101112131415161718192021222324252627282930313233343536373839
  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. rm $ROOT/minio-into-stck/minio-into-stck
  9. BUILDTIME_STR=`date '+%Y-%m-%d %H:%M:%S'`
  10. CGO_ENABLED=0 go build -ldflags "-X \"main.buildtime=$BUILDTIME_STR\"" -o $ROOT/minio-into-stck/minio-into-stck $ROOT/
  11. cp -rf $ROOT/config $ROOT/minio-into-stck/
  12. # ----- End build -----
  13. cp -rf $ROOT/minio-into-stck $ROOT/tmp/
  14. cp -rf $ROOT/minio-into-stck-installer $ROOT/tmp/
  15. mkdir -p $ROOT/tmp/minio-into-stck/lib
  16. mkdir -p $ROOT/tmp/minio-into-stck/log
  17. cd $ROOT/tmp
  18. tar -zcf $ROOT/tmp/minio-into-stck-installer/minio-into-stck.tar.gz minio-into-stck
  19. cd $ROOT
  20. if [ ! -d "release" ]; then
  21. mkdir -p release
  22. fi
  23. cd $ROOT/tmp
  24. tar -zcf $ROOT/release/minio-into-stck-installer-v${cur_date}.tar.gz minio-into-stck-installer
  25. rm -rf $ROOT/tmp/*
  26. rmdir $ROOT/tmp
  27. echo "打包成功"