From 68d84dc366b861757ed8ff84f479852e5edf220a Mon Sep 17 00:00:00 2001 From: "Oleg A. Mamontov" Date: Fri, 24 Nov 2023 12:48:06 +0300 Subject: [PATCH 4/4] [PATCH] www/angie: Create/delete logs directory using hooks This allows end-user to change permissions on log directory based on their preferences or security concerns and they won't be reset on upgrade. --- www/angie/Makefile | 6 +++--- www/angie/files/pkg-deinstall.in | 5 +++++ www/angie/files/pkg-install.in | 5 +++++ www/angie/pkg-plist | 1 - 4 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 www/angie/files/pkg-deinstall.in create mode 100644 www/angie/files/pkg-install.in diff --git a/www/angie/Makefile b/www/angie/Makefile index d9b98222162e..95674687507f 100644 --- a/www/angie/Makefile +++ b/www/angie/Makefile @@ -33,7 +33,9 @@ ALL_TARGET= build SUB_FILES= angie.conf.sample \ default.conf.sample \ example.conf.sample \ - pkg-message + pkg-deinstall \ + pkg-message \ + pkg-install USE_RC_SUBR= angie .else ALL_TARGET?= modules @@ -54,7 +56,6 @@ RUNDIR= /var/run WRKSRC_DEBUG= ${WRKSRC}-debug PLIST_SUB+= CACHEDIR=${CACHEDIR} \ - LOGDIR=${LOGDIR} \ MODDIR=${MODDIR} \ RUNDIR=${RUNDIR} @@ -147,7 +148,6 @@ do-install: ${MKDIR} ${STAGEDIR}${DOCSDIR} ${MKDIR} ${STAGEDIR}${ETCDIR}/http.d ${MKDIR} ${STAGEDIR}${ETCDIR}/stream.d - ${MKDIR} ${STAGEDIR}${LOGDIR} ${MKDIR} ${STAGEDIR}${MODDIR} ${MKDIR} ${STAGEDIR}${WWWDIR}/html diff --git a/www/angie/files/pkg-deinstall.in b/www/angie/files/pkg-deinstall.in new file mode 100644 index 000000000000..6929c97692e4 --- /dev/null +++ b/www/angie/files/pkg-deinstall.in @@ -0,0 +1,5 @@ +if [ "$2" = "POST-DEINSTALL" ]; then + if [ -d %%LOGDIR%% ]; then + rmdir %%LOGDIR%% 2>/dev/null || : + fi +fi diff --git a/www/angie/files/pkg-install.in b/www/angie/files/pkg-install.in new file mode 100644 index 000000000000..45e8703f5d48 --- /dev/null +++ b/www/angie/files/pkg-install.in @@ -0,0 +1,5 @@ +if [ "$2" = "POST-INSTALL" ]; then + if [ ! -e %%LOGDIR%% ]; then + install -d -m 755 -o root -g wheel %%LOGDIR%% + fi +fi diff --git a/www/angie/pkg-plist b/www/angie/pkg-plist index 2c77c1a62d2e..3fa220600193 100644 --- a/www/angie/pkg-plist +++ b/www/angie/pkg-plist @@ -1,7 +1,6 @@ @dir %%ETCDIR%%/http.d @dir %%ETCDIR%%/stream.d @dir %%CACHEDIR%% -@dir %%LOGDIR%% @dir %%MODDIR%% %%ETCDIR%%/modules -- 2.39.2 (Apple Git-143)