From ddf638ee96ab2ca8b871a08cb2d897362342af9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Bar=C4=87?= Date: Wed, 18 Dec 2024 21:08:38 +0100 Subject: [PATCH 1/2] snap-tools: use sh as interpreter; misc tweaks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * use sh as interpreter since we already have sh compatibility, * sh-compat: only change export to be on 2 lines, * quote MAGIC and exec call Signed-off-by: Maciej Barć --- snap-tools/keepalived-wrapper | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/snap-tools/keepalived-wrapper b/snap-tools/keepalived-wrapper index a98e301d27..5e76996e32 100755 --- a/snap-tools/keepalived-wrapper +++ b/snap-tools/keepalived-wrapper @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh MAJ_VER=$(uname -r | cut -d'.' -f1) MIN_VER=$(uname -r | cut -d'.' -f2) @@ -22,6 +22,7 @@ exit 1 fi # The magic file must be the one in the snap -export MAGIC=${SNAP}/usr/share/misc/magic +MAGIC="${SNAP}/usr/share/misc/magic" +export MAGIC -exec ${SNAP}/usr/sbin/${BINARY} "$@" +exec "${SNAP}/usr/sbin/${BINARY}" "$@" From 9f371cc1b849763b1ee3a1f193b127f46fa7a6ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Bar=C4=87?= Date: Wed, 18 Dec 2024 21:14:56 +0100 Subject: [PATCH 2/2] goodies: use bash mapfile and array to store found C files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maciej Barć --- goodies/check_conditional_tests | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/goodies/check_conditional_tests b/goodies/check_conditional_tests index 21a2d5681b..cf4ff7a71e 100755 --- a/goodies/check_conditional_tests +++ b/goodies/check_conditional_tests @@ -1,9 +1,12 @@ -#!/bin/bash +#!/usr/bin/env bash # Get a count of each defined term used in #if directives # This can be useful to check for typos in the names -grep "#[ \t]*if" $(find . -name "*.[ch]") | \ +declare -a c_src_files=() +mapfile -t c_src_files < <(find . -name "*.[ch]") + +grep "#[ \t]*if" "${c_src_files[@]}" | \ grep -v "_H$" | \ sed -e "s/.*://" | \ sed -e "s/#ifn*def *//" -e "s/#if *//" | \