123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #!/bin/bash
- set -e
- cur_date="`date +%Y-%m-%d`"
- ROOT=$(cd `dirname $0`; pwd)
- mkdir -p $ROOT/tmp
- rm -rf $ROOT/tmp/*
- # NOTE: App is installed to /opt/$APP_COMPARTMENT/$APP_MODULE
- APP_COMPARTMENT="nginx-green"
- APP_MODULE="nginx-ui-green"
- # ----- Start build -----
- mkdir -p $ROOT/cache
- cd $ROOT/cache
- UI_FILENAME="nginx-ui-linux-64.tar.gz"
- if [ ! -r $ROOT/cache/$UI_FILENAME ]; then
- echo "Downloading $UI_FILENAME..."
- wget https://github.com/0xJacky/nginx-ui/releases/download/v2.0.0-beta.41/$UI_FILENAME
- fi
- if [ ! -r $ROOT/cache/nginx-ui ]; then
- echo "Extracting nginx-ui..."
- tar -xf $UI_FILENAME
- fi
- # ----- End build -----
- cd $ROOT
- cp -rf $ROOT/$APP_MODULE $ROOT/tmp/
- cp -rf $ROOT/$APP_MODULE-installer $ROOT/tmp/
- mkdir -p $ROOT/tmp/$APP_MODULE/logs
- mkdir -p $ROOT/tmp/$APP_MODULE/tmp
- mkdir -p $ROOT/tmp/$APP_MODULE/bin
- cp -rf $ROOT/config $ROOT/tmp/$APP_MODULE/config
- cp -f $ROOT/cache/nginx-ui $ROOT/tmp/$APP_MODULE/bin/nginx-ui
- cd $ROOT/tmp
- tar -zcf $ROOT/tmp/$APP_MODULE-installer/$APP_MODULE.tar.gz $APP_MODULE
- cd $ROOT
- mkdir -p release
- cd $ROOT/tmp
- tar -zcf $ROOT/release/$APP_MODULE-installer-v${cur_date}.tar.gz $APP_MODULE-installer
- rm -rf $ROOT/tmp/*
- rmdir $ROOT/tmp
- echo "打包成功"
|