git: 8ff190a6fb75 - main - net-mgmt/librenms: remove /usr/bin/env usage

From: Dan Langille <dvl_at_FreeBSD.org>
Date: Wed, 04 Oct 2023 15:31:34 UTC
The branch main has been updated by dvl:

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

commit 8ff190a6fb75c40acd4ebf3a579187ebd8a26d57
Author:     Dan Langille <dvl@FreeBSD.org>
AuthorDate: 2023-10-04 14:10:57 +0000
Commit:     Dan Langille <dvl@FreeBSD.org>
CommitDate: 2023-10-04 15:30:33 +0000

    net-mgmt/librenms: remove /usr/bin/env usage
    
    This problem occurred on Nginx, but not Apache. Instead of
    "/usr/bin/env php", use "/usr/local/bin/php".
    
    While here:
    
    * add more to SHEBANG_FILES
    * portfmnt
    
    PR:             274248
---
 net-mgmt/librenms/Makefile                         | 26 +++++++++++++---------
 .../librenms/files/patch-LibreNMS_____init____.py  | 11 +++++++++
 net-mgmt/librenms/files/patch-snmp-scan.py         | 21 +++++++++++++++++
 3 files changed, 48 insertions(+), 10 deletions(-)

diff --git a/net-mgmt/librenms/Makefile b/net-mgmt/librenms/Makefile
index eb9d6042edfb..d3f45e23c89b 100644
--- a/net-mgmt/librenms/Makefile
+++ b/net-mgmt/librenms/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	librenms
 PORTVERSION=	23.9.1
+PORTREVISION=	1
 PORTEPOCH=	1
 CATEGORIES=	net-mgmt
 MASTER_SITES=	LOCAL/dvl:vendor
@@ -31,7 +32,8 @@ USE_PHP=	ctype curl dom fileinfo filter gd hash json ldap mbstring \
 		sockets tokenizer xml xmlwriter zip
 USE_RC_SUBR=	librenms
 
-SHEBANG_FILES=	../${PORTNAME}-vendor-${PORTVERSION}/tecnickcom/tcpdf/tools/tcpdf_addfont.php \
+SHEBANG_FILES=	../${PORTNAME}-vendor-${PORTVERSION}/paragonie/random_compat/build-phar.sh \
+		../${PORTNAME}-vendor-${PORTVERSION}/tecnickcom/tcpdf/tools/tcpdf_addfont.php \
 		../librenms-vendor-${PORTVERSION}/bin/carbon \
 		../librenms-vendor-${PORTVERSION}/bin/doctrine-dbal \
 		../librenms-vendor-${PORTVERSION}/bin/patch-type-declarations \
@@ -50,15 +52,19 @@ SHEBANG_FILES=	../${PORTNAME}-vendor-${PORTVERSION}/tecnickcom/tcpdf/tools/tcpdf
 		../librenms-vendor-${PORTVERSION}/symfony/var-dumper/Resources/bin/var-dump-server \
 		../librenms-vendor-${PORTVERSION}/symfony/yaml/Resources/bin/yaml-lint \
 		addhost.php alerts.php artisan billing-calculate.php \
-		check-services.php config_to_json.php daily.php delhost.php \
-		discovery.php dist-pollers.php irc.php LibreNMS/wrapper.py lnms \
-		ping.php poll-billing.php poller-wrapper.py poller.php \
-		renamehost.php scripts/auth_test.php \
+		check-services.php config_to_json.php cronic daily.php daily.sh \
+		delhost.php discovery-wrapper.py discovery.php dist-pollers.php \
+		irc.php librenms-service.py LibreNMS/command_runner.py \
+		LibreNMS/wrapper.py lnms misc/lnms-completion.bash \
+		misc/smokeping-debian.example misc/smokeping-rhel.example \
+		pbin.sh ping.php poll-billing.php poller-wrapper.py poller.php \
+		renamehost.php scripts/auth_test.php scripts/bash_lint.sh \
 		scripts/check_requirements.py scripts/collect-port-polling.php \
 		scripts/collect-snmp-data.php scripts/composer_wrapper.php \
 		scripts/dynamic_check_requirements.py scripts/gen_rancid.php \
