Skip to content

Commit

Permalink
ntopng: patch out unportable test(1) operator to fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
0-wiz-0 committed Mar 30, 2022
1 parent 3308a17 commit f4e0ac6
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 2 deletions.
5 changes: 4 additions & 1 deletion net/ntopng/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.56 2022/03/28 19:32:24 adam Exp $
# $NetBSD: Makefile,v 1.57 2022/03/30 09:46:07 wiz Exp $

DISTNAME= ntopng-5.2.1
CATEGORIES= net
Expand Down Expand Up @@ -46,6 +46,9 @@ pre-configure:
post-build:
${FIND} ${WRKSRC}/httpdocs -type f -print0 | xargs -0 chmod a-x

post-install:
${RM} ${DESTDIR}${PREFIX}/share/ntopng/httpdocs/misc/ntopng-utils-manage-updates.in.orig

.include "../../archivers/zstd/buildlink3.mk"
.include "../../databases/hiredis/buildlink3.mk"
.include "../../databases/rrdtool/buildlink3.mk"
Expand Down
3 changes: 2 additions & 1 deletion net/ntopng/distinfo
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
$NetBSD: distinfo,v 1.12 2022/03/28 19:32:24 adam Exp $
$NetBSD: distinfo,v 1.13 2022/03/30 09:46:07 wiz Exp $

BLAKE2s (ntopng-5.2.1.tar.gz) = 11d1a6f878d0c02952bebf5a5813b265af47f6eb44b404acf9b2c4fc683c8aad
SHA512 (ntopng-5.2.1.tar.gz) = 01cdf21deac61a3b11e7d0e6b662c911123241332e812bb676cb8c5c003fe1d50a4c61231f9c327d467e89dd1345fc1bdbab5d2599fe04b04a8fe12654c01bdd
Size (ntopng-5.2.1.tar.gz) = 60280025 bytes
SHA1 (patch-Makefile.in) = 62ce8cadc3b0e026684545b2c7db24268352c5f3
SHA1 (patch-configure.ac.in) = ad1348831ebda24053c01a7312bd3458bccda819
SHA1 (patch-httpdocs_misc_ntopng-utils-manage-updates.in) = dd58ec396c6e2471c064307fd9bf1f31b0e0c9cf
SHA1 (patch-include_Redis.h) = ad7b03b9ebfb8b9786cca3f8c49ea24dc559ba12
SHA1 (patch-include_ntop__includes.h) = 2bf588dba941f25b71381c7848b237d964d77f31
SHA1 (patch-src_PacketDumperTuntap.cpp) = 76415461ebbe88d886111aa2d6508c7eec66b11d
Expand Down
113 changes: 113 additions & 0 deletions net/ntopng/patches/patch-httpdocs_misc_ntopng-utils-manage-updates.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
$NetBSD: patch-httpdocs_misc_ntopng-utils-manage-updates.in,v 1.1 2022/03/30 09:46:07 wiz Exp $

Fix unportable test(1) operator.

--- httpdocs/misc/ntopng-utils-manage-updates.in.orig 2022-02-03 18:00:06.000000000 +0000
+++ httpdocs/misc/ntopng-utils-manage-updates.in
@@ -64,7 +64,7 @@ else
fi
fi

