scripts: Fix ShellCheck diagnostics

Quote scalar arguments and use arrays for command option lists so paths
and options retain their boundaries. Preserve intentional version-field
splitting with narrow documented suppressions.

Also handle GNU getopt output without losing quoted arguments and
remove warnings about masked statuses, unused values and ambiguous test
expressions.
This commit is contained in:
Gleb Chesnokov
2026-08-21 19:58:59 +03:00
parent 055865e734
commit f788bfd0d6
4 changed files with 111 additions and 68 deletions
+6
View File
@@ -107,10 +107,14 @@ EOF
# passed via stdin and send the specialized patch to stdout.
function specialize_patch {
local ao
# Split the kernel^distro^release triplet into positional parameters.
# shellcheck disable=SC2086
set -- ${1//^/ }
local kver=$1
local distro=$2
local release=$3
# Split the distribution release into major and minor components.
# shellcheck disable=SC2086
set -- ${release//./ }
local releasevermajor="$1"
local releaseverminor="$2"
@@ -130,6 +134,8 @@ function specialize_patch {
;;
esac
local kver3
# Split the kernel release into numeric components.
# shellcheck disable=SC2086
set -- ${kver//[.-]/ }
if [ -n "$3" ]; then
kver3=$1.$2.$3