scripts: Fix shellcheck errors
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m23s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m30s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m2s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m6s
CI / Packaging test (push) Successful in 0s

Fix shellcheck SC2068 (unquoted array expansions), SC2145 (mixed string/array arguments), SC2328 (redirection in command substitution), SC2173 (untrapable signals), and SC2148 (missing shebang) errors across 14 script files.

Also configure scripts/Makefile with --severity=error so that only errors (not warnings or notes) cause check failures. To be tightened by follow-up commits.

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-06-25 21:42:22 +02:00
commit 77c746571a
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61
15 changed files with 47 additions and 44 deletions

View file

@ -3,3 +3,5 @@ TOPDIR = ..
include $(TOPDIR)/make/proj.mk include $(TOPDIR)/make/proj.mk
include $(JWBDIR)/make/scripts.mk include $(JWBDIR)/make/scripts.mk
include $(JWBDIR)/make/dirs.mk include $(JWBDIR)/make/dirs.mk
SHELLCHECK += --severity=error

View file

@ -7,12 +7,12 @@ _cat()
cfg_section() cfg_section()
{ {
ini_section "$inifile" $@ ini_section "$inifile" "$@"
} }
cfg_value() cfg_value()
{ {
ini_value "$inifile" $@ ini_value "$inifile" "$@"
} }
# -- here we go # -- here we go

View file

@ -7,12 +7,12 @@ _cat()
cfg_section() cfg_section()
{ {
ini_section "$inifile" $@ ini_section "$inifile" "$@"
} }
cfg_value() cfg_value()
{ {
ini_value "$inifile" $@ ini_value "$inifile" "$@"
} }
cfg_escape() cfg_escape()

View file

