From 42aab2a5d9463cad771b0e74e685a75bd73b356e Mon Sep 17 00:00:00 2001 From: minoplhy Date: Tue, 9 Jul 2024 22:35:34 +0700 Subject: [PATCH] nginx_build_script: add: options to change build tag in Nginx --- nginx_build_script/build.sh | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/nginx_build_script/build.sh b/nginx_build_script/build.sh index f4c38ce..b9da7f1 100644 --- a/nginx_build_script/build.sh +++ b/nginx_build_script/build.sh @@ -21,6 +21,17 @@ while [ ${#} -gt 0 ]; do ;; esac ;; + --nginx-tag=* ) + NGINX_TAG="${1#*=}" + case $NGINX_TAG in + "") + echo "ERROR: --nginx-tag= is empty!" + exit 1 + ;; + *) + ;; + esac + ;; *) ;; esac @@ -49,7 +60,21 @@ mkdir $HOMEDIRECTORY && cd $HOMEDIRECTORY # Nginx cd $HOMEDIRECTORY -hg clone -b default https://hg.nginx.org/nginx +hg clone https://hg.nginx.org/nginx $HOMEDIRECTORY/nginx + +cd $HOMEDIRECTORY/nginx +# Check if the tag exists +if [[ -n $NGINX_TAG ]] +then + if hg tags | grep -q "^${NGINX_TAG}\>"; then + echo "INFO: Switching Nginx Branch to ${NGINX_TAG}" + hg checkout $NGINX_TAG + else + echo "ERROR: NGINX_TAG specified is not existed. aborting..." && exit 1 + fi +else + hg checkout default +fi # Build SSL Library case $SSL_LIB in