1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- #!/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-green"
- # ----- Start build -----
- # NOTE: Adapted from https://github.com/moezzie/nginx-portable
- NGINX_VERSION="nginx-1.26.2"
- NGINX_BUILD_DIR=$ROOT/cache/$NGINX_VERSION/
- ./build-nginx.sh $NGINX_VERSION "/opt/$APP_COMPARTMENT/$APP_MODULE"
- # ----- End build -----
- 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 $NGINX_BUILD_DIR/conf $ROOT/tmp/$APP_MODULE/conf
- cp -f $ROOT/conf/nginx.conf $ROOT/tmp/$APP_MODULE/conf/nginx.conf
- cp -rf $NGINX_BUILD_DIR/html $ROOT/tmp/$APP_MODULE/html
- cp -f $NGINX_BUILD_DIR/objs/nginx $ROOT/tmp/$APP_MODULE/bin/nginx-green
- mkdir -p $ROOT/tmp/$APP_MODULE/conf/sites-available
- mkdir -p $ROOT/tmp/$APP_MODULE/conf/sites-enabled
- mkdir -p $ROOT/tmp/$APP_MODULE/conf/streams-available
- mkdir -p $ROOT/tmp/$APP_MODULE/conf/streams-enabled
- mkdir -p $ROOT/tmp/$APP_MODULE/conf/conf.d/sites-available
- mkdir -p $ROOT/tmp/$APP_MODULE/conf/conf.d/sites-enabled
- mkdir -p $ROOT/tmp/$APP_MODULE/conf/conf.d/streams-available
- mkdir -p $ROOT/tmp/$APP_MODULE/conf/conf.d/streams-enabled
- 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 "打包成功"
|