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 $(JWBDIR)/make/scripts.mk
include $(JWBDIR)/make/dirs.mk
SHELLCHECK += --severity=error

View file

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

View file

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

View file

@ -2,14 +2,14 @@
log_dpkg()
{
echo dpkg $@
/usr/bin/dpkg $@
printf '%s\n' "dpkg $*"
/usr/bin/dpkg "$@"
}
run()
{
echo $@
eval $@
printf '%s\n' "$*"
eval "$@"
}
# to be used on debian prior to jessie
@ -112,9 +112,9 @@ cmd_query()
local p=`echo $1 | sed 's/-[0-9.-]\+$//'`
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
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" != "$iv" ] && {
echo "tried $1, installed version is $iv" >&2
@ -134,7 +134,7 @@ usage()
fatal()
{
echo $@ >&2
printf '%s\n' "$*" >&2
exit 1
}

View file

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

View file

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

View file

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

View file

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

View file

@ -32,7 +32,7 @@ counter()
marker()
{
log "# -------------$(counter) $@"
log "# -------------$(counter) $*"
}
fat_marker()
@ -41,7 +41,7 @@ fat_marker()
marker "$@"
return
fi
log "# ====================================================$(counter) $@"
log "# ====================================================$(counter) $*"
}
log_start_stop()
@ -204,7 +204,7 @@ cmd_get()
long_opts="$long_opts,refspec:"
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"
while [ "$1" != -- ]; do
case "$1" in

View file

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

View file

@ -2,12 +2,12 @@
log()
{
echo $@
printf '%s\n' "$*"
}
fatal()
{
log $@
log "$*"
exit 1
}
@ -47,7 +47,7 @@ date=`date +'%Y%m%d'`
myname=`basename $0`
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"
while [ "$1" != -- ]; do
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"
done
trap goodbye EXIT INT QUIT KILL
trap goodbye EXIT INT QUIT
scm_status=`mktemp /tmp/$myname""_XXXXXX`
for vcs in $vcss; do

View file

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

View file

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

View file

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

View file

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