Add --purge to delete build folders after install #6
No files matched your search
@@ -46,3 +46,4 @@ Type `which nginx` and make a copy i.e. `sudo cp /usr/sbin/nginx /usr/sbin/nginx
|
||||
3. Check nginx `sudo nginx -t`
|
||||
4. Reload nginx `sudo nginx -s reload`
|
||||
5. Verify new version `sudo nginx -v` should output `nginx version: freenginx/1.29.4 (w/GeoIP2,Brotli,H3,Headers-More,Quantum,debug,KTLS)`
|
||||
6. Optionally free up disk space with `./freenginx.sh --purge` (same `-r` and versions as the build). It refuses to run if the built binary doesn't match `/usr/sbin/nginx`.
|
||||
@@ -39,6 +39,8 @@ Usage: ${0##*/} [options]
|
||||
-q quiet: print only errors and the final summary
|
||||
-v verbose: stream all build output to the terminal (still logged)
|
||||
-c run 'make clean' in the freenginx tree before configuring
|
||||
--purge don't build; delete this version's source and dependency folders
|
||||
(run after 'sudo make install'; logs are kept)
|
||||
--no-brotli | --no-zstd | --no-geoip2 | --no-headers | --no-ktls | --no-debug
|
||||
disable an optional feature
|
||||
-h show this help
|
||||
@@ -56,6 +58,7 @@ while [ $# -gt 0 ]; do
|
||||
-q) VERBOSITY=0 ;;
|
||||
-v) VERBOSITY=2 ;;
|
||||
-c) CLEAN=1 ;;
|
||||
--purge) PURGE=1 ;;
|
||||
--no-brotli) USE_BROTLI=0 ;;
|
||||
--no-zstd) USE_ZSTD=0 ;;
|
||||
--no-geoip2) USE_GEOIP2=0 ;;
|
||||
@@ -141,6 +144,20 @@ install_maxmind() { # system-wide, skipped when pkg-config already reports $V_MA
|
||||
|
||||
### Setup
|
||||
case $BUILDROOT in /*) ;; *) BUILDROOT=$PWD/$BUILDROOT ;; esac
|
||||
|
||||
if [ "${PURGE:-0}" = 1 ]; then
|
||||
built=$BUILDROOT/nginx-release-$V_NGINX/objs/nginx
|
||||
if [ -f "$built" ] && ! cmp -s "$built" /usr/sbin/nginx; then
|
||||
echo "!! $built is not the installed /usr/sbin/nginx. Run 'sudo make install' first." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "==> Removing freenginx $V_NGINX build folders from $BUILDROOT"
|
||||
rm -rf -- "$BUILDROOT/nginx-release-$V_NGINX" "$BUILDROOT/zlib-$V_ZLIB" "$BUILDROOT/pcre2-$V_PCRE" \
|
||||
"$BUILDROOT/openssl-$V_QSSL" "$BUILDROOT/libmaxminddb-$V_MAXM" "$BUILDROOT/nginx-geoip2" \
|
||||
"$BUILDROOT/ngx-brotli" "$BUILDROOT/ngx-zstd" "$BUILDROOT/headers-more-nginx-module-$V_HEAD"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
mkdir -p "$BUILDROOT"
|
||||
: "${LOG:=$BUILDROOT/build-$V_NGINX-$(date +%Y%m%d-%H%M%S).log}"
|
||||
case $LOG in /*) ;; *) LOG=$PWD/$LOG ;; esac
|
||||
|
||||
Reference in new issue
Block a user