package.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. # NOTE: App is installed to /opt/$APP_COMPARTMENT/$APP_MODULE
  8. APP_COMPARTMENT="nginx-green"
  9. APP_MODULE="nginx-ui-green"
  10. # ----- Start build -----
  11. mkdir -p $ROOT/cache
  12. cd $ROOT/cache
  13. UI_FILENAME="nginx-ui-linux-64.tar.gz"
  14. if [ ! -r $ROOT/cache/$UI_FILENAME ]; then
  15. echo "Downloading $UI_FILENAME..."
  16. wget https://github.com/0xJacky/nginx-ui/releases/download/v2.0.0-beta.41/$UI_FILENAME
  17. fi
  18. if [ ! -r $ROOT/cache/nginx-ui ]; then
  19. echo "Extracting nginx-ui..."
  20. tar -xf $UI_FILENAME
  21. fi
  22. # ----- End build -----
  23. cd $ROOT
  24. cp -rf $ROOT/$APP_MODULE $ROOT/tmp/
  25. cp -rf $ROOT/$APP_MODULE-installer $ROOT/tmp/
  26. mkdir -p $ROOT/tmp/$APP_MODULE/logs
  27. mkdir -p $ROOT/tmp/$APP_MODULE/tmp
  28. mkdir -p $ROOT/tmp/$APP_MODULE/bin
  29. cp -rf $ROOT/config $ROOT/tmp/$APP_MODULE/config
  30. cp -f $ROOT/cache/nginx-ui $ROOT/tmp/$APP_MODULE/bin/nginx-ui
  31. cd $ROOT/tmp
  32. tar -zcf $ROOT/tmp/$APP_MODULE-installer/$APP_MODULE.tar.gz $APP_MODULE
  33. cd $ROOT
  34. mkdir -p release
  35. cd $ROOT/tmp
  36. tar -zcf $ROOT/release/$APP_MODULE-installer-v${cur_date}.tar.gz $APP_MODULE-installer
  37. rm -rf $ROOT/tmp/*
  38. rmdir $ROOT/tmp
  39. echo "打包成功"