From 5d7e7977e14e147d5bcfa8a5f01636c7ab230fa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= Date: Sun, 28 Feb 2021 13:46:35 +0100 Subject: [PATCH] defaults.sh: Don't override INSMOD variable if it is already set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @SpareSimian noticed that sqm-scripts would always use 'insmod' to load modules on CentOS even though modprobe was also available. @gordonmessmer noticed that this was due to the way the shell chains '&&' and '||' operators, which would evaluate the second assignment if the first zero-length check fails. And since defaults.sh is included from both 'start-sqm' and the .qos scripts, this double-evaluation always happens on non-OpenWrt installations. Fix this by properly grouping the assignment operators so they are evaluated together if the variable is unset. Fixes #133. Signed-off-by: Toke Høiland-Jørgensen --- src/defaults.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/defaults.sh b/src/defaults.sh index 5af7eb5..6a7e3d9 100644 --- a/src/defaults.sh +++ b/src/defaults.sh @@ -39,7 +39,7 @@ # Try modprobe first, fall back to insmod -[ -z "$INSMOD" ] && INSMOD=$(which modprobe) || INSMOD=$(which insmod) +[ -z "$INSMOD" ] && { INSMOD=$(which modprobe) || INSMOD=$(which insmod); } [ -z "$TARGET" ] && TARGET="5ms" [ -z "$IPT_MASK" ] && IPT_MASK="0xff" # to disable: set mask to 0xffffffff #sm: we need the functions above before trying to set the ingress IFB device