aboutsummaryrefslogtreecommitdiff
path: root/net-mgmt
diff options
context:
space:
mode:
authorDan Langille <dvl@FreeBSD.org>2023-10-08 18:36:12 +0000
committerDan Langille <dvl@FreeBSD.org>2023-10-08 18:40:59 +0000
commit7d8ac44c90242ecd1656ce0c5a5c68910afb712b (patch)
tree73e9cc1f4121f17e3562f9767f2544ea17e269b8 /net-mgmt
parenteb9f07125e7dba4f6666f8542632ee636970b272 (diff)
downloadports-7d8ac44c90242ecd1656ce0c5a5c68910afb712b.tar.gz
ports-7d8ac44c90242ecd1656ce0c5a5c68910afb712b.zip
net-mgmt/librenms: Improve patching
Instead of patching to /usr/local, patch to %%LOCALBASE%%, then use SED to patch to ${LOCALBASE} Reported by: osa
Diffstat (limited to 'net-mgmt')
-rw-r--r--net-mgmt/librenms/Makefile27
-rw-r--r--net-mgmt/librenms/files/patch-LibreNMS_Validations_System.php2
-rw-r--r--net-mgmt/librenms/files/patch-LibreNMS_____init____.py2
-rw-r--r--net-mgmt/librenms/files/patch-LibreNMS_wrapper.py2
-rw-r--r--net-mgmt/librenms/files/patch-snmp-scan.py4
5 files changed, 20 insertions, 17 deletions
diff --git a/net-mgmt/librenms/Makefile b/net-mgmt/librenms/Makefile
index 1b64004a9593..00627645df7a 100644
--- a/net-mgmt/librenms/Makefile
+++ b/net-mgmt/librenms/Makefile
@@ -1,6 +1,6 @@
PORTNAME= librenms
PORTVERSION= 23.9.1
-PORTREVISION= 2
+PORTREVISION= 3
PORTEPOCH= 1
CATEGORIES= net-mgmt
MASTER_SITES= LOCAL/dvl:vendor
@@ -150,17 +150,20 @@ _OTHER_DIRS= database/seeders/config html/plugins html/js/lang \
vendor/symfony/string/Resources/bin
post-patch:
- ${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/LibreNMS/Validations/Php.php
- ${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/LibreNMS/Util/Version.php
- ${REINPLACE_CMD} 's|%%PORTVERSION%%|${PORTVERSION}|g' ${WRKSRC}/LibreNMS/Util/Version.php
- ${REINPLACE_CMD} 's|%%RELEASE_TIMESTAMP%%|${_RELEASE_TIMESTAMP}|g' ${WRKSRC}/LibreNMS/Util/Version.php
- ${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/LibreNMS/Validations/System.php
- ${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/includes/html/output/capture.inc.php
- ${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/config.php.default
- ${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/poller-wrapper.py
- ${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/dist/librenms-scheduler.cron
- ${REINPLACE_CMD} 's|%%WWWDIR%%|${WWWDIR}|g' ${WRKSRC}/dist/librenms-scheduler.cron
- ${REINPLACE_CMD} 's|%%USER%%|${WWWOWN}|g' ${WRKSRC}/dist/librenms-scheduler.cron
+ ${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
+ ${WRKSRC}/LibreNMS/__init__.py \
+ ${WRKSRC}/LibreNMS/wrapper.py \
+ ${WRKSRC}/LibreNMS/Util/Version.php \
+ ${WRKSRC}/LibreNMS/Validations/Php.php \
+ ${WRKSRC}/LibreNMS/Validations/System.php \
+ ${WRKSRC}/config.php.default \
+ ${WRKSRC}/includes/html/output/capture.inc.php \
+ ${WRKSRC}/poller-wrapper.py \
+ ${WRKSRC}/snmp-scan.py
+ ${REINPLACE_CMD} 's|%%PORTVERSION%%|${PORTVERSION}|g' ${WRKSRC}/LibreNMS/Util/Version.php
+ ${REINPLACE_CMD} 's|%%RELEASE_TIMESTAMP%%|${_RELEASE_TIMESTAMP}|g' ${WRKSRC}/LibreNMS/Util/Version.php
+ ${REINPLACE_CMD} 's|%%WWWDIR%%|${WWWDIR}|g' ${WRKSRC}/dist/librenms-scheduler.cron
+ ${REINPLACE_CMD} 's|%%USER%%|${WWWOWN}|g' ${WRKSRC}/dist/librenms-scheduler.cron
${RM} ${WRKSRC}/LibreNMS/Validations/Updates.php
${RM} -rf ${WRKSRC}/logs
diff --git a/net-mgmt/librenms/files/patch-LibreNMS_Validations_System.php b/net-mgmt/librenms/files/patch-LibreNMS_Validations_System.php
index 744b3533df01..961ebfbeaaac 100644
--- a/net-mgmt/librenms/files/patch-LibreNMS_Validations_System.php
+++ b/net-mgmt/librenms/files/patch-LibreNMS_Validations_System.php
@@ -5,7 +5,7 @@
$install_dir = $validator->getBaseDir();
- $lnms = str_replace('lnms:', '', rtrim(`whereis -b lnms 2>/dev/null`));
-+ $lnms = rtrim(`/usr/bin/find /usr/local/bin -name lnms`);
++ $lnms = rtrim(`/usr/bin/find %%LOCALBASE%%/bin -name lnms`);
$path = rtrim(`echo "\$PATH"`);
// if couldn't find lnms and we have PATH
diff --git a/net-mgmt/librenms/files/patch-LibreNMS_____init____.py b/net-mgmt/librenms/files/patch-LibreNMS_____init____.py
index a5a301d57649..a648688daae8 100644
--- a/net-mgmt/librenms/files/patch-LibreNMS_____init____.py
+++ b/net-mgmt/librenms/files/patch-LibreNMS_____init____.py
@@ -14,7 +14,7 @@
if script.endswith(".php"):
# save calling the sh process
- base = ("/usr/bin/env", "php")
-+ base = ("/usr/local/bin/php",)
++ base = ("%%LOCALBASE%%/bin/php",)
else:
base = ()
diff --git a/net-mgmt/librenms/files/patch-LibreNMS_wrapper.py b/net-mgmt/librenms/files/patch-LibreNMS_wrapper.py
index d0f9187b21cf..d37958f3ac0a 100644
--- a/net-mgmt/librenms/files/patch-LibreNMS_wrapper.py
+++ b/net-mgmt/librenms/files/patch-LibreNMS_wrapper.py
@@ -5,7 +5,7 @@
wrappers[wrapper_type]["executable"],
)
- command = "/usr/bin/env php {} -h {}".format(executable, device_id)
-+ command = "/usr/local/bin/php php {} -h {}".format(executable, device_id)
++ command = "%%LOCALBASE%%/bin/php php {} -h {}".format(executable, device_id)
if modules is not None and len(str(modules).strip()):
module_str = re.sub("\s", "", str(modules).strip())
command = command + " -m {}".format(module_str)
diff --git a/net-mgmt/librenms/files/patch-snmp-scan.py b/net-mgmt/librenms/files/patch-snmp-scan.py
index 8c8ad9ddfc03..35f95c508731 100644
--- a/net-mgmt/librenms/files/patch-snmp-scan.py
+++ b/net-mgmt/librenms/files/patch-snmp-scan.py
@@ -6,7 +6,7 @@
arguments = [
- "/usr/bin/env",
- "lnms",
-+ "/usr/local/bin/lnms",
++ "%%LOCALBASE%%/bin/lnms",
"device:add",
"-g",
POLLER_GROUP,
@@ -15,7 +15,7 @@
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()
++ check_output(["%%LOCALBASE%%/bin/php", "config_to_json.php"]).decode()
)
except CalledProcessError as e:
parser.error(