@ -2,14 +2,14 @@
log_dpkg() log_dpkg()
{ {
echo dpkg $@ printf '%s\n' "dpkg $*"
/usr/bin/dpkg $@ /usr/bin/dpkg "$@"
} }
run() run()
{ {
echo $@ printf '%s\n' "$*"
eval $@ eval "$@"
} }
# to be used on debian prior to jessie # to be used on debian prior to jessie
@ -112,9 +112,9 @@ cmd_query()
local p=`echo $1 | sed 's/-[0-9.-]\+$//'` local p=`echo $1 | sed 's/-[0-9.-]\+$//'`
local v=`echo $1 | sed "s/^$p-*//"` local v=`echo $1 | sed "s/^$p-*//"`
local ip=`dpkg-query -W -f '${Package}' $p >/dev/null 2>&1` local ip=$(dpkg-query -W -f '${Package}' "$p" 2>/dev/null)
[ $? != 0 -o -z "$ip" ] && exit 1 [ $? != 0 -o -z "$ip" ] && exit 1
local iv=`dpkg-query -W -f '${Version}' $p >/dev/null 2>&1` local iv=$(dpkg-query -W -f '${Version}' "$p" 2>/dev/null)
[ "$v" ] && { [ "$v" ] && {
[ "$v" != "$iv" ] && { [ "$v" != "$iv" ] && {
echo "tried $1, installed version is $iv" >&2 echo "tried $1, installed version is $iv" >&2
@ -134,7 +134,7 @@ usage()
fatal() fatal()
{ {
echo $@ >&2 printf '%s\n' "$*" >&2
exit 1 exit 1
} }

View file

@ -26,19 +26,19 @@ EOT
log() log()
{ {
echo $@ printf '%s\n' "$*"
logger -t $myname "$@" logger -t "$myname" "$*"
} }
err() err()
{ {
echo $@ >&2 printf '%s\n' "$*" >&2
logger -t $myname "error: $@" logger -t "$myname" -- "error: $*"
} }
fatal() fatal()
{ {
err "fatal: $@" err "fatal: $*"
exit 1 exit 1
} }
@ -68,7 +68,7 @@ md_p()
{ {
[ -d "$1" ] && return [ -d "$1" ] && return
md_p `dirname "$1"` $2 $3 $4 md_p `dirname "$1"` $2 $3 $4
md $@ md "$@"
} }
cmd_cmd_create_repo_dir() cmd_cmd_create_repo_dir()

View file

@ -1,3 +1,4 @@
#!/bin/sh
ini_section() ini_section()
{ {
local inifile="$1" local inifile="$1"
@ -43,7 +44,7 @@ ini_has_section()
ini_has_value() ini_has_value()
{ {
ini_value $@ | grep -q . ini_value "$@" | grep -q .
} }
ini_escape() ini_escape()

View file

@ -2,17 +2,17 @@
log() log()
{ {
echo $@ printf '%s\n' "$*"
} }
err() err()
{ {
log $@ log "$*"
} }
fatal() fatal()
{ {
err $@ err "$*"
exit 1 exit 1
} }

View file

@ -10,7 +10,7 @@ append()
{ {
local var=$1 local var=$1
shift shift
local tmp=`eval echo \"\\$$var $@\" | sed 's/^[[:space:]]*//; s/[[:space:]]*$//'` local tmp=`eval echo \"\\$$var $*\" | sed 's/^[[:space:]]*//; s/[[:space:]]*$//'`
eval $var=\"$tmp\" eval $var=\"$tmp\"
} }

View file

@ -32,7 +32,7 @@ counter()
marker() marker()
{ {
log "# -------------$(counter) $@" log "# -------------$(counter) $*"
} }
fat_marker() fat_marker()
@ -41,7 +41,7 @@ fat_marker()
marker "$@" marker "$@"
return return
fi fi
log "# ====================================================$(counter) $@" log "# ====================================================$(counter) $*"
} }
log_start_stop() log_start_stop()
@ -204,7 +204,7 @@ cmd_get()
long_opts="$long_opts,refspec:" long_opts="$long_opts,refspec:"
local opts local opts
opts=$(getopt -o C --long "$long_opts" -n get -- "$@") || fatal "Failed to parse options $@" opts=$(getopt -o C --long "$long_opts" -n get -- "$@") || fatal "Failed to parse options $*"
eval set -- "$opts" eval set -- "$opts"
while [ "$1" != -- ]; do while [ "$1" != -- ]; do
case "$1" in case "$1" in

View file

@ -2,7 +2,7 @@
log() log()
{ {
echo $@ printf '%s\n' "$*"
} }
goodbye() goodbye()
@ -29,7 +29,7 @@ EOT
fatal() fatal()
{ {
log "$@" log "$*"
log "Giving up." log "Giving up."
quit 1 quit 1
} }
@ -47,7 +47,7 @@ get_os()
cfg_section() cfg_section()
{ {
ini_section "$inifile" $@ ini_section "$inifile" "$@"
} }
scm_commit() scm_commit()
@ -77,7 +77,7 @@ abspath()
read_map() read_map()
{ {
cmd_version -p `platform` $@ read | sed 's/-dev//' cmd_version -p `platform` "$@" read | sed 's/-dev//'
} }
write_map() write_map()
@ -88,13 +88,13 @@ write_map()
find_path() find_path()
{ {
local p local p
for p in $@; do for p in "$@"; do
[ -e "$p" ] && { [ -e "$p" ] && {
echo $p echo $p
return 0 return 0
} }
done done
fatal "none of the paths \"$@\" exists" fatal "none of the paths \"$*\" exists"
} }
scm_files() scm_files()
@ -148,7 +148,7 @@ check_cwd()
create_empty_dir() create_empty_dir()
{ {
[ $# != 2 ] && \ [ $# != 2 ] && \
fatal "Unable to create empty directory \"$@\"." fatal "Unable to create empty directory \"$*\"."
local dir="$1" local dir="$1"
shift shift
@ -439,7 +439,7 @@ build_pkg()
local distribution=`get_os` local distribution=`get_os`
expand_version_macros() { expand_version_macros() {
echo $@ | sed "s/__NEXT_VERSION__/$version/g; s/VERSION-REVISION/$version/g; s/VERSION/$version/g" echo "$@" | sed "s/__NEXT_VERSION__/$version/g; s/VERSION-REVISION/$version/g; s/VERSION/$version/g"
} }
local rpm_requires_run=`expand_version_macros $PKG_REQUIRES_RUN` local rpm_requires_run=`expand_version_macros $PKG_REQUIRES_RUN`
@ -1122,7 +1122,7 @@ cmd_milk_install_log()
# ---- here we go # ---- here we go
umask 0022 umask 0022
trap goodbye SIGINT SIGKILL trap goodbye SIGINT
# -- default values # -- default values
TOPDIR=. TOPDIR=.

View file

@ -2,12 +2,12 @@
log() log()
{ {
echo $@ printf '%s\n' "$*"
} }
fatal() fatal()
{ {
log $@ log "$*"
exit 1 exit 1
} }
@ -47,7 +47,7 @@ date=`date +'%Y%m%d'`
myname=`basename $0` myname=`basename $0`
vcss="git" vcss="git"
opts=$(getopt -o C --long "vcs:" -n $myname -- "$@") || fatal "Failed to parse options $@" opts=$(getopt -o C --long "vcs:" -n $myname -- "$*") || fatal "Failed to parse options $*"
eval set -- "$opts" eval set -- "$opts"
while [ "$1" != -- ]; do while [ "$1" != -- ]; do
case "$1" in case "$1" in
@ -81,7 +81,7 @@ for vcs in $vcss; do
$ssh $host echo hallo >/dev/null 2>&1 || fatal "Can't ssh into host $host" $ssh $host echo hallo >/dev/null 2>&1 || fatal "Can't ssh into host $host"
done done
trap goodbye EXIT INT QUIT KILL trap goodbye EXIT INT QUIT
scm_status=`mktemp /tmp/$myname""_XXXXXX` scm_status=`mktemp /tmp/$myname""_XXXXXX`
for vcs in $vcss; do for vcs in $vcss; do

View file

@ -88,7 +88,7 @@ cmd_create_init()
else else
echo echo
echo "__all__ = [" echo "__all__ = ["
for dst_type in ${!seen[@]}; do for dst_type in "${!seen[@]}"; do
echo " \"$dst_type\"," echo " \"$dst_type\","
done done
echo "]" echo "]"

View file

@ -51,7 +51,7 @@ cmd_clean()
done done
set +e set +e
local file local file
for file in $@; do for file in "$@"; do
if ! grep -q "/$file/" CVS/Entries; then if ! grep -q "/$file/" CVS/Entries; then
rm -f $file rm -f $file
fi fi

View file

@ -13,6 +13,6 @@ fi
title="------------ $reason ------------" title="------------ $reason ------------"
echo ",$title >" echo ",$title >"
echo "| Ignored: systemctl $@" echo "| Ignored: systemctl $*"
echo "\`$title <" echo "\`$title <"
exit 0 exit 0

View file

@ -108,17 +108,17 @@ EOT
log() log()
{ {
echo $@ printf '%s\n' "$*"
} }
err() err()
{ {
log $@ log "$*"
} }
fatal() fatal()
{ {
err $@ err "$*"
exit 1 exit 1
} }