mirror of
https://github.com/SCST-project/scst.git
synced 2026-09-01 21:59:33 +00:00
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:
+18
-14
@@ -84,9 +84,10 @@ function download_file {
|
||||
# Make sure the kernel tarball and patch file are present in directory
|
||||
# ${kernel_downloads}. Download any missing files from ${kernel_mirror}.
|
||||
function download_kernel {
|
||||
local kver="$(kernel_version "$1")"
|
||||
local plevel="$(patchlevel "$1")"
|
||||
local series="$1"
|
||||
local kver plevel series="$1"
|
||||
|
||||
kver="$(kernel_version "$1")"
|
||||
plevel="$(patchlevel "$1")"
|
||||
|
||||
series="${series/.*/}.x"
|
||||
|
||||
@@ -108,9 +109,10 @@ function download_kernel {
|
||||
}
|
||||
|
||||
function extract_kernel_archive {
|
||||
local kver="$(kernel_version "$1")"
|
||||
local plevel="$(patchlevel "$1")"
|
||||
local series="$1"
|
||||
local kver plevel series="$1"
|
||||
|
||||
kver="$(kernel_version "$1")"
|
||||
plevel="$(patchlevel "$1")"
|
||||
|
||||
if [ -e "${kernel_downloads}/linux-$1.tar.xz" ]; then
|
||||
( set -o pipefail
|
||||
@@ -134,10 +136,12 @@ function extract_kernel_archive {
|
||||
# Create a linux-$1 tree in the current directory, where $1 is a kernel
|
||||
# version number with either three or four components.
|
||||
function extract_kernel_tree {
|
||||
local kver="$(kernel_version "$1")"
|
||||
local plevel="$(patchlevel "$1")"
|
||||
local kver plevel
|
||||
local tmpdir=kernel-tree-tmp-$$
|
||||
|
||||
kver="$(kernel_version "$1")"
|
||||
plevel="$(patchlevel "$1")"
|
||||
|
||||
rm -rf "linux-$1" "${tmpdir}"
|
||||
mkdir "${tmpdir}" || return $?
|
||||
(
|
||||
@@ -702,11 +706,9 @@ EOF
|
||||
|
||||
# After patch-v4.14.1[12] has been applied, the execute bit has to be
|
||||
# set for sync-check.sh since patch can't do that.
|
||||
for f in "tools/objtool/sync-check.sh"; do
|
||||
if [ -e "$f" ]; then
|
||||
chmod a+x "$f"
|
||||
fi
|
||||
done
|
||||
if [ -e "tools/objtool/sync-check.sh" ]; then
|
||||
chmod a+x "tools/objtool/sync-check.sh"
|
||||
fi
|
||||
}
|
||||
|
||||
function rpm_payload_is_readable {
|
||||
@@ -770,7 +772,9 @@ function extract_rhel_kernel_archive {
|
||||
}
|
||||
|
||||
function download_and_extract_distro_rpm {
|
||||
[ -n "$1" ] || return $?
|
||||
[ -n "$1" ] || return 1
|
||||
# Split the kernel^distro^release triplet into positional parameters.
|
||||
# shellcheck disable=SC2086
|
||||
set -- ${1//^/ }
|
||||
local kver=$1
|
||||
local distro=$2
|
||||
|
||||
Reference in New Issue
Block a user