git: c5dbdf1971ad - main - net-mgmt/librenms: unbreak lnms

From: Dan Langille <dvl_at_FreeBSD.org>
Date: Sun, 29 Oct 2023 00:14:04 UTC
The branch main has been updated by dvl:

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

commit c5dbdf1971ad604ef3e2ca626462edd3d4adbdc0
Author:     Dan Langille <dvl@FreeBSD.org>
AuthorDate: 2023-10-29 00:12:03 +0000
Commit:     Dan Langille <dvl@FreeBSD.org>
CommitDate: 2023-10-29 00:14:01 +0000

    net-mgmt/librenms: unbreak lnms
    
    lnms insists upon lnms file is owned by root, it should be owned and ran
    by a non-privileged user
    
    Make it chown www because that's what the librenms service runs as.
    
    I'm discussing a solution with upstream as to how to better fix this in
    their code. The current solution allows the app to modify its own code.
---
 net-mgmt/librenms/Makefile | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net-mgmt/librenms/Makefile b/net-mgmt/librenms/Makefile
index bc6c50aef790..6f7ff9b9a6a3 100644
--- a/net-mgmt/librenms/Makefile
+++ b/net-mgmt/librenms/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	librenms
 PORTVERSION=	23.10.0
-PORTREVISION=	1
+PORTREVISION=	2
 PORTEPOCH=	1
 CATEGORIES=	net-mgmt
 MASTER_SITES=	LOCAL/dvl:vendor
@@ -178,6 +178,9 @@ do-install:
 .for f in ${_SCRIPT_FILES}
 	${INSTALL_SCRIPT} ${WRKSRC}/${f} ${STAGEDIR}/${WWWDIR}
 .endfor
+	# avoid: Error: lnms file is owned by root, it should be owned and ran by a non-privileged user
+	${ECHO_CMD} "@(www,wheel,0555) www/${PORTNAME}/lnms" >> ${TMPPLIST}
+
 	${MKDIR} ${STAGEDIR}/${WWWDIR}/vendor
 	(cd ${WRKDIR}/${PORTNAME}-vendor-${PORTVERSION} && ${COPYTREE_SHARE} . ${STAGEDIR}/${WWWDIR}/vendor)
 
@@ -219,7 +222,7 @@ do-install-EXAMPLES-on:
 post-install:
 	${FIND} -s ${STAGEDIR}${WWWDIR} -type f '(' -name '*.orig' -or -name '*.bak' -or -name '.gitignore' ')' -delete
 	${FIND} -s ${STAGEDIR}${WWWDIR} -not -type d | ${SORT} | \
-		${SED} -e 's#^${STAGEDIR}${PREFIX}/##' >> ${TMPPLIST}
+		${SED} -e 's#^${STAGEDIR}${PREFIX}/##' | grep -v www/librenms/lnms >> ${TMPPLIST}
 
 # we do this file separately because it needs a different chmod/chown
 # it will eventually contains secrets