git: 5c6886afad6f - main - www/caddy{,-custom}: chown caddy.log to caddy user/group

From: Adam Weinberger <adamw_at_FreeBSD.org>
Date: Sun, 21 Jan 2024 13:08:14 UTC
The branch main has been updated by adamw:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5c6886afad6f39c5c0a9f8b8ccd16cea8cad8504

commit 5c6886afad6f39c5c0a9f8b8ccd16cea8cad8504
Author:     Mike Fisher <mfisher911@gmail.com>
AuthorDate: 2024-01-21 13:04:55 +0000
Commit:     Adam Weinberger <adamw@FreeBSD.org>
CommitDate: 2024-01-21 13:08:10 +0000

    www/caddy{,-custom}: chown caddy.log to caddy user/group
    
    We have set caddy.log to root:wheel, which works for the default case
    of running caddy as root.
    
    When caddy is run as a non-root users, caddy.log can't actually be
    written to. Instead, chown caddy.log to the caddy user/group so that
    it can be written to.
    
    PR:             276150
---
 www/caddy-custom/Makefile       | 2 +-
 www/caddy-custom/files/caddy.in | 4 ++--
 www/caddy/Makefile              | 2 +-
 www/caddy/files/caddy.in        | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/www/caddy-custom/Makefile b/www/caddy-custom/Makefile
index 19ddef881324..f1bdbb360dd2 100644
--- a/www/caddy-custom/Makefile
+++ b/www/caddy-custom/Makefile
@@ -4,7 +4,7 @@
 
 PORTNAME=	caddy-custom
 PORTVERSION=	${CADDY_VERSION}.${XCADDY_VERSION}
-PORTREVISION=	12
+PORTREVISION=	13
 CATEGORIES=	www
 DISTFILES=	# none
 
diff --git a/www/caddy-custom/files/caddy.in b/www/caddy-custom/files/caddy.in
index fc1f74e1de55..fc7cc986e1d7 100644
--- a/www/caddy-custom/files/caddy.in
+++ b/www/caddy-custom/files/caddy.in
@@ -119,9 +119,9 @@ caddy_precmd()
     /usr/bin/install -d -m 700 -o "${caddy_user}" -g "${caddy_group}" /var/run/caddy
     if [ -e ${caddy_logfile} ]; then
         /bin/chmod 644 ${caddy_logfile}
-        /usr/sbin/chown root:wheel ${caddy_logfile}
+        /usr/sbin/chown "${caddy_user}:${caddy_group}" ${caddy_logfile}
     else
-        /usr/bin/install -m 644 -o root -g wheel /dev/null ${caddy_logfile}
+        /usr/bin/install -m 644 -o "${caddy_user}" -g "${caddy_group}" /dev/null ${caddy_logfile}
     fi
 }
 
diff --git a/www/caddy/Makefile b/www/caddy/Makefile
index b6bf4f6044db..cfbde9ea7c9b 100644
--- a/www/caddy/Makefile
+++ b/www/caddy/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	caddy
 DISTVERSIONPREFIX=	v
 DISTVERSION=	2.7.6
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	www
 DIST_SUBDIR=	caddy
 
diff --git a/www/caddy/files/caddy.in b/www/caddy/files/caddy.in
index 34b0157f1d00..e3e554f8ddb3 100644
--- a/www/caddy/files/caddy.in
+++ b/www/caddy/files/caddy.in
@@ -119,9 +119,9 @@ caddy_precmd()
     /usr/bin/install -d -m 700 -o "${caddy_user}" -g "${caddy_group}" /var/run/caddy
     if [ -e ${caddy_logfile} ]; then
         /bin/chmod 644 ${caddy_logfile}
-        /usr/sbin/chown root:wheel ${caddy_logfile}
+        /usr/sbin/chown "${caddy_user}:${caddy_group}" ${caddy_logfile}
     else
-        /usr/bin/install -m 644 -o root -g wheel /dev/null ${caddy_logfile}
+        /usr/bin/install -m 644 -o "${caddy_user}" -g "${caddy_group}" /dev/null ${caddy_logfile}
     fi
 }