From nobody Wed Jul 17 13:12:32 2024 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WPGZ86z8Cz5RJdS; Wed, 17 Jul 2024 13:12:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WPGZ86X1Bz4n3G; Wed, 17 Jul 2024 13:12:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721221952; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ag+f2tkwRGN/D8Y88ktSisE6z7Zf2nJN9BJkdfSxiYI=; b=CT8TyOcQJtFT/lSroSdc3c6qsfodsVEPJT/vcePXSyXjOYm6tyjMcsaxLZ8OUR0aLC0MTT xJKBPdpBr1iVu8Q3LDYe6K+PuHfB2+dYvH37dUNiyG4wd7A88FVEHrqidiaklGauS2ZM9g E8/JDeF9gaYTrnszum3WsExLjaUHZJEFEA86GHNVqAyUjNBED132WCqXyxtf2MN4SC6TbS BQxnhe/rsftm1wyC6keiWqEwd6+qCK20P6JYLY+90C+cPCXwGT5IC8tdmWRtu0/+mN7ekN lY8RMtdSAdCrW4ZdiNkm2H/KytDbuzjN5SGNRtLQlGxavXRmXPgqb8iwxRhtoA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1721221952; a=rsa-sha256; cv=none; b=Sh59liiDA4Q+9wFaUxLFm/5id50iSpxWGW27wqwvy94NvZP7nInqzXqQvTlTzdrK2u6dR6 AluaQy1lhQGTQNE/m1woUkGJjbG7Mi+uLz/gmGMtaYcJp7S2bvDOWbiWBa8AO26yXhVlVz 2Va2RnJszxcslBOg/5fcO1cuT6+PhTpWOQ1l6NtdKO9Cd7e+Ip6mDK9BAY/1M1TClX1LFM 09gNdVGxJiDfS03RGUGWkejm0igoTRTWdWBOCaAjQAmEl8qlqkl12nBqLEf6MiCuW9vdYT X9zBugoOwL4bkceLFmyOUMmieGBb03NgA00xXP1HhszGkacHPzTpAbrRsaS3QQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721221952; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ag+f2tkwRGN/D8Y88ktSisE6z7Zf2nJN9BJkdfSxiYI=; b=UEtFA6QKtfmZXs7aR1ecYqEXSKCuxzfg8nAHEzxnvgC1nB3goRPulsu0O1HnESJ+rMBVrH WUb3R8HAY+OpcQdUVNFeF9H/4XRgYveG7Qy2EPmreNp71vLn4E4nT+r5MBt2evkjqrLkNc 2SwlRbSkvdY9LyIhyxhWzQpsx5sFfqJuCfdC2VHbjqUspEHujWNd8u9tbqn138tf9WSHhF v2XK3kZgomzjylDm0mc5OopWb4zUoyeNFH7SecssHwpiHndN4AyL8PE25NiEMJJmPpzKYf JECFU2emVJoAPPD+R0dm81vpY/S6YumM7IMyJM6uQW6GZv0Ph/hgTQpjFq//mg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WPGZ866vGz1Kfl; Wed, 17 Jul 2024 13:12:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46HDCWB7013945; Wed, 17 Jul 2024 13:12:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46HDCWjD013942; Wed, 17 Jul 2024 13:12:32 GMT (envelope-from git) Date: Wed, 17 Jul 2024 13:12:32 GMT Message-Id: <202407171312.46HDCWjD013942@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Dan Langille Subject: git: a918c77a1344 - main - net-mgmt/librenms: patch daily.sh with full paths List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-all@freebsd.org Sender: owner-dev-commits-ports-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dvl X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a918c77a13444c5bedfd7dbfb067f59bbb628976 Auto-Submitted: auto-generated The branch main has been updated by dvl: URL: https://cgit.FreeBSD.org/ports/commit/?id=a918c77a13444c5bedfd7dbfb067f59bbb628976 commit a918c77a13444c5bedfd7dbfb067f59bbb628976 Author: Dan Langille AuthorDate: 2024-07-10 15:58:55 +0000 Commit: Dan Langille CommitDate: 2024-07-17 13:09:17 +0000 net-mgmt/librenms: patch daily.sh with full paths References to bash and php now use %%LOCALBASE%% These errors seemed to cause the librenms service to fall over. Solves these types of errors: * /usr/local/www/librenms/daily.sh: line 30: php: command not found * /usr/local/www/librenms/daily.sh: line 63: bash: command not found --- net-mgmt/librenms/Makefile | 4 +- net-mgmt/librenms/files/patch-daily.sh | 76 ++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 1 deletion(-) diff --git a/net-mgmt/librenms/Makefile b/net-mgmt/librenms/Makefile index ac36c0e0131e..ec34d71a0601 100644 --- a/net-mgmt/librenms/Makefile +++ b/net-mgmt/librenms/Makefile @@ -1,5 +1,6 @@ PORTNAME= librenms PORTVERSION= 24.6.0 +PORTREVISION= 1 PORTEPOCH= 1 CATEGORIES= net-mgmt MASTER_SITES= LOCAL/dvl:vendor @@ -156,7 +157,8 @@ post-patch: ${WRKSRC}/config.php.default \ ${WRKSRC}/includes/html/output/capture.inc.php \ ${WRKSRC}/poller-wrapper.py \ - ${WRKSRC}/snmp-scan.py + ${WRKSRC}/snmp-scan.py \ + ${WRKSRC}/daily.sh ${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 diff --git a/net-mgmt/librenms/files/patch-daily.sh b/net-mgmt/librenms/files/patch-daily.sh new file mode 100644 index 000000000000..90e5b2f4a48e --- /dev/null +++ b/net-mgmt/librenms/files/patch-daily.sh @@ -0,0 +1,76 @@ +--- daily.sh.orig 2024-07-09 01:33:51 UTC ++++ daily.sh +@@ -23,11 +23,11 @@ LIBRENMS_DIR=$(dirname "$DAILY_SCRIPT") + # define DAILY_SCRIPT as the full path to this script and LIBRENMS_DIR as the directory this script is in + DAILY_SCRIPT=$(readlink -f "$0") + LIBRENMS_DIR=$(dirname "$DAILY_SCRIPT") +-COMPOSER="php ${LIBRENMS_DIR}/scripts/composer_wrapper.php --no-interaction" ++COMPOSER="%%LOCALBASE%%/bin/php ${LIBRENMS_DIR}/scripts/composer_wrapper.php --no-interaction" + + # set log_file, using librenms 'log_dir' config setting, if set + # otherwise we default to /logs +-LOG_DIR=$(php -r "@include '${LIBRENMS_DIR}/config.php'; echo isset(\$config['log_dir']) ? \$config['log_dir'] : '${LIBRENMS_DIR}/logs';") ++LOG_DIR=$(%%LOCALBASE%%/bin/php -r "@include '${LIBRENMS_DIR}/config.php'; echo isset(\$config['log_dir']) ? \$config['log_dir'] : '${LIBRENMS_DIR}/logs';") + + # get the librenms user + # shellcheck source=.env.example +@@ -60,7 +60,7 @@ status_run() { + + printf "%-50s" "${arg_text}" + echo "${arg_text}" >> "${log_file}" +- tmp=$(bash -c "${arg_command}" 2>&1) ++ tmp=$(%%LOCALBASE%%/bin/bash -c "${arg_command}" 2>&1) + exit_code=$? + echo "${tmp}" >> "${log_file}" + echo "Returned: ${exit_code}" >> "${log_file}" +@@ -72,7 +72,7 @@ status_run() { + else + printf " \\033[0;31mFAIL\\033[0m\\n" + if [[ "${arg_option}" == "update" ]]; then +- php "${LIBRENMS_DIR}/daily.php" -f notify -o "${tmp}" ++ %%LOCALBASE%%/bin/php "${LIBRENMS_DIR}/daily.php" -f notify -o "${tmp}" + fi + if [[ -n "${tmp}" ]]; then + # print output in case of failure +@@ -99,7 +99,7 @@ call_daily_php() { + args=("$@") + + for arg in "${args[@]}"; do +- php "${LIBRENMS_DIR}/daily.php" -f "${arg}" ++ %%LOCALBASE%%/bin/php "${LIBRENMS_DIR}/daily.php" -f "${arg}" + done + } + +@@ -121,7 +121,7 @@ set_notifiable_result() { + arg_type=$1 + arg_result=$2 + +- php "${LIBRENMS_DIR}/daily.php" -f handle_notifiable -t "${arg_type}" -r "${arg_result}" ++ %%LOCALBASE%%/bin/php "${LIBRENMS_DIR}/daily.php" -f handle_notifiable -t "${arg_type}" -r "${arg_result}" + } + + ####################################### +@@ -135,10 +135,10 @@ check_dependencies() { + branch=$(git rev-parse --abbrev-ref HEAD) + scripts/check_requirements.py > /dev/null 2>&1 || pip3 install -r requirements.txt > /dev/null 2>&1 + +- ver_71=$(php -r "echo (int)version_compare(PHP_VERSION, '7.1.3', '<');") +- ver_72=$(php -r "echo (int)version_compare(PHP_VERSION, '7.2.5', '<');") +- ver_73=$(php -r "echo (int)version_compare(PHP_VERSION, '7.3', '<');") +- ver_81=$(php -r "echo (int)version_compare(PHP_VERSION, '8.1', '<');") ++ ver_71=$(%%LOCALBASE%%/bin/php -r "echo (int)version_compare(PHP_VERSION, '7.1.3', '<');") ++ ver_72=$(%%LOCALBASE%%/bin/php -r "echo (int)version_compare(PHP_VERSION, '7.2.5', '<');") ++ ver_73=$(%%LOCALBASE%%/bin/php -r "echo (int)version_compare(PHP_VERSION, '7.3', '<');") ++ ver_81=$(%%LOCALBASE%%/bin/php -r "echo (int)version_compare(PHP_VERSION, '8.1', '<');") + python3=$(python3 -c "import sys;print(int(sys.version_info < (3, 4)))" 2> /dev/null) + python_deps=$("${LIBRENMS_DIR}/scripts/check_requirements.py" > /dev/null 2>&1; echo $?) + phpver="master" +@@ -276,7 +276,7 @@ main () { + fi + + if [[ -z "$arg" ]]; then +- up=$(php daily.php -f update >&2; echo $?) ++ up=$(%%LOCALBASE%%/bin/php daily.php -f update >&2; echo $?) + if [[ "$up" == "0" ]]; then + "${DAILY_SCRIPT}" no-code-update + set_notifiable_result update 1 # make sure there are no update notifications if update is disabled