-if [ "${OS}" == "DEBIAN" ]; then
+if [ "${OS}" = "DEBIAN" ]; then
# Check for nEdge
if dpkg --get-selections | grep -q "^nedge[[:space:]]*install$" >/dev/null; then
PRODUCT="nedge"
@@ -202,7 +202,7 @@ function maintenance_check() {

function service_enabled_check() {
SERVICE_ENABLED=$(/bin/systemctl is-enabled ${PRODUCT} 2>/dev/null)
- if [ ! "${SERVICE_ENABLED}" == "enabled" ]; then
+ if [ ! "${SERVICE_ENABLED}" = "enabled" ]; then
set_failure "service-not-enabled"
exit 0
fi
@@ -214,7 +214,7 @@ function run_upgrade() {

# Check if upgrade is in progress (it can take more than 1 min)
IN_PROGRESS=$(${REDIS_CLI} ${REDIS_CLI_OPT} GET ${REDIS_IN_PROGRESS_KEY} 2>/dev/null | grep 1)
- if [ "${IN_PROGRESS}" == "1" ]; then
+ if [ "${IN_PROGRESS}" = "1" ]; then
return
fi

@@ -224,7 +224,7 @@ function run_upgrade() {
logsetup $ACTION
log Requested $ACTION

- if [ "${OS}" == "DEBIAN" ]; then
+ if [ "${OS}" = "DEBIAN" ]; then
# Debian or Ubuntu

# Update repo index
@@ -284,7 +284,7 @@ function check_updates() {
logsetup $ACTION
log Requested $ACTION

- if [ "${OS}" == "DEBIAN" ]; then
+ if [ "${OS}" = "DEBIAN" ]; then
# Debian or Ubuntu

# Update repo index
@@ -331,7 +331,7 @@ function check_updates() {
if [ "${CRON_UPDATES}" = "1" ]; then
# Check if automatic updates are enabled by the user
AUTO_UPDATES=$(${REDIS_CLI} ${REDIS_CLI_OPT} GET ${REDIS_AUTO_UPDATES_KEY} 2>/dev/null | grep 1)
- if [ "${AUTO_UPDATES}" == "1" ]; then
+ if [ "${AUTO_UPDATES}" = "1" ]; then
run_upgrade
fi
fi
@@ -346,7 +346,7 @@ function check_updates() {
# Check if the user requested a 'Check for updates' manually
function check_updates_on_demand() {
CHECK_FOR_UPDATES=$(${REDIS_CLI} ${REDIS_CLI_OPT} GET ${REDIS_CHECK_FOR_UPDATES_KEY} 2>/dev/null | grep 1)
- if [ "${CHECK_FOR_UPDATES}" == "1" ]; then
+ if [ "${CHECK_FOR_UPDATES}" = "1" ]; then
stall_check
check_updates 0
${REDIS_CLI} ${REDIS_CLI_OPT} DEL ${REDIS_CHECK_FOR_UPDATES_KEY} >/dev/null 2>&1
@@ -357,7 +357,7 @@ function check_updates_on_demand() {
function handle_upgrade_requests() {
# Check redis for upgrade requests
UPGRADE=$(${REDIS_CLI} ${REDIS_CLI_OPT} GET ${REDIS_RUN_UPGRADE_KEY} 2>/dev/null | grep 1)
- if [ "${UPGRADE}" == "1" ]; then
+ if [ "${UPGRADE}" = "1" ]; then
stall_check
run_upgrade
fi
@@ -368,29 +368,29 @@ maintenance_check

# Check OEM mode
OEM_MODE=$(${REDIS_CLI} ${REDIS_CLI_OPT} EXISTS ${REDIS_PRODUCT_NAME_KEY} 2>/dev/null | grep 1)
-if [ "${OEM_MODE}" == "1" ]; then
+if [ "${OEM_MODE}" = "1" ]; then
# Exit unless there is an OEM source file
APT_SOURCE="ntop-oem.list"
eval $(apt-config shell APT_ETC Dir::Etc)
[ -e "/${APT_ETC}sources.list.d/${APT_SOURCE}" ] || exit 0
fi

-if [ $ACTION == "check-updates" ]; then
+if [ $ACTION = "check-updates" ]; then

# Run automatic update check when the ntopng service is enabled only
service_enabled_check

check_updates 1

-elif [ $ACTION == "check-updates-on-demand" ]; then
+elif [ $ACTION = "check-updates-on-demand" ]; then

check_updates_on_demand

-elif [ $ACTION == "handle-upgrade-requests" ]; then
+elif [ $ACTION = "handle-upgrade-requests" ]; then

handle_upgrade_requests

-elif [ $ACTION == "handle-on-demand-requests" ]; then
+elif [ $ACTION = "handle-on-demand-requests" ]; then
# Same as check-updates-on-demand + handle-upgrade-requests

check_updates_on_demand

0 comments on commit f4e0ac6

Please sign in to comment.