|
|
f226d6 |
From 8d3b5eeb684f0872069fbab9e3b6470aa6a04729 Mon Sep 17 00:00:00 2001
|
|
|
f226d6 |
From: Pavel Valena <pvalena@redhat.com>
|
|
|
f226d6 |
Date: Tue, 15 Feb 2022 21:06:21 +0100
|
|
|
f226d6 |
Subject: [PATCH] Fix shellcheck for a0d8caa8090a78f627f26fcd9b47c4b099cbc1ba
|
|
|
f226d6 |
|
|
|
f226d6 |
In modules.d/01fips/fips.sh line 137:
|
|
|
f226d6 |
((i++))
|
|
|
f226d6 |
^-----^ SC3006: In POSIX sh, standalone ((..)) is undefined.
|
|
|
f226d6 |
^-- SC3018: In POSIX sh, ++ is undefined.
|
|
|
f226d6 |
|
|
|
f226d6 |
In modules.d/01fips/fips.sh line 139:
|
|
|
f226d6 |
if [ $i -eq ${BOOT_IMAGE:-0} ] && [ -r "$bls" ]; then
|
|
|
f226d6 |
^-- SC2086: Double quote to prevent globbing and word splitting.
|
|
|
f226d6 |
^--------------^ SC2086: Double quote to prevent globbing and word splitting.
|
|
|
f226d6 |
|
|
|
f226d6 |
In modules.d/01fips/fips.sh line 141:
|
|
|
f226d6 |
BOOT_IMAGE=${BOOT_IMAGE:1}
|
|
|
f226d6 |
^-------------^ SC3057: In POSIX sh, string indexing is undefined.
|
|
|
f226d6 |
|
|
|
f226d6 |
Related: rhbz#2050567
|
|
|
f226d6 |
---
|
|
|
f226d6 |
modules.d/01fips/fips.sh | 13 +++++++------
|
|
|
f226d6 |
1 file changed, 7 insertions(+), 6 deletions(-)
|
|
|
f226d6 |
|
|
|
f226d6 |
diff --git a/modules.d/01fips/fips.sh b/modules.d/01fips/fips.sh
|
|
|
f226d6 |
index 3297cb17..bee061ab 100755
|
|
|
f226d6 |
--- a/modules.d/01fips/fips.sh
|
|
|
f226d6 |
+++ b/modules.d/01fips/fips.sh
|
|
|
f226d6 |
@@ -133,14 +133,15 @@ do_fips() {
|
|
|
f226d6 |
BOOT_IMAGE="vmlinuz-${KERNEL}"
|
|
|
f226d6 |
elif [ -d /boot/loader/entries ]; then
|
|
|
f226d6 |
i=0
|
|
|
f226d6 |
+ # shellcheck disable=SC2012
|
|
|
f226d6 |
for bls in $(ls -d /boot/loader/entries/*.conf | sort -rV); do
|
|
|
f226d6 |
- ((i++))
|
|
|
f226d6 |
+ i=$((i + 1))
|
|
|
f226d6 |
|
|
|
f226d6 |
- if [ $i -eq ${BOOT_IMAGE:-0} ] && [ -r "$bls" ]; then
|
|
|
f226d6 |
- BOOT_IMAGE="$(grep -e '^linux' "$bls" | grep -o ' .*$')"
|
|
|
f226d6 |
- BOOT_IMAGE=${BOOT_IMAGE:1}
|
|
|
f226d6 |
- break
|
|
|
f226d6 |
- fi
|
|
|
f226d6 |
+ if [ "$i" -eq "${BOOT_IMAGE:-0}" ] && [ -r "$bls" ]; then
|
|
|
f226d6 |
+ BOOT_IMAGE="$(grep -e '^linux' "$bls" | grep -o ' .*$')"
|
|
|
f226d6 |
+ BOOT_IMAGE=${BOOT_IMAGE## }
|
|
|
f226d6 |
+ break
|
|
|
f226d6 |
+ fi
|
|
|
f226d6 |
done
|
|
|
f226d6 |
fi
|
|
|
f226d6 |
fi
|
|
|
f226d6 |
|