-		scripts/gen_smokeping.php scripts/github-remove scripts/ifAlias \
-		scripts/json-app-tool.php scripts/manage_bills.php \
+		scripts/gen_smokeping.php scripts/git-pre-commit-hook.sh \
+		scripts/github-remove scripts/ifAlias scripts/json-app-tool.php \
+		scripts/manage_bills.php \
 		scripts/Migration/Standard_Conversion/convert_no_xml.sh \
 		scripts/Migration/Standard_Conversion/destwork_no_xml.sh \
 		scripts/Migration/Standard_Conversion/mkdir.sh \
@@ -71,7 +77,7 @@ SHEBANG_FILES=	../${PORTNAME}-vendor-${PORTVERSION}/tecnickcom/tcpdf/tools/tcpdf
 		scripts/save-test-data.php scripts/syslog-notify-oxidized.php \
 		scripts/test-alert.php scripts/test-template.php \
 		scripts/tune_port.php scripts/watchmaillog/watchmaillog.pl \
-		snmptrap.php syslog.php validate.php
+		snmp-scan.py snmptrap.php syslog.php validate.php
 
 NO_ARCH=	yes
 NO_BUILD=	yes
@@ -241,8 +247,8 @@ post-install:
 	${ECHO_CMD} "@dir etc/cron.d" >> ${TMPPLIST}
 	${ECHO_CMD} "etc/cron.d/librenms" >> ${TMPPLIST}
 
-	# avoid the "Global lnms shortcut not installed." validataion warning.
-	# this can also be run as root.
+# avoid the "Global lnms shortcut not installed." validataion warning.
+# this can also be run as root.
 	${RLN} ${STAGEDIR}${WWWDIR}/lnms ${STAGEDIR}${PREFIX}/bin/lnms
 	${ECHO_CMD} "bin/lnms" >> ${TMPPLIST}
 
diff --git a/net-mgmt/librenms/files/patch-LibreNMS_____init____.py b/net-mgmt/librenms/files/patch-LibreNMS_____init____.py
new file mode 100644
index 000000000000..bf16fd97c055
--- /dev/null
+++ b/net-mgmt/librenms/files/patch-LibreNMS_____init____.py
@@ -0,0 +1,11 @@
+--- LibreNMS/__init__.py.orig	2023-10-04 13:52:17 UTC
++++ LibreNMS/__init__.py
+@@ -167,7 +167,7 @@ def get_config_data(base_dir):
+         )
+         logger.debug("Traceback:", exc_info=True)
+ 
+-    config_cmd = ["/usr/bin/env", "php", "%s/config_to_json.php" % base_dir]
++    config_cmd = "/usr/local/bin/php %s/config_to_json.php" % base_dir
+     try:
+         exit_code, output = command_runner(config_cmd, timeout=300, stderr=False)
+         if exit_code != 0:
diff --git a/net-mgmt/librenms/files/patch-snmp-scan.py b/net-mgmt/librenms/files/patch-snmp-scan.py
new file mode 100644
index 000000000000..8c8ad9ddfc03
--- /dev/null
+++ b/net-mgmt/librenms/files/patch-snmp-scan.py
@@ -0,0 +1,21 @@
+--- snmp-scan.py.orig	2023-10-04 12:28:53 UTC
++++ snmp-scan.py
+@@ -133,8 +133,7 @@ def scan_host(scan_ip):
+                 return Result(scan_ip, hostname, Outcome.NODNS, "DNS not Resolved")
+ 
+             arguments = [
+-                "/usr/bin/env",
+-                "lnms",
++                "/usr/local/bin/lnms",
+                 "device:add",
+                 "-g",
+                 POLLER_GROUP,
+@@ -259,7 +258,7 @@ Example: 192.168.0.1/32 will be treated as a single ho
+     chdir(install_dir)
+     try:
+         CONFIG = json.loads(
+-            check_output(["/usr/bin/env", "php", "config_to_json.php"]).decode()
++            check_output(["/usr/local/bin/php", "config_to_json.php"]).decode()
+         )
+     except CalledProcessError as e:
+         parser.error(