From 152974718359d34d8317bcc807a38c919d12589d Mon Sep 17 00:00:00 2001 From: Peter Ajamian Date: Sun, 8 Aug 2021 21:47:36 +1200 Subject: [PATCH] Fix shellcheck issues Fix issues found by shellcheck. --- migrate2rocky/migrate2rocky.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/migrate2rocky/migrate2rocky.sh b/migrate2rocky/migrate2rocky.sh index 273876a..2c9773d 100644 --- a/migrate2rocky/migrate2rocky.sh +++ b/migrate2rocky/migrate2rocky.sh @@ -231,6 +231,7 @@ bin_check() { for pkg in "${!pkgs[@]}"; do ver=${pkgs[$pkg]} if ! pkg_ver "$pkg" "$ver"; then + # shellcheck disable=SC2140 exit_message \ "$pkg >= $ver is required for this script. Please run "\ "\"dnf install $pkg; dnf update\" first." @@ -381,7 +382,7 @@ collect_system_info () { kname=$(lsblk -dno kname "$efi_mount") cd "/sys/block/$kname/slaves" || exit_message \ "Unable to gather EFI data: Can't cd to /sys/block/$kname/slaves." - if ! (shopt -s failglob; : *) 2>/dev/null; then + if ! (shopt -s failglob; : ./*) 2>/dev/null; then exit_message \ "Unable to gather EFI data: No slaves found in /sys/block/$kname/slaves." fi @@ -577,7 +578,7 @@ $'because continuing with the migration could cause further damage to system.' repl=${module_glob_map[$gl]} mod=${mod/$gl/$repl} done - if [[ $mod != ${enabled_modules[$i]} ]]; then + if [[ $mod != "${enabled_modules[$i]}" ]]; then disable_modules+=(${enabled_modules[$i]}) enabled_modules[$i]=$mod fi