From: Harald Hoyer Date: Fri, 26 Mar 2021 09:29:19 +0000 (+0100) Subject: fix(dmraid): shellcheck for modules.d/90dmraid X-Git-Tag: 054~241 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1b3b55894ebb36087cd5ecc3548fd93ff4b95496;p=thirdparty%2Fdracut.git fix(dmraid): shellcheck for modules.d/90dmraid --- diff --git a/modules.d/90dmraid/.shchkdir b/modules.d/90dmraid/.shchkdir new file mode 100644 index 000000000..e69de29bb diff --git a/modules.d/90dmraid/dmraid.sh b/modules.d/90dmraid/dmraid.sh index 812e03625..d10f42aa8 100755 --- a/modules.d/90dmraid/dmraid.sh +++ b/modules.d/90dmraid/dmraid.sh @@ -2,19 +2,15 @@ type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh -dev="$1" devenc=$(str_replace "$1" '/' '\2f') -[ -e /tmp/dmraid.$devenc ] && exit 0 +[ -e /tmp/dmraid."$devenc" ] && exit 0 -> /tmp/dmraid.$devenc +: > /tmp/dmraid."$devenc" DM_RAIDS=$(getargs rd.dm.uuid -d rd_DM_UUID=) if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then - - DM_CLEANUP="no" - # run dmraid if udev has settled info "Scanning for dmraid devices $DM_RAIDS" SETS=$(dmraid -c -s) @@ -24,7 +20,7 @@ if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then fi info "Found dmraid sets:" - echo $SETS | vinfo + echo "$SETS" | vinfo if [ -n "$DM_RAIDS" ]; then # only activate specified DM RAIDS @@ -47,5 +43,4 @@ if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then fi need_shutdown - fi diff --git a/modules.d/90dmraid/module-setup.sh b/modules.d/90dmraid/module-setup.sh index 260af184f..482ae96ac 100755 --- a/modules.d/90dmraid/module-setup.sh +++ b/modules.d/90dmraid/module-setup.sh @@ -2,7 +2,9 @@ # called by dracut check() { - local _rootdev + local holder + local dev + # if we don't have dmraid installed on the host system, no point # in trying to support it in the initramfs. require_binaries dmraid || return 1 @@ -35,11 +37,11 @@ depends() { # called by dracut cmdline() { - local _activated - declare -A _activated + local dev + local -A _activated for dev in "${!host_fs_types[@]}"; do - local holder DEVPATH DM_NAME majmin + local holder DEVPATH DM_NAME [[ ${host_fs_types[$dev]} != *_raid_member ]] && continue DEVPATH=$(get_devpath_block "$dev") @@ -62,16 +64,16 @@ cmdline() { # called by dracut install() { - local _i + local _raidconf if [[ $hostonly_cmdline == "yes" ]]; then - local _raidconf=$(cmdline) + _raidconf=$(cmdline) [[ $_raidconf ]] && printf "%s\n" "$_raidconf" >> "${initdir}/etc/cmdline.d/90dmraid.conf" fi inst_multiple dmraid inst_multiple -o kpartx - inst $(command -v partx) /sbin/partx + inst "$(command -v partx)" /sbin/partx inst "$moddir/dmraid.sh" /sbin/dmraid_scan