From 6b5337883982f88d3f956db3b3bac470651b210f Mon Sep 17 00:00:00 2001 From: Steffen Maier Date: Tue, 25 Jul 2023 16:33:21 +0200 Subject: [PATCH] zdev/dracut/95zdev: non-functional changes and annotations for shellcheck MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clears all shellcheck reports in old existing code so newly added code can use shellcheck to find newly introduced suboptimal shell code. Github-ID: https://github.com/ibm-s390-linux/s390-tools/pull/158 Reviewed-by: Marc Hartmayer Reviewed-by: Vineeth Vijayan Acked-by: Vineeth Vijayan Acked-by: Peter Oberparleiter Signed-off-by: Steffen Maier Signed-off-by: Jan Höppner --- zdev/dracut/95zdev/module-setup.sh | 11 ++++++----- zdev/dracut/95zdev/parse-zdev.sh | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/zdev/dracut/95zdev/module-setup.sh b/zdev/dracut/95zdev/module-setup.sh index e81bd99e..a47495dc 100644 --- a/zdev/dracut/95zdev/module-setup.sh +++ b/zdev/dracut/95zdev/module-setup.sh @@ -14,13 +14,14 @@ # check() { - local _arch=$(uname -m) + local _arch + _arch=$(uname -m) # Ensure that we're running on s390 - [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1 + [ "$_arch" = "s390" ] || [ "$_arch" = "s390x" ] || return 1 - # shellcheck disable=SC2154 source=/dev/null - source "$moddir/zdev-lib.sh" + # shellcheck source=/dev/null + source "${moddir:?}/zdev-lib.sh" # Leave kdump device configuration to module zdev-kdump to # ensure a minimal device footprint @@ -80,7 +81,7 @@ install() { done # Apply via --import to prevent other devices from being configured - chzdev --import "$_tempfile" --persistent --base "/etc=$initdir/etc" \ + chzdev --import "$_tempfile" --persistent --base "/etc=${initdir:?}/etc" \ --yes --quiet --no-root-update --force >/dev/null # Apply site-specific configurations via --import for (( site=0; site<10; site++ )) diff --git a/zdev/dracut/95zdev/parse-zdev.sh b/zdev/dracut/95zdev/parse-zdev.sh index 9077a0d4..31979f8b 100644 --- a/zdev/dracut/95zdev/parse-zdev.sh +++ b/zdev/dracut/95zdev/parse-zdev.sh @@ -37,6 +37,7 @@ for zdev_arg in $(getargs rd.zdev); do done if [ $zdev_auto -eq 1 ] ; then + # shellcheck disable=SC2086 chzdev --import "$zdev_fw_file" $zdev_base_args # Get information about DPM environment @@ -50,7 +51,7 @@ if [ $zdev_auto -eq 1 ] ; then # work for PCI devices defined before boot because there is no coldplug # trigger for /sys/bus/pci/slots for slot in /sys/bus/pci/slots/* ; do - read power < "$slot/power" + read -r power < "$slot/power" if [ "$power" = "0" ] ; then echo 1 > "$slot/power" fi