Skip to content

Commit

Permalink
net-mgmt/librenms: remove /usr/bin/env usage
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dlangille committed Oct 4, 2023
1 parent 15b81e2 commit 8ff190a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 10 deletions.
26 changes: 16 additions & 10 deletions 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
Expand Down Expand Up @@ -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 \
Expand All @@ -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 \
Expand All @@ -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
Expand Down Expand Up @@ -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}

Expand Down
11 changes: 11 additions & 0 deletions 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:
21 changes: 21 additions & 0 deletions 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(

0 comments on commit 8ff190a

Please sign in to comment.