]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
style: shfmt -s reformat
authorHarald Hoyer <harald@redhat.com>
Thu, 25 Feb 2021 08:43:35 +0000 (09:43 +0100)
committerHarald Hoyer <harald@hoyer.xyz>
Sat, 13 Mar 2021 19:10:43 +0000 (20:10 +0100)
reproducible with:

```
$ shfmt_version=3.0.1
$ wget "https://github.com/mvdan/sh/releases/download/v${shfmt_version}/shfmt_v${shfmt_version}_linux_amd64" -O shfmt
$ chmod u+x shfmt
$ ./shfmt -w -s .
```

78 files changed:
dracut-bash-completion.sh
dracut-functions.sh
dracut-init.sh
dracut-logger.sh
dracut.sh
examples/yocto/postinst-intercepts/execute_dracut
lsinitrd-bash-completion.sh
lsinitrd.sh
mkinitrd-dracut.sh
mkinitrd-suse.sh
modules.d/00systemd/module-setup.sh
modules.d/01fips/fips.sh
modules.d/01fips/module-setup.sh
modules.d/03modsign/module-setup.sh
modules.d/10i18n/module-setup.sh
modules.d/30convertfs/convertfs.sh
modules.d/35network-legacy/dhcp-multi.sh
modules.d/35network-legacy/ifup.sh
modules.d/35network-legacy/parse-ip-opts.sh
modules.d/40network/net-lib.sh
modules.d/50drm/module-setup.sh
modules.d/50gensplash/module-setup.sh
modules.d/50plymouth/plymouth-populate-initrd.sh
modules.d/80cms/cmssetup.sh
modules.d/90btrfs/module-setup.sh
modules.d/90crypt/crypt-lib.sh
modules.d/90crypt/cryptroot-ask.sh
modules.d/90crypt/module-setup.sh
modules.d/90dmraid/module-setup.sh
modules.d/90dmsquash-live/dmsquash-live-root.sh
modules.d/90kernel-modules-extra/module-setup.sh
modules.d/90kernel-modules/module-setup.sh
modules.d/90kernel-network-modules/module-setup.sh
modules.d/90lvm/module-setup.sh
modules.d/90mdraid/md-shutdown.sh
modules.d/90mdraid/module-setup.sh
modules.d/90multipath/module-setup.sh
modules.d/90nvdimm/module-setup.sh
modules.d/90ppcmac/module-setup.sh
modules.d/91crypt-gpg/module-setup.sh
modules.d/95cifs/module-setup.sh
modules.d/95dasd_rules/module-setup.sh
modules.d/95dasd_rules/parse-dasd.sh
modules.d/95dcssblk/module-setup.sh
modules.d/95fcoe/fcoe-edd.sh
modules.d/95fcoe/fcoe-up.sh
modules.d/95fcoe/lldpad.sh
modules.d/95fcoe/module-setup.sh
modules.d/95iscsi/iscsiroot.sh
modules.d/95nbd/nbdroot.sh
modules.d/95nfs/module-setup.sh
modules.d/95nvmf/module-setup.sh
modules.d/95rootfs-block/module-setup.sh
modules.d/95virtfs/module-setup.sh
modules.d/95zfcp_rules/module-setup.sh
modules.d/95zfcp_rules/parse-zfcp.sh
modules.d/98dracut-systemd/dracut-initqueue.sh
modules.d/98dracut-systemd/dracut-mount.sh
modules.d/99base/dracut-lib.sh
modules.d/99base/init.sh
modules.d/99base/module-setup.sh
modules.d/99fs-lib/module-setup.sh
modules.d/99shutdown/shutdown.sh
modules.d/99squash/module-setup.sh
modules.d/99uefi-lib/uefi-lib.sh
test/TEST-20-NFS/server-init.sh
test/TEST-20-NFS/test.sh
test/TEST-30-ISCSI/server-init.sh
test/TEST-35-ISCSI-MULTI/server-init.sh
test/TEST-40-NBD/server-init.sh
test/TEST-40-NBD/test.sh
test/TEST-50-MULTINIC/server-init.sh
test/TEST-50-MULTINIC/test.sh
test/TEST-60-BONDBRIDGEVLANIFCFG/server-init.sh
test/TEST-60-BONDBRIDGEVLANIFCFG/test.sh
test/TEST-98-GETARG/test.sh
test/run-qemu
test/test-functions

index 99755d1a0975062181e5a4bba53938efe54ba24b..18d4269bc8cd6b8751923db243002bf65fd607b0 100644 (file)
@@ -18,7 +18,7 @@
 __contains_word() {
     local word="$1"
     shift
-    for w in "$@"; do [[ $w = "$word" ]] && return 0; done
+    for w in "$@"; do [[ $w == "$word" ]] && return 0; done
     return 1
 }
 
@@ -78,7 +78,7 @@ _dracut() {
         return 0
     fi
 
-    if [[ $cur = -* ]]; then
+    if [[ $cur == -* ]]; then
         # shellcheck disable=SC2207
         # shellcheck disable=SC2016
         COMPREPLY=($(compgen -W '${OPTS[*]}' -- "$cur"))
index a35dc016fd0b54bead241e0ed77359fd08ce7b68..6b701a681aa7fa83ac9e9d3da3827ecb6ce9d0f7 100755 (executable)
@@ -22,16 +22,16 @@ export LC_MESSAGES=C
 # is_func <command>
 # Check whether $1 is a function.
 is_func() {
-    [[ "$(type -t "$1")" = "function" ]]
+    [[ "$(type -t "$1")" == "function" ]]
 }
 
 # Generic substring function.  If $2 is in $1, return 0.
-strstr() { [[ $1 = *"$2"* ]]; }
+strstr() { [[ $1 == *"$2"* ]]; }
 # Generic glob matching function. If glob pattern $2 matches anywhere in $1, OK
-strglobin() { [[ $1 = *$2* ]]; }
+strglobin() { [[ $1 == *$2* ]]; }
 # Generic glob matching function. If glob pattern $2 matches all of $1, OK
 # shellcheck disable=SC2053
-strglob() { [[ $1 = $2 ]]; }
+strglob() { [[ $1 == $2 ]]; }
 # returns OK if $1 contains literal string $2 at the beginning, and isn't empty
 str_starts() { [ "${1#"$2"*}" != "$1" ]; }
 # returns OK if $1 contains literal string $2 at the end, and isn't empty
@@ -46,7 +46,7 @@ find_binary() {
     local p
     [[ -z ${1##/*} ]] || _delim="/"
 
-    if [[ "$1" == *.so* ]]; then
+    if [[ $1 == *.so* ]]; then
         # shellcheck disable=SC2154
         for l in $libdirs; do
             _path="${l}${_delim}${1}"
@@ -61,7 +61,7 @@ find_binary() {
             return 0
         fi
     fi
-    if [[ "$1" == */* ]]; then
+    if [[ $1 == */* ]]; then
         _path="${_delim}${1}"
         if [[ -L ${dracutsysrootdir}${_path} ]] || [[ -x ${dracutsysrootdir}${_path} ]]; then
             printf "%s\n" "${_path}"
@@ -76,7 +76,7 @@ find_binary() {
         fi
     done
 
-    [[ -n "$dracutsysrootdir" ]] && return 1
+    [[ -n $dracutsysrootdir ]] && return 1
     type -P "${1##*/}"
 }
 
@@ -163,13 +163,13 @@ convert_abs_rel() {
     set -- "$(normalize_path "$1")" "$(normalize_path "$2")"
 
     # corner case #1 - self looping link
-    [[ "$1" == "$2" ]] && {
+    [[ $1 == "$2" ]] && {
         printf "%s\n" "${1##*/}"
         return
     }
 
     # corner case #2 - own dir link
-    [[ "${1%/*}" == "$2" ]] && {
+    [[ ${1%/*} == "$2" ]] && {
         printf ".\n"
         return
     }
@@ -180,7 +180,7 @@ convert_abs_rel() {
     __abssize=${#__absolute[@]}
     __cursize=${#__current[@]}
 
-    while [[ "${__absolute[__level]}" == "${__current[__level]}" ]]; do
+    while [[ ${__absolute[__level]} == "${__current[__level]}" ]]; do
         ((__level++))
         if ((__level > __abssize || __level > __cursize)); then
             break
@@ -214,7 +214,7 @@ get_fs_env() {
     unset ID_FS_TYPE
     ID_FS_TYPE=$(blkid -u filesystem -o export -- "$1" \
         | while read line || [ -n "$line" ]; do
-            if [[ "$line" == TYPE\=* ]]; then
+            if [[ $line == TYPE\=* ]]; then
                 printf "%s" "${line#TYPE=}"
                 exit 0
             fi
@@ -244,8 +244,8 @@ get_devpath_block() {
     _majmin=$(get_maj_min "$1")
 
     for _i in /sys/block/*/dev /sys/block/*/*/dev; do
-        [[ -e "$_i" ]] || continue
-        if [[ "$_majmin" == "$(< "$_i")" ]]; then
+        [[ -e $_i ]] || continue
+        if [[ $_majmin == "$(< "$_i")" ]]; then
             printf "%s" "${_i%/dev}"
             return 0
         fi
@@ -260,7 +260,7 @@ get_persistent_dev() {
     _dev=$(get_maj_min "$1")
     [ -z "$_dev" ] && return
 
-    if [[ -n "$persistent_policy" ]]; then
+    if [[ -n $persistent_policy ]]; then
         _pol="/dev/disk/${persistent_policy}/*"
     else
         _pol=
@@ -275,7 +275,7 @@ get_persistent_dev() {
         /dev/disk/by-partlabel/* \
         /dev/disk/by-id/* \
         /dev/disk/by-path/*; do
-        [[ -e "$i" ]] || continue
+        [[ -e $i ]] || continue
         [[ $i == /dev/mapper/control ]] && continue
         [[ $i == /dev/mapper/mpath* ]] && continue
         _tmp=$(get_maj_min "$i")
@@ -361,7 +361,7 @@ find_block_device() {
                     fi
                     return 0
                 fi
-                if [[ $_dev = *:* ]]; then
+                if [[ $_dev == *:* ]]; then
                     printf "%s\n" "$_dev"
                     return 0
                 fi
@@ -386,7 +386,7 @@ find_block_device() {
                 fi
                 return 0
             fi
-            if [[ $_dev = *:* ]]; then
+            if [[ $_dev == *:* ]]; then
                 printf "%s\n" "$_dev"
                 return 0
             fi
@@ -412,7 +412,7 @@ find_mp_fstype() {
         findmnt -e -v -n -o 'FSTYPE' --target "$1" | {
             while read _fs || [ -n "$_fs" ]; do
                 [[ $_fs ]] || continue
-                [[ $_fs = "autofs" ]] && continue
+                [[ $_fs == "autofs" ]] && continue
                 printf "%s" "$_fs"
                 return 0
             done
@@ -423,7 +423,7 @@ find_mp_fstype() {
     findmnt --fstab -e -v -n -o 'FSTYPE' --target "$1" | {
         while read _fs || [ -n "$_fs" ]; do
             [[ $_fs ]] || continue
-            [[ $_fs = "autofs" ]] && continue
+            [[ $_fs == "autofs" ]] && continue
             printf "%s" "$_fs"
             return 0
         done
@@ -444,7 +444,7 @@ find_mp_fstype() {
 find_dev_fstype() {
     local _find_dev _fs
     _find_dev="$1"
-    if ! [[ "$_find_dev" = /dev* ]]; then
+    if ! [[ $_find_dev == /dev* ]]; then
         [[ -b "/dev/block/$_find_dev" ]] && _find_dev="/dev/block/$_find_dev"
     fi
 
@@ -452,7 +452,7 @@ find_dev_fstype() {
         findmnt -e -v -n -o 'FSTYPE' --source "$_find_dev" | {
             while read _fs || [ -n "$_fs" ]; do
                 [[ $_fs ]] || continue
-                [[ $_fs = "autofs" ]] && continue
+                [[ $_fs == "autofs" ]] && continue
                 printf "%s" "$_fs"
                 return 0
             done
@@ -463,7 +463,7 @@ find_dev_fstype() {
     findmnt --fstab -e -v -n -o 'FSTYPE' --source "$_find_dev" | {
         while read _fs || [ -n "$_fs" ]; do
             [[ $_fs ]] || continue
-            [[ $_fs = "autofs" ]] && continue
+            [[ $_fs == "autofs" ]] && continue
             printf "%s" "$_fs"
             return 0
         done
@@ -501,7 +501,7 @@ find_mp_fsopts() {
 find_dev_fsopts() {
     local _find_dev
     _find_dev="$1"
-    if ! [[ "$_find_dev" = /dev* ]]; then
+    if ! [[ $_find_dev == /dev* ]]; then
         [[ -b "/dev/block/$_find_dev" ]] && _find_dev="/dev/block/$_find_dev"
     fi
 
@@ -583,7 +583,7 @@ for_each_host_dev_and_slaves_all() {
     [[ "${host_devs[*]}" ]] || return 2
 
     for _dev in "${host_devs[@]}"; do
-        [[ -b "$_dev" ]] || continue
+        [[ -b $_dev ]] || continue
         if check_block_and_slaves_all $_func $(get_maj_min $_dev); then
             _ret=0
         fi
@@ -598,7 +598,7 @@ for_each_host_dev_and_slaves() {
     [[ "${host_devs[*]}" ]] || return 2
 
     for _dev in "${host_devs[@]}"; do
-        [[ -b "$_dev" ]] || continue
+        [[ -b $_dev ]] || continue
         check_block_and_slaves $_func $(get_maj_min $_dev) && return 0
     done
     return 1
index 641d0934b732f7eec577ae0a13e11fbb351f031d..859137d3997671eabbdccfb76337a6c3332851fd 100644 (file)
@@ -19,7 +19,7 @@
 #
 export LC_MESSAGES=C
 
-if [[ "$EUID" = "0" ]] && ! [[ $DRACUT_NO_XATTR ]]; then
+if [[ $EUID == "0" ]] && ! [[ $DRACUT_NO_XATTR ]]; then
     export DRACUT_CP="cp --reflink=auto --sparse=auto --preserve=mode,timestamps,xattr,links -dfr"
 else
     export DRACUT_CP="cp --reflink=auto --sparse=auto --preserve=mode,timestamps,links -dfr"
@@ -28,12 +28,12 @@ fi
 # is_func <command>
 # Check whether $1 is a function.
 is_func() {
-    [[ "$(type -t "$1")" = "function" ]]
+    [[ "$(type -t "$1")" == "function" ]]
 }
 
 if ! [[ $dracutbasedir ]]; then
     dracutbasedir=${BASH_SOURCE[0]%/*}
-    [[ $dracutbasedir = dracut-functions* ]] && dracutbasedir="."
+    [[ $dracutbasedir == dracut-functions* ]] && dracutbasedir="."
     [[ $dracutbasedir ]] || dracutbasedir="."
     dracutbasedir="$(readlink -f $dracutbasedir)"
 fi
@@ -114,7 +114,7 @@ require_binaries() {
     local _module_name="${moddir##*/}"
     local _ret=0
 
-    if [[ "$1" = "-m" ]]; then
+    if [[ $1 == "-m" ]]; then
         _module_name="$2"
         shift 2
     fi
@@ -132,7 +132,7 @@ require_any_binary() {
     local _module_name="${moddir##*/}"
     local _ret=1
 
-    if [[ "$1" = "-m" ]]; then
+    if [[ $1 == "-m" ]]; then
         _module_name="$2"
         shift 2
     fi
@@ -197,13 +197,13 @@ for i in $DRACUT_INSTALL; do
     DRINSTALLPARTS=$((DRINSTALLPARTS + 1))
 done
 
-if [[ $DRINSTALLPARTS = 1 ]] && ! command -v "$DRACUT_INSTALL" > /dev/null 2>&1; then
+if [[ $DRINSTALLPARTS == 1 ]] && ! command -v "$DRACUT_INSTALL" > /dev/null 2>&1; then
     dfatal "dracut-install not found!"
     exit 10
 fi
 
 if [[ $hostonly == "-h" ]]; then
-    if ! [[ $DRACUT_KERNEL_MODALIASES ]] || ! [[ -f "$DRACUT_KERNEL_MODALIASES" ]]; then
+    if ! [[ $DRACUT_KERNEL_MODALIASES ]] || ! [[ -f $DRACUT_KERNEL_MODALIASES ]]; then
         export DRACUT_KERNEL_MODALIASES="${DRACUT_TMPDIR}/modaliases"
         "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${srcmods:+--kerneldir "$srcmods"} --modalias > "$DRACUT_KERNEL_MODALIASES"
     fi
@@ -219,7 +219,7 @@ inst_dir() {
 
 inst() {
     local _hostonly_install
-    if [[ "$1" == "-H" ]]; then
+    if [[ $1 == "-H" ]]; then
         _hostonly_install="-H"
         shift
     fi
@@ -232,7 +232,7 @@ inst() {
 
 inst_simple() {
     local _hostonly_install
-    if [[ "$1" == "-H" ]]; then
+    if [[ $1 == "-H" ]]; then
         _hostonly_install="-H"
         shift
     fi
@@ -245,7 +245,7 @@ inst_simple() {
 
 inst_symlink() {
     local _hostonly_install
-    if [[ "$1" == "-H" ]]; then
+    if [[ $1 == "-H" ]]; then
         _hostonly_install="-H"
         shift
     fi
@@ -275,7 +275,7 @@ dracut_instmods() {
     local _silent=0
     local i
     # shellcheck disable=SC2154
-    [[ $no_kernel = yes ]] && return
+    [[ $no_kernel == yes ]] && return
     for i in "$@"; do
         [[ $i == "--silent" ]] && _silent=1
     done
@@ -292,7 +292,7 @@ dracut_instmods() {
 
 inst_library() {
     local _hostonly_install
-    if [[ "$1" == "-H" ]]; then
+    if [[ $1 == "-H" ]]; then
         _hostonly_install="-H"
         shift
     fi
@@ -328,7 +328,7 @@ inst_fsck_help() {
 # given modules.
 optional_hostonly() {
     # shellcheck disable=SC2154
-    if [[ $hostonly_mode = "strict" ]]; then
+    if [[ $hostonly_mode == "strict" ]]; then
         printf -- "%s" "$hostonly"
     else
         printf ""
@@ -382,7 +382,7 @@ inst_rule_programs() {
         # shellcheck disable=SC2154
         if [[ -x ${udevdir}/$_prog ]]; then
             _bin="${udevdir}"/$_prog
-        elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then
+        elif [[ ${_prog/\$env\{/} == "$_prog" ]]; then
             _bin=$(find_binary "$_prog") || {
                 dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
                 continue
@@ -397,7 +397,7 @@ inst_rule_programs() {
         _bin=""
         if [[ -x ${udevdir}/$_prog ]]; then
             _bin=${udevdir}/$_prog
-        elif [[ "${_prog/\$env\{/}" == "$_prog" ]] && [[ "${_prog}" != "/sbin/initqueue" ]]; then
+        elif [[ ${_prog/\$env\{/} == "$_prog" ]] && [[ ${_prog} != "/sbin/initqueue" ]]; then
             _bin=$(find_binary "$_prog") || {
                 dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
                 continue
@@ -412,7 +412,7 @@ inst_rule_programs() {
         _bin=""
         if [[ -x ${udevdir}/$_prog ]]; then
             _bin=${udevdir}/$_prog
-        elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then
+        elif [[ ${_prog/\$env\{/} == "$_prog" ]]; then
             _bin=$(find_binary "$_prog") || {
                 dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
                 continue
@@ -554,7 +554,7 @@ inst_hook() {
         dfatal "Cannot install a hook ($3) that does not exist."
         dfatal "Aborting initrd creation."
         exit 1
-    elif ! [[ "$hookdirs" == *$1* ]]; then
+    elif ! [[ $hookdirs == *$1* ]]; then
         dfatal "No such hook type $1. Aborting initrd creation."
         exit 1
     fi
@@ -577,7 +577,7 @@ inst_hook() {
 inst_any() {
     local to f
 
-    [[ $1 = '-d' ]] && to="$2" && shift 2
+    [[ $1 == '-d' ]] && to="$2" && shift 2
 
     for f in "$@"; do
         [[ -e $f ]] || continue
@@ -593,14 +593,14 @@ inst_any() {
 # -n <pattern> install matching files
 inst_libdir_file() {
     local -a _files
-    if [[ "$1" == "-n" ]]; then
+    if [[ $1 == "-n" ]]; then
         local _pattern=$2
         shift 2
         for _dir in $libdirs; do
             for _i in "$@"; do
                 for _f in "$dracutsysrootdir$_dir"/$_i; do
-                    [[ "${_f#$dracutsysrootdir}" =~ $_pattern ]] || continue
-                    [[ -e "$_f" ]] && _files+=("${_f#$dracutsysrootdir}")
+                    [[ ${_f#$dracutsysrootdir} =~ $_pattern ]] || continue
+                    [[ -e $_f ]] && _files+=("${_f#$dracutsysrootdir}")
                 done
             done
         done
@@ -608,7 +608,7 @@ inst_libdir_file() {
         for _dir in $libdirs; do
             for _i in "$@"; do
                 for _f in "$dracutsysrootdir$_dir"/$_i; do
-                    [[ -e "$_f" ]] && _files+=("${_f#$dracutsysrootdir}")
+                    [[ -e $_f ]] && _files+=("${_f#$dracutsysrootdir}")
                 done
             done
         done
@@ -635,7 +635,7 @@ inst_decompress() {
 
     for _src in "$@"; do
         _cmd=$(get_decompress_cmd "${_src}")
-        [[ -z "${_cmd}" ]] && return 1
+        [[ -z ${_cmd} ]] && return 1
         inst_simple "${_src}"
         # Decompress with chosen tool.  We assume that tool changes name e.g.
         # from 'name.gz' to 'name'.
@@ -839,10 +839,10 @@ check_mount() {
         ret=$?
 
         # explicit module, so also accept ret=255
-        [[ $ret = 0 || $ret = 255 ]] || return 1
+        [[ $ret == 0 || $ret == 255 ]] || return 1
     else
         # module not in our list
-        if [[ $dracutmodules = all ]]; then
+        if [[ $dracutmodules == all ]]; then
             # check, if we can and should install this module
             module_check_mount "$_mod" "$_moddir" || return 1
         else
@@ -909,10 +909,10 @@ check_module() {
             ret=$?
         fi
         # explicit module, so also accept ret=255
-        [[ $ret = 0 || $ret = 255 ]] || return 1
+        [[ $ret == 0 || $ret == 255 ]] || return 1
     else
         # module not in our list
-        if [[ $dracutmodules = all ]]; then
+        if [[ $dracutmodules == all ]]; then
             # check, if we can and should install this module
             module_check "$_mod" 0 "$_moddir"
             ret=$?
@@ -1010,13 +1010,13 @@ instmods() {
     local _silent
     local _ret
 
-    [[ $no_kernel = yes ]] && return
+    [[ $no_kernel == yes ]] && return
 
-    if [[ $1 = '-c' ]]; then
+    if [[ $1 == '-c' ]]; then
         unset _optional
         shift
     fi
-    if [[ $1 = '-s' ]]; then
+    if [[ $1 == '-s' ]]; then
         _silent=1
         shift
     fi
@@ -1042,7 +1042,7 @@ instmods() {
         -m "$@"
     _ret=$?
 
-    if ((_ret != 0)) && [[ -z "$_silent" ]]; then
+    if ((_ret != 0)) && [[ -z $_silent ]]; then
         derror "FAILED: " \
             "$DRACUT_INSTALL" \
             ${initdir:+-D "$initdir"} \
@@ -1068,7 +1068,7 @@ else
     ln_r() {
         local _source=$1
         local _dest=$2
-        [[ -d "${_dest%/*}" ]] && _dest=$(readlink -f "${_dest%/*}")/${_dest##*/}
+        [[ -d ${_dest%/*} ]] && _dest=$(readlink -f "${_dest%/*}")/${_dest##*/}
         ln -sfn -- "$(convert_abs_rel "${_dest}" "${_source}")" "${initdir}/${_dest}"
     }
 fi
@@ -1081,17 +1081,17 @@ is_qemu_virtualized() {
         if ! vm=$(systemd-detect-virt --vm > /dev/null 2>&1); then
             return 255
         fi
-        [[ $vm = "qemu" ]] && return 0
-        [[ $vm = "kvm" ]] && return 0
-        [[ $vm = "bochs" ]] && return 0
+        [[ $vm == "qemu" ]] && return 0
+        [[ $vm == "kvm" ]] && return 0
+        [[ $vm == "bochs" ]] && return 0
     fi
 
     for i in /sys/class/dmi/id/*_vendor; do
         [[ -f $i ]] || continue
         read -r vendor < "$i"
-        [[ "$vendor" == "QEMU" ]] && return 0
-        [[ "$vendor" == "Red Hat" ]] && return 0
-        [[ "$vendor" == "Bochs" ]] && return 0
+        [[ $vendor == "QEMU" ]] && return 0
+        [[ $vendor == "Red Hat" ]] && return 0
+        [[ $vendor == "Bochs" ]] && return 0
     done
     return 1
 }
index ad548d0548bc1f86026f402da371e7a3c55cf87f..dadbe8483cca9c4b6eea0c6f953d54522cd684c0 100755 (executable)
@@ -332,7 +332,7 @@ _do_dlog() {
         fi
     fi
 
-    if ((lvl <= fileloglvl)) && [[ -w "$logfile" ]] && [[ -f "$logfile" ]]; then
+    if ((lvl <= fileloglvl)) && [[ -w $logfile ]] && [[ -f $logfile ]]; then
         echo "$lmsg" >> "$logfile"
     fi
 
index c5644bddbf01fd3502c260fb8c1c701c3664b173..8890203a6d905e0ed6825ed9e14b1744498789dd 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -310,7 +310,7 @@ dropindirs_sort() {
 
     for d in "$@"; do
         for i in "$d/"*"$suffix"; do
-            if [[ -e "$i" ]]; then
+            if [[ -e $i ]]; then
                 printf "%s\n" "${i##*/}"
             fi
         done
@@ -928,11 +928,11 @@ for i in $DRACUT_PATH; do
         rl=$(readlink -f "$dracutsysrootdir$i")
     fi
     rl="${rl#$dracutsysrootdir}"
-    if [[ "$NPATH" != *:$rl* ]]; then
+    if [[ $NPATH != *:$rl* ]]; then
         NPATH+=":$rl"
     fi
 done
-[[ -z "$dracutsysrootdir" ]] && export PATH="${NPATH#:}"
+[[ -z $dracutsysrootdir ]] && export PATH="${NPATH#:}"
 unset NPATH
 
 export SYSTEMCTL=${SYSTEMCTL:-systemctl}
@@ -965,11 +965,11 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
 [[ $do_hardlink_l ]] && do_hardlink=$do_hardlink_l
 [[ $do_hardlink ]] || do_hardlink=yes
 [[ $prefix_l ]] && prefix=$prefix_l
-[[ $prefix = "/" ]] && unset prefix
+[[ $prefix == "/" ]] && unset prefix
 [[ $hostonly_l ]] && hostonly=$hostonly_l
 [[ $hostonly_cmdline_l ]] && hostonly_cmdline=$hostonly_cmdline_l
 [[ $hostonly_mode_l ]] && hostonly_mode=$hostonly_mode_l
-[[ "$hostonly" == "yes" ]] && ! [[ $hostonly_cmdline ]] && hostonly_cmdline="yes"
+[[ $hostonly == "yes" ]] && ! [[ $hostonly_cmdline ]] && hostonly_cmdline="yes"
 # shellcheck disable=SC2034
 [[ $i18n_install_all_l ]] && i18n_install_all=$i18n_install_all_l
 # shellcheck disable=SC2034
@@ -1008,12 +1008,12 @@ if ! [[ $outfile ]]; then
 
     if [[ $uefi == "yes" ]]; then
         # shellcheck disable=SC2154
-        if [[ -n "$uefi_secureboot_key" && -z "$uefi_secureboot_cert" ]] || [[ -z $uefi_secureboot_key && -n $uefi_secureboot_cert ]]; then
+        if [[ -n $uefi_secureboot_key && -z $uefi_secureboot_cert ]] || [[ -z $uefi_secureboot_key && -n $uefi_secureboot_cert ]]; then
             dfatal "Need 'uefi_secureboot_key' and 'uefi_secureboot_cert' both to be set."
             exit 1
         fi
 
-        if [[ -n "$uefi_secureboot_key" && -n "$uefi_secureboot_cert" ]] && ! command -v sbsign &> /dev/null; then
+        if [[ -n $uefi_secureboot_key && -n $uefi_secureboot_cert ]] && ! command -v sbsign &> /dev/null; then
             dfatal "Need 'sbsign' to create a signed UEFI executable"
             exit 1
         fi
@@ -1055,8 +1055,8 @@ export DRACUT_FIRMWARE_PATH=${fw_dir// /:}
 fw_dir=${fw_dir//:/ }
 
 # check for logfile and try to create one if it doesn't exist
-if [[ -n "$logfile" ]]; then
-    if [[ ! -f "$logfile" ]]; then
+if [[ -n $logfile ]]; then
+    if [[ ! -f $logfile ]]; then
         if touch "$logfile"; then
             printf "%s\n" "dracut: touch $logfile failed." >&2
         fi
@@ -1075,11 +1075,11 @@ DRACUT_COMPRESS_ZSTD=${DRACUT_COMPRESS_ZSTD:-zstd}
 DRACUT_COMPRESS_LZ4=${DRACUT_COMPRESS_LZ4:-lz4}
 DRACUT_COMPRESS_CAT=${DRACUT_COMPRESS_CAT:-cat}
 
-if [[ $_no_compress_l = "$DRACUT_COMPRESS_CAT" ]]; then
+if [[ $_no_compress_l == "$DRACUT_COMPRESS_CAT" ]]; then
     compress="$DRACUT_COMPRESS_CAT"
 fi
 
-[[ $hostonly = yes ]] && hostonly="-h"
+[[ $hostonly == yes ]] && hostonly="-h"
 [[ $hostonly != "-h" ]] && unset hostonly
 
 case $hostonly_mode in
@@ -1103,7 +1103,7 @@ case "${drivers_dir}" in
     '' | *lib/modules/${kernel} | *lib/modules/${kernel}/) ;;
     *)
         [[ "$DRACUT_KMODDIR_OVERRIDE" ]] || {
-            printf "%s\n" "dracut: -k/--kmoddir path must contain \"lib/modules\" as a parent of your kernel module directory,"
+            printf "%s\n" 'dracut: -k/--kmoddir path must contain "lib/modules" as a parent of your kernel module directory,'
             printf "%s\n" "dracut: or modules may not be placed in the correct location inside the initramfs."
             printf "%s\n" "dracut: was given: ${drivers_dir}"
             printf "%s\n" "dracut: expected: $(dirname "${drivers_dir}")/lib/modules/${kernel}"
@@ -1148,7 +1148,7 @@ readonly initdir="${DRACUT_TMPDIR}/initramfs"
 mkdir -p "$initdir"
 
 # shellcheck disable=SC2154
-if [[ $early_microcode = yes ]] || { [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]]; }; then
+if [[ $early_microcode == yes ]] || { [[ $acpi_override == yes ]] && [[ -d $acpi_table_dir ]]; }; then
     readonly early_cpio_dir="${DRACUT_TMPDIR}/earlycpio"
     mkdir "$early_cpio_dir"
 fi
@@ -1221,14 +1221,14 @@ unset omit_drivers_corrected
 
 # prepare args for logging
 for ((i = 0; i < ${#dracut_args[@]}; i++)); do
-    [[ "${dracut_args[$i]}" == *\ * ]] \
+    [[ ${dracut_args[$i]} == *\ * ]] \
         && dracut_args[$i]="\"${dracut_args[$i]}\""
     #" keep vim happy
 done
 
 dinfo "Executing: $dracut_cmd ${dracut_args[*]}"
 
-[[ $do_list = yes ]] && {
+[[ $do_list == yes ]] && {
     for mod in "$dracutbasedir"/modules.d/*; do
         [[ -d $mod ]] || continue
         [[ -e $mod/install || -e $mod/installkernel || -e \
@@ -1294,13 +1294,13 @@ if [[ ! $print_cmdline ]]; then
     outdir=${outfile%/*}
     [[ $outdir ]] || outdir="/"
 
-    if [[ ! -d "$outdir" ]]; then
+    if [[ ! -d $outdir ]]; then
         dfatal "Can't write to $outdir: Directory $outdir does not exist or is not accessible."
         exit 1
-    elif [[ ! -w "$outdir" ]]; then
+    elif [[ ! -w $outdir ]]; then
         dfatal "No permission to write to $outdir."
         exit 1
-    elif [[ -f "$outfile" && ! -w "$outfile" ]]; then
+    elif [[ -f $outfile && ! -w $outfile ]]; then
         dfatal "No permission to write $outfile."
         exit 1
     fi
@@ -1313,7 +1313,7 @@ if [[ ! $print_cmdline ]]; then
         loginstall=$(readlink -f "$loginstall")
     fi
 
-    if [[ $uefi = yes ]]; then
+    if [[ $uefi == yes ]]; then
         if ! command -v objcopy &> /dev/null; then
             dfatal "Need 'objcopy' to create a UEFI executable"
             exit 1
@@ -1347,7 +1347,7 @@ if [[ ! $print_cmdline ]]; then
 
         if ! [[ $kernel_image ]]; then
             for kernel_image in "$dracutsysrootdir/lib/modules/$kernel/vmlinuz" "$dracutsysrootdir/boot/vmlinuz-$kernel"; do
-                [[ -s "$kernel_image" ]] || continue
+                [[ -s $kernel_image ]] || continue
                 break
             done
         fi
@@ -1358,12 +1358,12 @@ if [[ ! $print_cmdline ]]; then
     fi
 fi
 
-if [[ $acpi_override = yes ]] && ! (check_kernel_config CONFIG_ACPI_TABLE_UPGRADE || check_kernel_config CONFIG_ACPI_INITRD_TABLE_OVERRIDE); then
+if [[ $acpi_override == yes ]] && ! (check_kernel_config CONFIG_ACPI_TABLE_UPGRADE || check_kernel_config CONFIG_ACPI_INITRD_TABLE_OVERRIDE); then
     dwarn "Disabling ACPI override, because kernel does not support it. CONFIG_ACPI_INITRD_TABLE_OVERRIDE!=y or CONFIG_ACPI_TABLE_UPGRADE!=y"
     unset acpi_override
 fi
 
-if [[ $early_microcode = yes ]]; then
+if [[ $early_microcode == yes ]]; then
     if [[ $hostonly ]]; then
         if [[ $(get_cpu_vendor) == "AMD" ]]; then
             check_kernel_config CONFIG_MICROCODE_AMD || unset early_microcode
@@ -1421,7 +1421,7 @@ for line in "${fstab_lines[@]}"; do
             ;;
     esac
     [ -z "$dev" ] && dwarn "Bad fstab entry $*" && continue
-    if [[ "$3" == btrfs ]]; then
+    if [[ $3 == btrfs ]]; then
         for i in $(btrfs_devs "$2"); do
             push_host_devs "$i"
         done
@@ -1446,7 +1446,7 @@ if ((${#add_device_l[@]})); then
     push_host_devs "${add_device_l[@]}"
 fi
 
-if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
+if [[ $hostonly ]] && [[ $hostonly_default_device != "no" ]]; then
     # in hostonly mode, determine all devices, which have to be accessed
     # and examine them for filesystem types
 
@@ -1470,11 +1470,11 @@ if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
         _dev=$(find_block_device "$mp")
         _bdev=$(readlink -f "/dev/block/$_dev")
         [[ -b $_bdev ]] && _dev=$_bdev
-        [[ "$mp" == "/" ]] && root_devs+=("$_dev")
+        [[ $mp == "/" ]] && root_devs+=("$_dev")
         push_host_devs "$_dev"
         if [[ $(find_mp_fstype "$mp") == btrfs ]]; then
             for i in $(btrfs_devs "$mp"); do
-                [[ "$mp" == "/" ]] && root_devs+=("$i")
+                [[ $mp == "/" ]] && root_devs+=("$i")
                 push_host_devs "$i"
             done
         fi
@@ -1484,24 +1484,24 @@ if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
     if [[ -f /proc/swaps ]] && [[ -f $dracutsysrootdir/etc/fstab ]]; then
         while read -r dev type rest || [ -n "$dev" ]; do
             [[ -b $dev ]] || continue
-            [[ "$type" == "partition" ]] || continue
+            [[ $type == "partition" ]] || continue
 
             while read -r _d _m _t _o _ || [ -n "$_d" ]; do
-                [[ "$_d" == \#* ]] && continue
+                [[ $_d == \#* ]] && continue
                 [[ $_d ]] || continue
                 [[ $_t != "swap" ]] && continue
                 [[ $_m != "swap" ]] && [[ $_m != "none" ]] && continue
-                [[ "$_o" == *noauto* ]] && continue
+                [[ $_o == *noauto* ]] && continue
                 _d=$(expand_persistent_dev "$_d")
-                [[ "$_d" -ef "$dev" ]] || continue
+                [[ $_d -ef $dev ]] || continue
 
                 if [[ -f $dracutsysrootdir/etc/crypttab ]]; then
                     while read -r _mapper _ _p _o || [ -n "$_mapper" ]; do
-                        [[ $_mapper = \#* ]] && continue
-                        [[ "$_d" -ef /dev/mapper/"$_mapper" ]] || continue
+                        [[ $_mapper == \#* ]] && continue
+                        [[ $_d -ef /dev/mapper/"$_mapper" ]] || continue
                         [[ "$_o" ]] || _o="$_p"
                         # skip entries with password files
-                        [[ "$_p" == /* ]] && [[ -f $_p ]] && continue 2
+                        [[ $_p == /* ]] && [[ -f $_p ]] && continue 2
                         # skip mkswap swap
                         [[ $_o == *swap* ]] && continue 2
                     done < "$dracutsysrootdir"/etc/crypttab
@@ -1518,15 +1518,15 @@ if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
     # collect all "x-initrd.mount" entries from /etc/fstab
     if [[ -f $dracutsysrootdir/etc/fstab ]]; then
         while read -r _d _m _t _o _ || [ -n "$_d" ]; do
-            [[ "$_d" == \#* ]] && continue
+            [[ $_d == \#* ]] && continue
             [[ $_d ]] || continue
-            [[ "$_o" != *x-initrd.mount* ]] && continue
+            [[ $_o != *x-initrd.mount* ]] && continue
             _dev=$(expand_persistent_dev "$_d")
             _dev="$(readlink -f "$_dev")"
             [[ -b $_dev ]] || continue
 
             push_host_devs "$_dev"
-            if [[ "$_t" == btrfs ]]; then
+            if [[ $_t == btrfs ]]; then
                 for i in $(btrfs_devs "$_m"); do
                     push_host_devs "$i"
                 done
@@ -1561,11 +1561,11 @@ for dev in "${host_devs[@]}"; do
 done
 
 for dev in "${!host_fs_types[@]}"; do
-    [[ ${host_fs_types[$dev]} = "reiserfs" ]] || [[ ${host_fs_types[$dev]} = "xfs" ]] || continue
+    [[ ${host_fs_types[$dev]} == "reiserfs" ]] || [[ ${host_fs_types[$dev]} == "xfs" ]] || continue
     rootopts=$(find_dev_fsopts "$dev")
-    if [[ ${host_fs_types[$dev]} = "reiserfs" ]]; then
+    if [[ ${host_fs_types[$dev]} == "reiserfs" ]]; then
         journaldev=$(fs_get_option "$rootopts" "jdev")
-    elif [[ ${host_fs_types[$dev]} = "xfs" ]]; then
+    elif [[ ${host_fs_types[$dev]} == "xfs" ]]; then
         journaldev=$(fs_get_option "$rootopts" "logdev")
     fi
     if [[ $journaldev ]]; then
@@ -1794,7 +1794,7 @@ fi
 
 if [[ $prefix ]]; then
     for d in bin etc lib sbin tmp usr var $libdirs; do
-        [[ "$d" == */* ]] && continue
+        [[ $d == */* ]] && continue
         ln -sfn "${prefix#/}/${d#/}" "$initdir/$d"
     done
 fi
@@ -1842,7 +1842,7 @@ if [[ $kernel_only != yes ]]; then
         # shellcheck disable=SC2174
         mkdir -m 0755 -p "${initdir}/lib/dracut/hooks/$_d"
     done
-    if [[ "$EUID" = "0" ]]; then
+    if [[ $EUID == "0" ]]; then
         [[ -c ${initdir}/dev/null ]] || mknod "${initdir}"/dev/null c 1 3
         [[ -c ${initdir}/dev/kmsg ]] || mknod "${initdir}"/dev/kmsg c 1 11
         [[ -c ${initdir}/dev/console ]] || mknod "${initdir}"/dev/console c 5 1
@@ -1857,8 +1857,8 @@ modules_loaded=" "
 for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
     _d_mod=${moddir##*/}
     _d_mod=${_d_mod#[0-9][0-9]}
-    [[ "$mods_to_load" == *\ $_d_mod\ * ]] || continue
-    if [[ $show_modules = yes ]]; then
+    [[ $mods_to_load == *\ $_d_mod\ * ]] || continue
+    if [[ $show_modules == yes ]]; then
         printf "%s\n" "$_d_mod"
     else
         dinfo "*** Including module: $_d_mod ***"
@@ -1902,7 +1902,7 @@ dinfo "*** Including modules done ***"
 
 ## final stuff that has to happen
 if [[ $no_kernel != yes ]]; then
-    if [[ $hostonly_mode = "strict" ]]; then
+    if [[ $hostonly_mode == "strict" ]]; then
         cp "$DRACUT_KERNEL_MODALIASES" "$initdir"/lib/dracut/hostonly-kernel-modules.txt
     fi
 
@@ -1911,7 +1911,7 @@ if [[ $no_kernel != yes ]]; then
         hostonly='' instmods $drivers
     fi
 
-    if [[ -n "${add_drivers// /}" ]]; then
+    if [[ -n ${add_drivers// /} ]]; then
         # shellcheck disable=SC2086
         hostonly='' instmods -c $add_drivers
     fi
@@ -2015,11 +2015,11 @@ for ((i = 0; i < ${#include_src[@]}; i++)); do
             # symlinks to $prefix
             # Objectname is a file or a directory
             for objectname in "$src"/*; do
-                [[ -e "$objectname" || -L "$objectname" ]] || continue
-                if [[ -d "$objectname" ]]; then
+                [[ -e $objectname || -L $objectname ]] || continue
+                if [[ -d $objectname ]]; then
                     # objectname is a directory, let's compute the final directory name
                     object_destdir=${destdir}/${objectname#$src/}
-                    if ! [[ -e "$object_destdir" ]]; then
+                    if ! [[ -e $object_destdir ]]; then
                         # shellcheck disable=SC2174
                         mkdir -m 0755 -p "$object_destdir"
                         chmod --reference="$objectname" "$object_destdir"
@@ -2037,14 +2037,14 @@ for ((i = 0; i < ${#include_src[@]}; i++)); do
     fi
 done
 
-if [[ $do_hardlink = yes ]] && command -v hardlink > /dev/null; then
+if [[ $do_hardlink == yes ]] && command -v hardlink > /dev/null; then
     dinfo "*** Hardlinking files ***"
     hardlink "$initdir" 2>&1
     dinfo "*** Hardlinking files done ***"
 fi
 
 # strip binaries
-if [[ $do_strip = yes ]]; then
+if [[ $do_strip == yes ]]; then
     # Prefer strip from elfutils for package size
     declare strip_cmd
     strip_cmd=$(command -v eu-strip)
@@ -2063,7 +2063,7 @@ for d in $(ldconfig_paths); do
     rmdir -p --ignore-fail-on-non-empty "$initdir/$d" > /dev/null 2>&1
 done
 
-if [[ $early_microcode = yes ]]; then
+if [[ $early_microcode == yes ]]; then
     dinfo "*** Generating early-microcode cpio image ***"
     ucode_dir=(amd-ucode intel-ucode)
     ucode_dest=(AuthenticAMD.bin GenuineIntel.bin)
@@ -2092,7 +2092,7 @@ if [[ $early_microcode = yes ]]; then
                     break 2
                 done
                 for i in $_fwdir/$_fw/$_src; do
-                    [[ -e "$i" ]] || continue
+                    [[ -e $i ]] || continue
                     # skip gpg files
                     str_ends "$i" ".asc" && continue
                     cat "$i" >> "$_dest_dir/${ucode_dest[$idx]}"
@@ -2119,7 +2119,7 @@ if [[ $early_microcode = yes ]]; then
     done
 fi
 
-if [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]]; then
+if [[ $acpi_override == yes ]] && [[ -d $acpi_table_dir ]]; then
     dinfo "*** Packaging ACPI tables to override BIOS provided ones ***"
     _dest_dir="$early_cpio_dir/d/kernel/firmware/acpi"
     mkdir -p "$_dest_dir"
@@ -2155,7 +2155,7 @@ if [[ $kernel_only != yes ]]; then
     # libpthread workaround: pthread_cancel wants to dlopen libgcc_s.so
     for _dir in $libdirs; do
         for _f in "$dracutsysrootdir$_dir/libpthread.so"*; do
-            [[ -e "$_f" ]] || continue
+            [[ -e $_f ]] || continue
             inst_libdir_file "libgcc_s.so*"
             break 2
         done
@@ -2165,7 +2165,7 @@ if [[ $kernel_only != yes ]]; then
     if [[ $DRACUT_FIPS_MODE ]]; then
         for _dir in $libdirs; do
             for _f in "$dracutsysrootdir$_dir/libcrypto.so"*; do
-                [[ -e "$_f" ]] || continue
+                [[ -e $_f ]] || continue
                 inst_libdir_file -o "libssl.so*"
                 break 2
             done
@@ -2179,7 +2179,7 @@ if [[ $kernel_only != yes ]]; then
         [[ -f $f ]] && inst_simple "${f#$dracutsysrootdir}"
     done
     if ! $DRACUT_LDCONFIG -r "$initdir" -f /etc/ld.so.conf; then
-        if [[ $EUID = 0 ]]; then
+        if [[ $EUID == 0 ]]; then
             derror "ldconfig exited ungracefully"
         else
             derror "ldconfig might need uid=0 (root) for chroot()"
@@ -2195,7 +2195,7 @@ if dracut_module_included "squash"; then
     DRACUT_SQUASH_POST_INST=1 module_install "squash"
 fi
 
-if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
+if [[ $do_strip == yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
     dinfo "*** Stripping files ***"
     find "$initdir" -type f \
         -executable -not -path '*/lib/modules/*.ko' -print0 \
@@ -2239,7 +2239,7 @@ fi
 
 dinfo "*** Creating image file '$outfile' ***"
 
-if [[ $uefi = yes ]]; then
+if [[ $uefi == yes ]]; then
     readonly uefi_outdir="$DRACUT_TMPDIR/uefi"
     mkdir -p "$uefi_outdir"
 fi
@@ -2255,9 +2255,9 @@ if [[ $DRACUT_REPRODUCIBLE ]]; then
     fi
 fi
 
-[[ "$EUID" != 0 ]] && cpio_owner="0:0"
+[[ $EUID != 0 ]] && cpio_owner="0:0"
 
-if [[ $create_early_cpio = yes ]]; then
+if [[ $create_early_cpio == yes ]]; then
     echo 1 > "$early_cpio_dir/d/early_cpio"
 
     if [[ $DRACUT_REPRODUCIBLE ]]; then
@@ -2285,7 +2285,7 @@ if ! [[ $compress ]]; then
         compress="$i"
         break
     done
-    if [[ $compress = cat ]]; then
+    if [[ $compress == cat ]]; then
         printf "%s\n" "dracut: no compression tool available. Initramfs image is going to be big." >&2
     fi
 fi
@@ -2293,7 +2293,7 @@ fi
 # choose the right arguments for the compressor
 case $compress in
     bzip2 | lbzip2)
-        if [[ "$compress" = lbzip2 ]] || command -v "$DRACUT_COMPRESS_LBZIP2" &> /dev/null; then
+        if [[ $compress == lbzip2 ]] || command -v "$DRACUT_COMPRESS_LBZIP2" &> /dev/null; then
             compress="$DRACUT_COMPRESS_LBZIP2 -9"
         else
             compress="$DRACUT_COMPRESS_BZIP2 -9"
@@ -2306,7 +2306,7 @@ case $compress in
         compress="$DRACUT_COMPRESS_XZ --check=crc32 --lzma2=dict=1MiB -T0"
         ;;
     gzip | pigz)
-        if [[ "$compress" = pigz ]] || command -v "$DRACUT_COMPRESS_PIGZ" &> /dev/null; then
+        if [[ $compress == pigz ]] || command -v "$DRACUT_COMPRESS_PIGZ" &> /dev/null; then
             compress="$DRACUT_COMPRESS_PIGZ -9 -n -T -R"
         elif command -v gzip &> /dev/null && $DRACUT_COMPRESS_GZIP --help 2>&1 | grep -q rsyncable; then
             compress="$DRACUT_COMPRESS_GZIP -n -9 --rsyncable"
@@ -2347,17 +2347,17 @@ fi
 
 umask 077
 
-if [[ $uefi = yes ]]; then
+if [[ $uefi == yes ]]; then
     if [[ $kernel_cmdline ]]; then
         echo -n "$kernel_cmdline" > "$uefi_outdir/cmdline.txt"
-    elif [[ $hostonly_cmdline = yes ]] && [ -d "$initdir/etc/cmdline.d" ]; then
+    elif [[ $hostonly_cmdline == yes ]] && [ -d "$initdir/etc/cmdline.d" ]; then
         for conf in "$initdir"/etc/cmdline.d/*.conf; do
             [ -e "$conf" ] || continue
             printf "%s " "$(< "$conf")" >> "$uefi_outdir/cmdline.txt"
         done
     fi
 
-    if [[ $kernel_cmdline ]] || [[ $hostonly_cmdline = yes && -d "$initdir/etc/cmdline.d" ]]; then
+    if [[ $kernel_cmdline ]] || [[ $hostonly_cmdline == yes && -d "$initdir/etc/cmdline.d" ]]; then
         echo -ne "\x00" >> "$uefi_outdir/cmdline.txt"
         dinfo "Using UEFI kernel cmdline:"
         dinfo "$(tr -d '\000' < "$uefi_outdir/cmdline.txt")"
@@ -2381,7 +2381,7 @@ if [[ $uefi = yes ]]; then
         --add-section .linux="$kernel_image" --change-section-vma .linux=0x2000000 \
         --add-section .initrd="${DRACUT_TMPDIR}/initramfs.img" --change-section-vma .initrd=0x3000000 \
         "$uefi_stub" "${uefi_outdir}/linux.efi"; then
-        if [[ -n "${uefi_secureboot_key}" && -n "${uefi_secureboot_cert}" ]]; then
+        if [[ -n ${uefi_secureboot_key} && -n ${uefi_secureboot_cert} ]]; then
             if sbsign \
                 --key "${uefi_secureboot_key}" \
                 --cert "${uefi_secureboot_cert}" \
@@ -2428,7 +2428,7 @@ freeze_ok_for_btrfs() {
     mnt=$(stat -c %m -- "$1")
     uuid1=$(btrfs_uuid "$mnt")
     uuid2=$(btrfs_uuid "/")
-    [[ "$uuid1" && "$uuid2" && "$uuid1" != "$uuid2" ]]
+    [[ $uuid1 && $uuid2 && $uuid1 != "$uuid2" ]]
 }
 
 freeze_ok_for_fstype() {
index e6f933787f498a13551c5ee147abc692fc0262b0..1fa1042b978b7ade3dbfff9bfb1b30acd335e0da 100755 (executable)
@@ -2,7 +2,7 @@
 
 set -e
 
-if [[ -z "$DRACUT_TMPDIR" ]]; then
+if [[ -z $DRACUT_TMPDIR ]]; then
     echo "DRACUT_TMPDIR is unset, exiting"
     exit 0
 fi
index 77ecff76a86b3625c1d3a105de195bbb3a9a922e..ca7a9c5f26d90b650246fc686649256836bc0a35 100644 (file)
@@ -18,7 +18,7 @@
 __contains_word() {
     local word="$1"
     shift
-    for w in "$@"; do [[ $w = "$word" ]] && return 0; done
+    for w in "$@"; do [[ $w == "$word" ]] && return 0; done
     return 1
 }
 
@@ -52,7 +52,7 @@ _lsinitrd() {
         return 0
     fi
 
-    if [[ $cur = -* ]]; then
+    if [[ $cur == -* ]]; then
         # shellcheck disable=SC2207
         # shellcheck disable=SC2016
         COMPREPLY=($(compgen -W '${OPTS[*]}' -- "$cur"))
index d6362db1006f4dcd368e5fb99684d8cf72c14828..293d2f726fec3114d7e2647c2a8ae0bd5e036d8e 100755 (executable)
@@ -99,7 +99,7 @@ done
 
 if [[ $1 ]]; then
     image="$1"
-    if ! [[ -f "$image" ]]; then
+    if ! [[ -f $image ]]; then
         {
             echo "$image does not exist"
             echo
@@ -129,7 +129,7 @@ while (($# > 0)); do
     shift
 done
 
-if ! [[ -f "$image" ]]; then
+if ! [[ -f $image ]]; then
     {
         echo "No <initramfs file> specified and the default image '$image' cannot be accessed!"
         echo
@@ -220,7 +220,7 @@ if [ "$bin" = "MZ" ]; then
     [ -f "$image" ] || exit 1
 fi
 
-if ((${#filenames[@]} <= 0)) && [[ -z "$unpack" ]] && [[ -z "$unpackearly" ]]; then
+if ((${#filenames[@]} <= 0)) && [[ -z $unpack ]] && [[ -z $unpackearly ]]; then
     if [ -n "$uefi" ]; then
         echo -n "initrd in UEFI: $uefi: "
         du -h $image | while read a b || [ -n "$a" ]; do echo $a; done
@@ -254,10 +254,10 @@ case $bin in
         # Debian mkinitramfs does not create the file 'early_cpio', so let's check if firmware files exist
         [[ "$is_early" ]] || is_early=$(cpio --list --verbose --quiet --to-stdout -- 'kernel/*/microcode/*.bin' < "$image" 2> /dev/null)
         if [[ "$is_early" ]]; then
-            if [[ -n "$unpack" ]]; then
+            if [[ -n $unpack ]]; then
                 # should use --unpackearly for early CPIO
                 :
-            elif [[ -n "$unpackearly" ]]; then
+            elif [[ -n $unpackearly ]]; then
                 unpack_files
             elif ((${#filenames[@]} > 0)); then
                 extract_files
@@ -333,7 +333,7 @@ fi
 
 ret=0
 
-if [[ -n "$unpack" ]]; then
+if [[ -n $unpack ]]; then
     unpack_files
 elif ((${#filenames[@]} > 0)); then
     extract_files
index 0e5531738503e1dea8affd825a815439de8a3ce5..2abf34fab797ccc37ecf2d26985d8fb3fe2e5f89 100755 (executable)
@@ -9,7 +9,7 @@ force=0
 error() { echo "$@" >&2; }
 
 usage() {
-    [[ $1 = '-n' ]] && cmd=echo || cmd=error
+    [[ $1 == '-n' ]] && cmd=echo || cmd=error
 
     $cmd "usage: ${0##*/} [--version] [--help] [-v] [-f] [--preload <module>]"
     $cmd "       [--image-version] [--with=<module>]"
@@ -18,7 +18,7 @@ usage() {
     $cmd ""
     $cmd "       (ex: ${0##*/} /boot/initramfs-$kver.img $kver)"
 
-    [[ $1 = '-n' ]] && exit 0
+    [[ $1 == '-n' ]] && exit 0
     exit 1
 }
 
@@ -34,17 +34,17 @@ read_arg() {
     if [[ $2 =~ $rematch ]]; then
         read "$param" <<< "${BASH_REMATCH[1]}"
     else
-        for ((i = 3; $i <= $#; i++)); do
+        for ((i = 3; i <= $#; i++)); do
             # Only read next arg if it not an arg itself.
-            if [[ ${*:$i:1} = -* ]]; then
+            if [[ ${*:i:1} == -* ]]; then
                 break
             fi
-            result="$result ${@:$i:1}"
+            result="$result ${@:i:1}"
             # There is no way to shift our callers args, so
             # return "no of args" to indicate they should do it instead.
         done
         read "$1" <<< "$result"
-        return $(($i - 3))
+        return $((i - 3))
     fi
 }
 
@@ -210,7 +210,7 @@ targets=($targets)
 [[ $force == 1 ]] && dracut_args="${dracut_args} -f"
 
 echo "Creating: target|kernel|dracut args|basicmodules "
-for ((i = 0; $i < ${#targets[@]}; i++)); do
+for ((i = 0; i < ${#targets[@]}; i++)); do
 
     if [[ $img_vers ]]; then
         target="${targets[$i]}-${kernels[$i]}"
index 2d74975786f8d723714392052e05a46b8ceb5dec..4e2a34fae1a20b1d9a2d4c562013e6be5575c4c1 100755 (executable)
@@ -26,7 +26,7 @@ dracut_cmd=dracut
 error() { echo "$@" >&2; }
 
 usage() {
-    [[ $1 = '-n' ]] && cmd=echo || cmd=error
+    [[ $1 == '-n' ]] && cmd=echo || cmd=error
 
     $cmd "usage: ${0##*/} [options]"
     $cmd ""
@@ -37,27 +37,27 @@ usage() {
     $cmd "     for the root file system, or a network interface driver module for dhcp."
     $cmd ""
     $cmd "     options:"
-    $cmd "     -f \"feature list\"     Features to be enabled when generating initrd."
+    $cmd '     -f "feature list"       Features to be enabled when generating initrd.'
     $cmd "                             Available features are:"
     $cmd "                                     iscsi, md, multipath, lvm, lvm2,"
     $cmd "                                     ifup, fcoe, dcbd"
-    $cmd "     -k \"kernel list\"      List of kernel images for which initrd files are"
+    $cmd '     -k "kernel list"        List of kernel images for which initrd files are'
     $cmd "                             created. Defaults to all kernels found in /boot."
-    $cmd "     -i \"initrd list\"      List of file names for the initrd; position have"
-    $cmd "                             match to \"kernel list\". Defaults to all kernels"
+    $cmd '     -i "initrd list"        List of file names for the initrd; position have'
+    $cmd '                             match to "kernel list". Defaults to all kernels'
     $cmd "                             found in /boot."
     $cmd "     -b boot_dir             Boot directory. Defaults to /boot."
     $cmd "     -t tmp_dir              Temporary directory. Defaults to /var/tmp."
     $cmd "     -M map                  System.map file to use."
-    $cmd "     -A                      Create a so called \"monster initrd\" which"
+    $cmd '     -A                      Create a so called "monster initrd" which'
     $cmd "                             includes all features and modules possible."
     $cmd "     -B                      Do not update bootloader configuration."
     $cmd "     -v                      Verbose mode."
     $cmd "     -L                      Disable logging."
     $cmd "     -h                      This help screen."
-    $cmd "     -m \"module list\"      Modules to include in initrd. Defaults to the"
+    $cmd '     -m "module list"        Modules to include in initrd. Defaults to the'
     $cmd "                             INITRD_MODULES variable in /etc/sysconfig/kernel"
-    $cmd "     -u \"DomU module list\" Modules to include in initrd. Defaults to the"
+    $cmd '     -u "DomU module list"   Modules to include in initrd. Defaults to the'
     $cmd "                             DOMU_INITRD_MODULES variable in"
     $cmd "                             /etc/sysconfig/kernel."
     $cmd "     -d root_device          Root device. Defaults to the device from"
@@ -69,7 +69,7 @@ usage() {
     $cmd "     -a acpi_dsdt            Obsolete, do not use."
     $cmd "     -s size                 Add splash animation and bootscreen to initrd."
 
-    [[ $1 = '-n' ]] && exit 0
+    [[ $1 == '-n' ]] && exit 0
     exit 1
 }
 
@@ -85,17 +85,17 @@ read_arg() {
     if [[ $2 =~ $rematch ]]; then
         read "$param" <<< "${BASH_REMATCH[1]}"
     else
-        for ((i = 3; $i <= $#; i++)); do
+        for ((i = 3; i <= $#; i++)); do
             # Only read next arg if it not an arg itself.
-            if [[ ${*:$i:1} = -* ]]; then
+            if [[ ${*:i:1} == -* ]]; then
                 break
             fi
-            result="$result ${@:$i:1}"
+            result="$result ${@:i:1}"
             # There is no way to shift our callers args, so
             # return "no of args" to indicate they should do it instead.
         done
         read "$1" <<< "$result"
-        return $(($i - 3))
+        return $((i - 3))
     fi
 }
 
@@ -104,7 +104,7 @@ calc_netmask() {
     local prefix=$1
 
     [ -z "$prefix" ] && return
-    mask=$((0xffffffff << (32 - $prefix)))
+    mask=$((0xffffffff << (32 - prefix)))
     byte1=$((mask >> 24))
     byte2=$((mask >> 16))
     byte3=$((mask >> 8))
@@ -137,7 +137,7 @@ is_xen_kernel() {
 
     for cfg in ${root_dir}/boot/config-$kversion $root_dir/lib/modules/$kversion/build/.config; do
         test -r $cfg || continue
-        grep -q "^CONFIG_XEN=y\$" $cfg
+        grep -q '^CONFIG_XEN=y$' $cfg
         return
     done
     test $kversion != "${kversion%-xen*}"
@@ -146,7 +146,7 @@ is_xen_kernel() {
 
 kernel_version_from_image() {
     local dir="${1%/*}/"
-    [[ "$dir" != "$1" ]] || dir=""
+    [[ $dir != "$1" ]] || dir=""
     local kernel_image="$1" kernel_image_gz="${dir}vmlinux-${1#*-}.gz"
     echo kernel_image_gz="'$kernel_image_gz'" >&2
 
@@ -337,7 +337,7 @@ shopt -s extglob
 
 failed=""
 
-for ((i = 0; $i < ${#targets[@]}; i++)); do
+for ((i = 0; i < ${#targets[@]}; i++)); do
 
     if [[ $img_vers ]]; then
         target="${targets[$i]}-${kernels[$i]}"
index 53e1999287b80a0fb9c9a0a67939e42e875017a7..7dc2239b2d0890f93ed598b9b6bbee6a9f984c64 100755 (executable)
@@ -40,8 +40,8 @@ installkernel() {
 install() {
     local _mods
 
-    if [[ "$prefix" == /run/* ]]; then
-        dfatal "systemd does not work with a prefix, which contains \"/run\"!!"
+    if [[ $prefix == /run/* ]]; then
+        dfatal 'systemd does not work with a prefix, which contains "/run"!!'
         exit 1
     fi
 
index 4b644dfd952b78e168a2d0022b0b5f5f2f047b5f..b4e3db666aba20ba65036019950159b6e980136e 100755 (executable)
@@ -39,7 +39,7 @@ mount_boot() {
                 fi
                 [ -e $boot ] && break
                 sleep 0.5
-                i=$(($i + 1))
+                i=$((i + 1))
                 [ $i -gt 40 ] && break
             done
         fi
index b723dc6ca4eb6a2f7054d7bb556c0a4fe1a4bec4..38485cfb75b69dc9a6bcee2fdffac0092c7cac3e 100755 (executable)
@@ -49,9 +49,9 @@ installkernel() {
     done
 
     # with hostonly_default_device fs module for /boot is not installed by default
-    if [[ $hostonly ]] && [[ "$hostonly_default_device" == "no" ]]; then
+    if [[ $hostonly ]] && [[ $hostonly_default_device == "no" ]]; then
         _bootfstype=$(find_mp_fstype /boot)
-        if [[ -n "$_bootfstype" ]]; then
+        if [[ -n $_bootfstype ]]; then
             hostonly='' instmods $_bootfstype
         else
             dwarning "Can't determine fs type for /boot, FIPS check may fail."
index 2dec31bd7bd15343a2d0b40111c26e3f773cb5c2..08fd3418b47aee1ffbae79625e72f9b8809c6bca 100755 (executable)
@@ -13,7 +13,7 @@ check() {
     # if no keys are present
     if [[ $hostonly ]]; then
         x=$(echo "$dracutsysrootdir"/lib/modules/keys/*)
-        [[ "${x}" = "$dracutsysrootdir/lib/modules/keys/*" ]] && return 255
+        [[ ${x} == "$dracutsysrootdir/lib/modules/keys/*" ]] && return 255
     fi
 
     return 0
@@ -32,7 +32,7 @@ install() {
     inst_hook pre-trigger 01 "$moddir/load-modsign-keys.sh"
 
     for x in "$dracutsysrootdir"/lib/modules/keys/*; do
-        [[ "${x}" = "$dracutsysrootdir/lib/modules/keys/*" ]] && break
+        [[ ${x} == "$dracutsysrootdir/lib/modules/keys/*" ]] && break
         inst_simple "${x#$dracutsysrootdir}"
     done
 }
index 9f4d22185b1071ecf604beb3554f5083d8ebd26f..22ee54e7ec1805281ecc7338d646119f81518c94 100755 (executable)
@@ -145,9 +145,9 @@ install() {
 
         shopt -q -s nocasematch
         if [[ ${UNICODE} ]]; then
-            if [[ ${UNICODE} = YES || ${UNICODE} = 1 ]]; then
+            if [[ ${UNICODE} == YES || ${UNICODE} == 1 ]]; then
                 UNICODE=1
-            elif [[ ${UNICODE} = NO || ${UNICODE} = 0 ]]; then
+            elif [[ ${UNICODE} == NO || ${UNICODE} == 0 ]]; then
                 UNICODE=0
             else
                 UNICODE=''
index 6bd5df46d64d336e7b14dfa16d969aac85448aac..d947ca3d285355fcfee657ac502d067b0f29fbf4 100755 (executable)
@@ -2,12 +2,12 @@
 
 ROOT="$1"
 
-if [[ ! -d "$ROOT" ]]; then
+if [[ ! -d $ROOT ]]; then
     echo "Usage: $0 <rootdir>"
     exit 1
 fi
 
-if [[ "$ROOT" -ef / ]]; then
+if [[ $ROOT -ef / ]]; then
     echo "Can't convert the running system."
     echo "Please boot with 'rd.convertfs' on the kernel command line,"
     echo "to update with the help of the initramfs,"
@@ -15,7 +15,7 @@ if [[ "$ROOT" -ef / ]]; then
     exit 1
 fi
 
-while [[ "$ROOT" != "${ROOT%/}" ]]; do
+while [[ $ROOT != "${ROOT%/}" ]]; do
     ROOT=${ROOT%/}
 done
 
@@ -33,8 +33,8 @@ fi
 
 needconvert() {
     for dir in "$ROOT/bin" "$ROOT/sbin" "$ROOT/lib" "$ROOT/lib64"; do
-        if [[ -e "$dir" ]]; then
-            [[ -L "$dir" ]] || return 0
+        if [[ -e $dir ]]; then
+            [[ -L $dir ]] || return 0
         fi
     done
     return 1
@@ -55,7 +55,7 @@ fi
 testfile="$ROOT/.usrmovecheck$$"
 rm -f -- "$testfile"
 > "$testfile"
-if [[ ! -e "$testfile" ]]; then
+if [[ ! -e $testfile ]]; then
     echo "Cannot write to $ROOT/"
     exit 1
 fi
@@ -64,7 +64,7 @@ rm -f -- "$testfile"
 testfile="$ROOT/usr/.usrmovecheck$$"
 rm -f -- "$testfile"
 > "$testfile"
-if [[ ! -e "$testfile" ]]; then
+if [[ ! -e $testfile ]]; then
     echo "Cannot write to $ROOT/usr/"
     exit 1
 fi
index 93f22241c6c7d4652aaa6aa866ff1579609efb2f..b4ba61f0a6ac67d6b2e66efa1e42e6f6e732ed6f 100755 (executable)
@@ -58,7 +58,7 @@ do_dhclient() {
             fi
         fi
 
-        _COUNT=$(($_COUNT + 1))
+        _COUNT=$((_COUNT + 1))
         [ $_COUNT -lt $_DHCPRETRY ] && sleep 1
     done
     warn "dhcp for interface $netif failed"
index 46a15c5ca766dbeb879e87c5205d0fee7b2e5c44..4d91ee85185e47ea1386e583d279b904f30cabf0 100755 (executable)
@@ -87,7 +87,7 @@ do_dhcp() {
             -lf /tmp/dhclient.$netif.lease \
             $netif \
             && return 0
-        _COUNT=$(($_COUNT + 1))
+        _COUNT=$((_COUNT + 1))
         [ $_COUNT -lt $_DHCPRETRY ] && sleep 1
     done
     warn "dhcp for interface $netif failed"
@@ -102,7 +102,7 @@ load_ipv6() {
     modprobe ipv6
     i=0
     while [ ! -d /proc/sys/net/ipv6 ]; do
-        i=$(($i + 1))
+        i=$((i + 1))
         [ $i -gt 10 ] && break
         sleep 0.1
     done
index 69b2fa350c98a179df004e743fc9ce6e1e812f70..dcec8ebe3f529ec22fe4c8e57dd32e876202eefc 100755 (executable)
@@ -28,7 +28,7 @@ if [ -z "$NEEDBOOTDEV" ]; then
                 continue
                 ;;
         esac
-        count=$(($count + 1))
+        count=$((count + 1))
     done
     [ $count -gt 1 ] && NEEDBOOTDEV=1
 fi
index b95cb8b596de3bb279f71b4be6fa0c66e92b39ca..b592a25c8cad75be1e052508ab69af58c4402bc7 100755 (executable)
@@ -214,7 +214,7 @@ set_ifname() {
     done
     # otherwise, pick a new name and use that
     while :; do
-        num=$(($num + 1))
+        num=$((num + 1))
         [ -e /sys/class/net/$name$num ] && continue
         for n in $(getargs ifname=); do
             [ "$name$num" = "${n%%:*}" ] && continue 2
@@ -261,10 +261,10 @@ ibft_to_cmdline() {
                 echo $a
             )
             # Skip invalid interfaces
-            (($flags & 1)) || continue
+            ((flags & 1)) || continue
             # Skip interfaces not used for booting unless using multipath
             if ! getargbool 0 rd.iscsi.mp; then
-                (($flags & 2)) || continue
+                ((flags & 2)) || continue
             fi
             [ -e ${iface}/dhcp ] && dhcp=$(
                 read a < ${iface}/dhcp
@@ -639,7 +639,7 @@ parse_ifname_opts() {
         eth[0-9] | eth[0-9][0-9] | eth[0-9][0-9][0-9] | eth[0-9][0-9][0-9][0-9])
             warn "ifname=$ifname_if uses the kernel name space for interfaces"
             warn "This can fail for multiple network interfaces and is discouraged!"
-            warn "Please use a custom name like \"netboot\" or \"bluesocket\""
+            warn 'Please use a custom name like "netboot" or "bluesocket"'
             warn "or use biosdevname and no ifname= at all."
             ;;
     esac
@@ -652,13 +652,13 @@ wait_for_if_link() {
     local li
     local timeout="$(getargs rd.net.timeout.iflink=)"
     timeout=${timeout:-60}
-    timeout=$(($timeout * 10))
+    timeout=$((timeout * 10))
 
     while [ $cnt -lt $timeout ]; do
         li=$(ip link show dev $1 2> /dev/null)
         [ -n "$li" ] && return 0
         sleep 0.1
-        cnt=$(($cnt + 1))
+        cnt=$((cnt + 1))
     done
     return 1
 }
@@ -668,7 +668,7 @@ wait_for_if_up() {
     local li
     local timeout="$(getargs rd.net.timeout.ifup=)"
     timeout=${timeout:-20}
-    timeout=$(($timeout * 10))
+    timeout=$((timeout * 10))
 
     while [ $cnt -lt $timeout ]; do
         li=$(ip link show up dev $1)
@@ -691,7 +691,7 @@ wait_for_if_up() {
             return 0
         fi
         sleep 0.1
-        cnt=$(($cnt + 1))
+        cnt=$((cnt + 1))
     done
     return 1
 }
@@ -700,13 +700,13 @@ wait_for_route_ok() {
     local cnt=0
     local timeout="$(getargs rd.net.timeout.route=)"
     timeout=${timeout:-20}
-    timeout=$(($timeout * 10))
+    timeout=$((timeout * 10))
 
     while [ $cnt -lt $timeout ]; do
         li=$(ip route show)
         [ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
         sleep 0.1
-        cnt=$(($cnt + 1))
+        cnt=$((cnt + 1))
     done
     return 1
 }
@@ -715,7 +715,7 @@ wait_for_ipv6_dad_link() {
     local cnt=0
     local timeout="$(getargs rd.net.timeout.ipv6dad=)"
     timeout=${timeout:-50}
-    timeout=$(($timeout * 10))
+    timeout=$((timeout * 10))
 
     while [ $cnt -lt $timeout ]; do
         [ -n "$(ip -6 addr show dev "$1" scope link)" ] \
@@ -724,7 +724,7 @@ wait_for_ipv6_dad_link() {
         [ -n "$(ip -6 addr show dev "$1" scope link dadfailed)" ] \
             && return 1
         sleep 0.1
-        cnt=$(($cnt + 1))
+        cnt=$((cnt + 1))
     done
     return 1
 }
@@ -733,7 +733,7 @@ wait_for_ipv6_dad() {
     local cnt=0
     local timeout="$(getargs rd.net.timeout.ipv6dad=)"
     timeout=${timeout:-50}
-    timeout=$(($timeout * 10))
+    timeout=$((timeout * 10))
 
     while [ $cnt -lt $timeout ]; do
         [ -n "$(ip -6 addr show dev "$1")" ] \
@@ -743,7 +743,7 @@ wait_for_ipv6_dad() {
         [ -n "$(ip -6 addr show dev "$1" dadfailed)" ] \
             && return 1
         sleep 0.1
-        cnt=$(($cnt + 1))
+        cnt=$((cnt + 1))
     done
     return 1
 }
@@ -752,14 +752,14 @@ wait_for_ipv6_auto() {
     local cnt=0
     local timeout="$(getargs rd.net.timeout.ipv6auto=)"
     timeout=${timeout:-40}
-    timeout=$(($timeout * 10))
+    timeout=$((timeout * 10))
 
     while [ $cnt -lt $timeout ]; do
         [ -z "$(ip -6 addr show dev "$1" tentative)" ] \
             && [ -n "$(ip -6 route list proto ra dev "$1" | grep ^default)" ] \
             && return 0
         sleep 0.1
-        cnt=$(($cnt + 1))
+        cnt=$((cnt + 1))
     done
     return 1
 }
@@ -781,7 +781,7 @@ iface_has_carrier() {
     [ -d "$interface" ] || return 2
     local timeout="$(getargs rd.net.timeout.carrier=)"
     timeout=${timeout:-10}
-    timeout=$(($timeout * 10))
+    timeout=$((timeout * 10))
 
     linkup "$1"
 
@@ -800,7 +800,7 @@ iface_has_carrier() {
         # double check the syscfs carrier flag
         [ -e "$interface/carrier" ] && [ "$(cat $interface/carrier)" = 1 ] && return 0
         sleep 0.1
-        cnt=$(($cnt + 1))
+        cnt=$((cnt + 1))
     done
     return 1
 }
index ebf9c5fb9c2e132320b2478c40f21f8fa203889c..e94a14300891c193edf47106c490da87c0485568 100755 (executable)
@@ -15,7 +15,7 @@ installkernel() {
     local _modname
     # Include KMS capable drm drivers
 
-    if [[ "${DRACUT_ARCH:-$(uname -m)}" == arm* || "${DRACUT_ARCH:-$(uname -m)}" == aarch64 ]]; then
+    if [[ ${DRACUT_ARCH:-$(uname -m)} == arm* || ${DRACUT_ARCH:-$(uname -m)} == aarch64 ]]; then
         # arm/aarch64 specific modules needed by drm
         instmods \
             "=drivers/gpu/drm/i2c" \
index 336b99419e9d0ad7de5b16b7a7d3b26f82f4a65c..ee7b64128098230ce0dafd8ed38fd74b4b085703 100755 (executable)
@@ -32,7 +32,7 @@ install() {
                     dwarn "${line}"
                 else
                     derror "${line}"
-                    (($_ret == 0)) && _ret=1
+                    ((_ret == 0)) && _ret=1
                 fi
             done
         fi
index 3eaa64498dce52e49d0c086a0ed075b47fe75b16..32f6cf307945ec7c29a32bfdb6904d987b7a789a 100755 (executable)
@@ -32,7 +32,7 @@ if [[ $hostonly ]]; then
     fi
 else
     for x in "$dracutsysrootdir"/usr/share/plymouth/themes/{text,details}/*; do
-        [[ -f "$x" ]] || continue
+        [[ -f $x ]] || continue
         THEME_DIR=$(dirname "${x#$dracutsysrootdir}")
         mkdir -m 0755 -p "${initdir}/$THEME_DIR"
         inst_multiple "${x#$dracutsysrootdir}"
index 36dc5411813967f662bfc680c1361387dbada30d..3b3cdb4ed16e57d8d5e6f8a83ecde142c3b6c45f 100755 (executable)
@@ -16,7 +16,7 @@ function sysecho() {
     done
     local status
     read status < "$file"
-    if [[ ! $status == $* ]]; then
+    if [[ $status != $* ]]; then
         [ -f "$file" ] && echo $* > "$file"
     fi
 }
@@ -155,7 +155,7 @@ processcmsfile() {
             echo -n $NETTYPE,$SUBCHANNELS
             [[ $PORTNAME ]] && echo -n ",portname=$PORTNAME"
             [[ $LAYER2 ]] && echo -n ",layer2=$LAYER2"
-            [[ "$NETTYPE" = "ctc" ]] && [[ $CTCPROT ]] && echo -n ",protocol=$CTCPROT"
+            [[ $NETTYPE == "ctc" ]] && [[ $CTCPROT ]] && echo -n ",protocol=$CTCPROT"
             echo
         ) >> /etc/ccw.conf
 
index f758bf695d5674e3de9b9e3d30b0b4ef2fb4ceab..9293335a8b29fe683aa9324618bcb523758b7f88 100755 (executable)
@@ -9,7 +9,7 @@ check() {
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
         for fs in "${host_fs_types[@]}"; do
-            [[ "$fs" == "btrfs" ]] && return 0
+            [[ $fs == "btrfs" ]] && return 0
         done
         return 255
     }
index 07d92d41dafb9a13dfb3d8b2363d4d461a20a365..de39a93ea261e6885856bbafcf2ed14ad1c8be20 100755 (executable)
@@ -126,7 +126,7 @@ ask_for_password() {
                     && printf "$tty_prompt [$i/$tty_tries]:" >&2
                 eval "$tty_cmd" && ret=0 && break
                 ret=$?
-                i=$(($i + 1))
+                i=$((i + 1))
                 [ -n "$tty_prompt" ] && printf '\n' >&2
             done
 
index 79d1a2584e10ff7983ca9539c5853540b4b5a1bb..226b2e4973a7821105f4cabf2cae808e2d5af0b5 100755 (executable)
@@ -157,7 +157,7 @@ else
             info "No key found for $device.  Will try $numtries time(s) more later."
             initqueue --unique --onetime --settled \
                 --name cryptroot-ask-$luksname \
-                $(command -v cryptroot-ask) "$device" "$luksname" "$is_keysource" "$(($numtries - 1))"
+                $(command -v cryptroot-ask) "$device" "$luksname" "$is_keysource" "$((numtries - 1))"
             exit 0
         fi
         unset tmp
index 330e4b41a1bd7a47211e519af15a5bd78b111fc9..4ffeaf36c4d3f0fdcf292c6475bca418d74ebcf6 100755 (executable)
@@ -8,7 +8,7 @@ check() {
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
         for fs in "${host_fs_types[@]}"; do
-            [[ $fs = "crypto_LUKS" ]] && return 0
+            [[ $fs == "crypto_LUKS" ]] && return 0
         done
         return 255
     }
@@ -57,12 +57,12 @@ installkernel() {
 cmdline() {
     local dev UUID
     for dev in "${!host_fs_types[@]}"; do
-        [[ "${host_fs_types[$dev]}" != "crypto_LUKS" ]] && continue
+        [[ ${host_fs_types[$dev]} != "crypto_LUKS" ]] && continue
 
         UUID=$(
             blkid -u crypto -o export $dev \
                 | while read line || [ -n "$line" ]; do
-                    [[ ${line#UUID} = $line ]] && continue
+                    [[ ${line#UUID} == $line ]] && continue
                     printf "%s" "${line#UUID=}"
                     break
                 done
@@ -92,7 +92,7 @@ install() {
     if [[ $hostonly ]] && [[ -f $dracutsysrootdir/etc/crypttab ]]; then
         # filter /etc/crypttab for the devices we need
         while read _mapper _dev _luksfile _luksoptions || [ -n "$_mapper" ]; do
-            [[ $_mapper = \#* ]] && continue
+            [[ $_mapper == \#* ]] && continue
             [[ $_dev ]] || continue
 
             [[ $_dev == PARTUUID=* ]] \
index 10868995afa8bab3d93aed59d4556078ca905cae..260af184f304b20c830aa60885506427c5068d10 100755 (executable)
@@ -10,12 +10,12 @@ check() {
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
         for dev in "${!host_fs_types[@]}"; do
-            [[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue
+            [[ ${host_fs_types[$dev]} != *_raid_member ]] && continue
 
             DEVPATH=$(get_devpath_block "$dev")
 
             for holder in "$DEVPATH"/holders/*; do
-                [[ -e "$holder" ]] || continue
+                [[ -e $holder ]] || continue
                 [[ -e "$holder/dm" ]] && return 0
                 break
             done
@@ -40,12 +40,12 @@ cmdline() {
 
     for dev in "${!host_fs_types[@]}"; do
         local holder DEVPATH DM_NAME majmin
-        [[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue
+        [[ ${host_fs_types[$dev]} != *_raid_member ]] && continue
 
         DEVPATH=$(get_devpath_block "$dev")
 
         for holder in "$DEVPATH"/holders/*; do
-            [[ -e "$holder" ]] || continue
+            [[ -e $holder ]] || continue
             dev="/dev/${holder##*/}"
             DM_NAME="$(dmsetup info -c --noheadings -o name "$dev" 2> /dev/null)"
             [[ ${DM_NAME} ]] && break
index a0d7d71125430383fed0c8621ae8b50feb337cbc..dfd0c56aa3c9be118ac27c005ef704d933861b1e 100755 (executable)
@@ -249,8 +249,8 @@ do_live_overlay() {
         mkdir -m 0755 -p /run/initramfs/thin-overlay
 
         # In block units (512b)
-        thin_data_sz=$(($overlay_size * 1024 * 1024 / 512))
-        thin_meta_sz=$(($thin_data_sz / 10))
+        thin_data_sz=$((overlay_size * 1024 * 1024 / 512))
+        thin_meta_sz=$((thin_data_sz / 10))
 
         # It is important to have the backing file on a tmpfs
         # this is needed to let the loopdevice support TRIM
index 345efa92123074aad4734db189d9eb81662d803e..89a5c4b661ecfb760af06d91ffa2ebc6365c166e 100755 (executable)
@@ -25,7 +25,7 @@ installkernel() {
     : "${depmod_modules_dep:=$srcmods/modules.dep}"
     : "${depmod_module_dir:=$srcmods}"
 
-    [[ -f "${depmod_modules_dep}" ]] || return 0
+    [[ -f ${depmod_modules_dep} ]] || return 0
 
     # Message printers with custom prefix
     local mod_name="kernel-modules-extra"
@@ -61,7 +61,7 @@ installkernel() {
         # configuration path
         if [ -d "$cfg" ]; then
             for f in "$cfg/"*; do
-                [[ -e "$f" && ! -d "$f" ]] || {
+                [[ -e $f && ! -d $f ]] || {
                     prdebug "configuration source" \
                         "\"$cfg\" is ignored" \
                         "(directory or doesn't exist)"
@@ -96,14 +96,14 @@ installkernel() {
                 override) # module_name kver_pattern dir
                     read -r mod kverpat path <<< "$v"
 
-                    if [[ ! "$mod" || ! "$kverpat" || ! "$path" ]]; then
+                    if [[ ! $mod || ! $kverpat || ! $path ]]; then
                         prinfo "$cfg: ignoring incorrect" \
                             "override option: \"$k $v\""
                         continue
                     fi
 
-                    if [[ '*' = "$kverpat" ]] \
-                        || [[ "$kernel" =~ $kverpat ]]; then
+                    if [[ '*' == "$kverpat" ]] \
+                        || [[ $kernel =~ $kverpat ]]; then
                         overrides+=("${path}/${mod}")
 
                         prdebug "$cfg: added override" \
@@ -117,14 +117,14 @@ installkernel() {
                 external) # kverpat dir
                     read -r kverpat path <<< "$v"
 
-                    if [[ ! "$kverpat" || ! "$path" ]]; then
+                    if [[ ! $kverpat || ! $path ]]; then
                         prinfo "$cfg: ignoring incorrect" \
                             "external option: \"$k $v\""
                         continue
                     fi
 
-                    if [[ '*' = "$kverpat" || \
-                        "$kernel" =~ $kverpat ]]; then
+                    if [[ '*' == "$kverpat" || \
+                        $kernel =~ $kverpat ]]; then
                         external_dirs+=("$path")
 
                         prdebug "$cfg: added external" \
index a180a9bd4ec00fc02d6d38e869fe60d25ddf6343..ed52798c1bca095033cf41c438a66f02517ece43 100755 (executable)
@@ -67,7 +67,7 @@ installkernel() {
             virtio virtio_ring virtio_pci pci_hyperv \
             "=drivers/pcmcia"
 
-        if [[ "${DRACUT_ARCH:-$(uname -m)}" == arm* || "${DRACUT_ARCH:-$(uname -m)}" == aarch64 ]]; then
+        if [[ ${DRACUT_ARCH:-$(uname -m)} == arm* || ${DRACUT_ARCH:-$(uname -m)} == aarch64 ]]; then
             # arm/aarch64 specific modules
             _blockfuncs+='|dw_mc_probe|dw_mci_pltfm_register'
             instmods \
@@ -108,7 +108,7 @@ installkernel() {
             || for_each_host_dev_and_slaves_all record_block_dev_drv; then
             hostonly='' instmods sg sr_mod sd_mod scsi_dh ata_piix
 
-            if [[ "$hostonly_mode" == "strict" ]]; then
+            if [[ $hostonly_mode == "strict" ]]; then
                 install_block_modules_strict
             else
                 install_block_modules
index cd3b0a5801651ab4fdef653b302c3bdde235d1fb..a43bb795095a7d2af7221bcbf9827f0ae961475b 100755 (executable)
@@ -18,7 +18,7 @@ installkernel() {
     local _unwanted_drivers='/(wireless|isdn|uwb|net/ethernet|net/phy|net/team)/'
     local _net_drivers
 
-    if [[ "$_arch" = "s390" ]] || [[ "$_arch" = "s390x" ]]; then
+    if [[ $_arch == "s390" ]] || [[ $_arch == "s390x" ]]; then
         dracut_instmods -o -P ".*${_unwanted_drivers}.*" -s "$_net_symbols" "=drivers/s390/net"
     fi
 
index 2b25720984b1827cdb01d39364722aa7b45f6bcf..7c53352b6d7afd3fb8f5dba464c5353dc69c57c0 100755 (executable)
@@ -7,7 +7,7 @@ check() {
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
         for fs in "${host_fs_types[@]}"; do
-            [[ $fs = LVM*_member ]] && return 0
+            [[ $fs == LVM*_member ]] && return 0
         done
         return 255
     }
@@ -31,11 +31,11 @@ cmdline() {
         [ -e /sys/block/${dev#/dev/}/dm/name ] || continue
         [ -e /sys/block/${dev#/dev/}/dm/uuid ] || continue
         uuid=$(< /sys/block/${dev#/dev/}/dm/uuid)
-        [[ "${uuid#LVM-}" == "$uuid" ]] && continue
+        [[ ${uuid#LVM-} == "$uuid" ]] && continue
         dev=$(< /sys/block/${dev#/dev/}/dm/name)
         eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2> /dev/null)
         [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1
-        if ! [[ ${_activated[${DM_VG_NAME} / ${DM_LV_NAME}]} ]]; then
+        if ! [[ ${_activated[DM_VG_NAME / DM_LV_NAME]} ]]; then
             printf " rd.lvm.lv=%s " "${DM_VG_NAME}/${DM_LV_NAME} "
             _activated["${DM_VG_NAME}/${DM_LV_NAME}"]=1
         fi
@@ -59,7 +59,7 @@ install() {
 
     inst_rules "$moddir/64-lvm.rules"
 
-    if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then
+    if [[ $hostonly ]] || [[ $lvmconf == "yes" ]]; then
         if [[ -f $dracutsysrootdir/etc/lvm/lvm.conf ]]; then
             inst_simple -H /etc/lvm/lvm.conf
             # FIXME: near-term hack to establish read-only locking;
index e72be7999f425a2f6f77297da1681c6d1499de0a..3b87ad6d274f5327a08e85ed15f22211c1571bb6 100755 (executable)
@@ -8,7 +8,7 @@ _do_md_shutdown() {
     ret=$?
     info "Disassembling mdraid devices."
     mdadm -vv --stop --scan | vinfo
-    ret=$(($ret + $?))
+    ret=$((ret + $?))
     if [ "x$final" != "x" ]; then
         info "/proc/mdstat:"
         vinfo < /proc/mdstat
index dc0d96ce1555789fd49c3513d88a0e5e98ed0e72..cb8dd7e009ddfc4f35f3353ca3a0d1d507f7cb62 100755 (executable)
@@ -8,12 +8,12 @@ check() {
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
         for dev in "${!host_fs_types[@]}"; do
-            [[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue
+            [[ ${host_fs_types[$dev]} != *_raid_member ]] && continue
 
             DEVPATH=$(get_devpath_block "$dev")
 
             for holder in "$DEVPATH"/holders/*; do
-                [[ -e "$holder" ]] || continue
+                [[ -e $holder ]] || continue
                 [[ -e "$holder/md" ]] && return 0
                 break
             done
@@ -42,17 +42,17 @@ cmdline() {
     declare -A _activated
 
     for dev in "${!host_fs_types[@]}"; do
-        [[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue
+        [[ ${host_fs_types[$dev]} != *_raid_member ]] && continue
 
         UUID=$(
             /sbin/mdadm --examine --export $dev \
                 | while read line || [ -n "$line" ]; do
-                    [[ ${line#MD_UUID=} = $line ]] && continue
+                    [[ ${line#MD_UUID=} == $line ]] && continue
                     printf "%s" "${line#MD_UUID=} "
                 done
         )
 
-        [[ -z "$UUID" ]] && continue
+        [[ -z $UUID ]] && continue
 
         if ! [[ ${_activated[${UUID}]} ]]; then
             printf "%s" " rd.md.uuid=${UUID}"
@@ -103,7 +103,7 @@ install() {
         inst_hook pre-trigger 30 "$moddir/md-noddf.sh"
     fi
 
-    if [[ $hostonly ]] || [[ $mdadmconf = "yes" ]]; then
+    if [[ $hostonly ]] || [[ $mdadmconf == "yes" ]]; then
         if [[ -f $dracutsysrootdir/etc/mdadm.conf ]]; then
             inst -H /etc/mdadm.conf
         else
index 6054f134d40304311192272447c086be84c14e9b..554583e2a4f8cbe321f4ec51b3197c135199c467 100755 (executable)
@@ -94,7 +94,7 @@ install() {
         /etc/multipath/* \
         /etc/multipath/conf.d/*
 
-    [[ $hostonly ]] && [[ $hostonly_mode = "strict" ]] && {
+    [[ $hostonly ]] && [[ $hostonly_mode == "strict" ]] && {
         for_each_host_dev_and_slaves_all add_hostonly_mpath_conf
         [ -n "$_allow" ] && mpathconf $_allow --outfile ${initdir}/etc/multipath.conf
     }
index b24cacc6c12d9495d23040a15f1876968d440529..3a449fdb38bb95e447d63f2aa7fad7cfdad2318e 100755 (executable)
@@ -5,7 +5,7 @@ check() {
     if [[ ! $hostonly ]]; then
         return 0
     fi
-    [[ $DRACUT_KERNEL_MODALIASES && -f "$DRACUT_KERNEL_MODALIASES" ]] \
+    [[ $DRACUT_KERNEL_MODALIASES && -f $DRACUT_KERNEL_MODALIASES ]] \
         && grep -q libnvdimm "$DRACUT_KERNEL_MODALIASES" && return 0
     return 255
 }
index ff15b4cb20b3d20a82d218a05f87785898326f85..0e1556b3eb59c309ff28583d5782cfdba0d66719 100644 (file)
@@ -19,7 +19,7 @@
 check() {
     local _arch=${DRACUT_ARCH:-$(uname -m)}
     # only for PowerPC Macs
-    [[ "$_arch" == ppc* && "$_arch" != ppc64le ]] || return 1
+    [[ $_arch == ppc* && $_arch != ppc64le ]] || return 1
     return 0
 }
 
@@ -36,7 +36,7 @@ installkernel() {
     }
 
     # only PowerMac3,6 has a module, special case
-    if [[ "${DRACUT_ARCH:-$(uname -m)}" != ppc64* ]]; then
+    if [[ ${DRACUT_ARCH:-$(uname -m)} != ppc64* ]]; then
         if ! [[ $hostonly ]] || [[ "$(pmac_model)" == "PowerMac3,6" ]]; then
             instmods therm_windtunnel
         fi
index 78628c394158fc24a9286ba6edf18bbbc97a335d..c2f91c276dd4521a5839d0a155f16e0f72c3d719 100755 (executable)
@@ -42,7 +42,7 @@ sc_public_key() {
 sc_supported() {
     local gpgMajor="$(gpg --version | sed -n 1p | sed -n -r -e 's|.* ([0-9]*).*|\1|p')"
     local gpgMinor="$(gpg --version | sed -n 1p | sed -n -r -e 's|.* [0-9]*\.([0-9]*).*|\1|p')"
-    if [[ "${gpgMajor}" -gt 2 || "${gpgMajor}" -eq 2 && "${gpgMinor}" -ge 1 ]] \
+    if [[ ${gpgMajor} -gt 2 || ${gpgMajor} -eq 2 && ${gpgMinor} -ge 1 ]] \
         && require_binaries gpg-agent \
         && require_binaries gpg-connect-agent \
         && require_binaries /usr/libexec/scdaemon \
index 41273a5f01ecfce270bd39140325739bc0e2093d..4d0f8c57e0dd414982c407120f1f402343b64fd7 100755 (executable)
@@ -7,7 +7,7 @@ check() {
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
         for fs in "${host_fs_types[@]}"; do
-            [[ "$fs" == "cifs" ]] && return 0
+            [[ $fs == "cifs" ]] && return 0
         done
         return 255
     }
index d599b88d4a36bc7396603ea73e1e048af49c39b0..3c43902a04ab8b50d0c6d5bdaf825bb240c7eb7d 100755 (executable)
@@ -31,7 +31,7 @@ check() {
         for bdev in /sys/block/*; do
             case "${bdev##*/}" in
                 dasd*)
-                    found=$(($found + 1))
+                    found=$((found + 1))
                     break
                     ;;
             esac
index 1d89942530776a86f3d7e97f86408c46021f14f3..bd7384c297f26e476ae7a788b6cd3224d77f1494 100755 (executable)
@@ -43,7 +43,7 @@ EOF
 }
 
 if [[ -f /sys/firmware/ipl/ipl_type && \
-    $(< /sys/firmware/ipl/ipl_type) = "ccw" ]]; then
+    $(< /sys/firmware/ipl/ipl_type) == "ccw" ]]; then
     (
         _ccw=$(cat /sys/firmware/ipl/device)
 
index ffbb57ce502404e93bcff0e26e46b76cfd85ecf5..67af4ad58b16644b05a79bbb866351e0291a2ebe 100755 (executable)
@@ -5,7 +5,7 @@
 # called by dracut
 check() {
     local _arch=${DRACUT_ARCH:-$(uname -m)}
-    [[ "$_arch" = "s390" ]] || [[ "$_arch" = "s390x" ]] || return 1
+    [[ $_arch == "s390" ]] || [[ $_arch == "s390x" ]] || return 1
     return 0
 }
 
index 1ede0a058b07b81506dc3713c55e25656c557627..dd28724c784513b161bf0984e6e823e63ea97d35 100755 (executable)
@@ -14,7 +14,7 @@ check_edd() {
 
     while [ $cnt -lt 600 ]; do
         [ -d /sys/firmware/edd ] && return 0
-        cnt=$(($cnt + 1))
+        cnt=$((cnt + 1))
         sleep 0.1
     done
     return 1
index 4b78cd2ef69fa0dcb3dd5ebddafb5271a475537c..17799e5046b06428fd2c2ac6d340a56a2db7b8db 100755 (executable)
@@ -74,28 +74,28 @@ if [ "$dcb" = "dcb" ]; then
         lldptool -p && break
         info "Waiting for lldpad to be ready"
         sleep 1
-        i=$(($i + 1))
+        i=$((i + 1))
     done
 
     while [ $i -lt 60 ]; do
         dcbtool sc "$netif" dcb on && break
         info "Retrying to turn dcb on"
         sleep 1
-        i=$(($i + 1))
+        i=$((i + 1))
     done
 
     while [ $i -lt 60 ]; do
         dcbtool sc "$netif" pfc e:1 a:1 w:1 && break
         info "Retrying to turn dcb on"
         sleep 1
-        i=$(($i + 1))
+        i=$((i + 1))
     done
 
     while [ $i -lt 60 ]; do
         dcbtool sc "$netif" app:fcoe e:1 a:1 w:1 && break
         info "Retrying to turn fcoe on"
         sleep 1
-        i=$(($i + 1))
+        i=$((i + 1))
     done
 
     sleep 1
index 0b8d01d05179892545855ec814bbfba9892f21bf..d49630d5bd4d4271e4163156640a3086b9f10b16 100755 (executable)
@@ -15,5 +15,5 @@ while [ $i -lt 60 ]; do
     lldptool -p && break
     info "Waiting for lldpad to be ready"
     sleep 1
-    i=$(($i + 1))
+    i=$((i + 1))
 done
index b52e8fcc6301f77b2e243d4f4b3232beb0991db0..c7fb32c22ad6550b5d909e736bdc5adf6c369eee 100755 (executable)
@@ -78,10 +78,10 @@ cmdline() {
             # DCB_REQUIRED in "/etc/fcoe/cfg-xxx" is expected to set to "no".
             #
             # Force "nodcb" if there's any DCB_REQUIRED="no"(child or vlan parent).
-            grep -q "^[[:blank:]]*DCB_REQUIRED=\"no\"" /etc/fcoe/cfg-${i##*/} &> /dev/null
+            grep -q '^[[:blank:]]*DCB_REQUIRED="no"' /etc/fcoe/cfg-${i##*/} &> /dev/null
             [ $? -eq 0 ] && dcb="nodcb"
             if [ "$p" ]; then
-                grep -q "^[[:blank:]]*DCB_REQUIRED=\"no\"" /etc/fcoe/cfg-${p} &> /dev/null
+                grep -q '^[[:blank:]]*DCB_REQUIRED="no"' /etc/fcoe/cfg-${p} &> /dev/null
                 [ $? -eq 0 ] && dcb="nodcb"
             fi
 
index a3ca812b540f4f3d53068081fbfbeddbc8ed352a..4d39d4a98afbd21b54f09d5a78dde4e457a7bb5a 100755 (executable)
@@ -290,7 +290,7 @@ if ! [ "$netif" = "online" ]; then
             nroot="${nroot##iscsi:}"
             if [ -n "$nroot" ]; then
                 handle_netroot "$nroot"
-                ret=$(($ret + $?))
+                ret=$((ret + $?))
             fi
         done
     else
index fe22a3a94aa582cf9b684f0a644a78e3d25f8c57..2e1d903d3f64a78345b98a4a1d3a6dc115e16081 100755 (executable)
@@ -94,7 +94,7 @@ while [ ! -b /dev/nbd0 ]; do
     else
         sleep 0.1
     fi
-    i=$(($i + 1))
+    i=$((i + 1))
 done
 
 # If we didn't get a root= on the command line, then we need to
index 9e1d5fa298a6f0f43d59f8a6d8ea9916631270ba..bc8bee6d2189f66e31e09f63edaf9c66bafab33e 100755 (executable)
@@ -8,9 +8,9 @@ get_nfs_type() {
     local _nfs _nfs4
 
     for fs in "${host_fs_types[@]}"; do
-        [[ "$fs" == "nfs" ]] && _nfs=1
-        [[ "$fs" == "nfs3" ]] && _nfs=1
-        [[ "$fs" == "nfs4" ]] && _nfs4=1
+        [[ $fs == "nfs" ]] && _nfs=1
+        [[ $fs == "nfs3" ]] && _nfs=1
+        [[ $fs == "nfs4" ]] && _nfs4=1
     done
 
     [[ "$_nfs" ]] && echo "nfs" && return
index 8285fa0c882f30a6bf51eeb83bbcf1853e10e0e9..1d06b7c1858e879d260466fe64eafe5e630d4dae 100755 (executable)
@@ -22,7 +22,7 @@ check() {
                 break
             fi
         done
-        [[ "$trtype" == "fc" ]] || [[ "$trtype" == "tcp" ]] || [[ "$trtype" == "rdma" ]]
+        [[ $trtype == "fc" ]] || [[ $trtype == "tcp" ]] || [[ $trtype == "rdma" ]]
     }
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
index c3982207d950a3ce0eec2d544d7efd589da8339b..20148d152c3e25363d786d8d54de54bdfb7dd93d 100755 (executable)
@@ -13,11 +13,11 @@ depends() {
 cmdline_journal() {
     if [[ $hostonly ]]; then
         for dev in "${!host_fs_types[@]}"; do
-            [[ ${host_fs_types[$dev]} = "reiserfs" ]] || [[ ${host_fs_types[$dev]} = "xfs" ]] || continue
+            [[ ${host_fs_types[$dev]} == "reiserfs" ]] || [[ ${host_fs_types[$dev]} == "xfs" ]] || continue
             rootopts=$(find_dev_fsopts "$dev")
-            if [[ ${host_fs_types[$dev]} = "reiserfs" ]]; then
+            if [[ ${host_fs_types[$dev]} == "reiserfs" ]]; then
                 journaldev=$(fs_get_option $rootopts "jdev")
-            elif [[ ${host_fs_types[$dev]} = "xfs" ]]; then
+            elif [[ ${host_fs_types[$dev]} == "xfs" ]]; then
                 journaldev=$(fs_get_option $rootopts "logdev")
             fi
 
@@ -47,7 +47,7 @@ cmdline_rootfs() {
     if [ -n "$_fstype" ]; then
         printf " rootfstype=%s" "$_fstype"
     fi
-    if [[ $use_fstab != yes ]] && [[ $_fstype = btrfs ]]; then
+    if [[ $use_fstab != yes ]] && [[ $_fstype == btrfs ]]; then
         _subvol=$(findmnt -e -v -n -o FSROOT --target /) \
             && _subvol=${_subvol#/}
         _flags="$_flags${_subvol:+,subvol=$_subvol}"
index 935483ebe5dbf8bb9f0e38389392edc1fa4ffd76..80260029b5ae964d91158aa9140d9107f80a7221 100755 (executable)
@@ -4,7 +4,7 @@
 check() {
     [[ $hostonly ]] || [[ $mount_needs ]] && {
         for fs in "${host_fs_types[@]}"; do
-            [[ "$fs" == "9p" ]] && return 0
+            [[ $fs == "9p" ]] && return 0
         done
         return 255
     }
index 9c5450aba64be25f4e76c44b0e94e91cc7f3780a..cf8cf055265a8a04a20e916a2d9142bf5e44a498 100755 (executable)
@@ -50,7 +50,7 @@ check() {
         found=0
         for _ccw in /sys/bus/ccw/devices/*/host*; do
             [ -d "$_ccw" ] || continue
-            found=$(($found + 1))
+            found=$((found + 1))
         done
         [ $found -eq 0 ] && return 255
     }
index 66e9132e02abc193d1abe2aa5d7826db6d1e4e83..7ea49c840a1fcf456f92873d116e7fb89c19258a 100755 (executable)
@@ -42,7 +42,7 @@ EOF
 }
 
 if [[ -f /sys/firmware/ipl/ipl_type && \
-    $(< /sys/firmware/ipl/ipl_type) = "fcp" ]]; then
+    $(< /sys/firmware/ipl/ipl_type) == "fcp" ]]; then
     (
         _wwpn=$(cat /sys/firmware/ipl/wwpn)
         _lun=$(cat /sys/firmware/ipl/lun)
index e20901b62921aa291573628a8d08b56a7a685c8e..df3edf5e33616d6a8d96cb24c00d708eb3468a32 100755 (executable)
@@ -13,7 +13,7 @@ getarg 'rd.break=initqueue' -d 'rdbreak=initqueue' && emergency_shell -n initque
 
 RDRETRY=$(getarg rd.retry -d 'rd_retry=')
 RDRETRY=${RDRETRY:-180}
-RDRETRY=$(($RDRETRY * 2))
+RDRETRY=$((RDRETRY * 2))
 export RDRETRY
 
 main_loop=0
@@ -54,7 +54,7 @@ while :; do
         [ -e "$i" ] && continue 2
     done
 
-    if [ $main_loop -gt $((2 * $RDRETRY / 3)) ]; then
+    if [ $main_loop -gt $((2 * RDRETRY / 3)) ]; then
         warn "dracut-initqueue: timeout, still waiting for following initqueue hooks:"
         for _f in $hookdir/initqueue/finished/*.sh; do
             warn "$_f: \"$(cat "$_f")\""
@@ -71,7 +71,7 @@ while :; do
         fi
     fi
 
-    main_loop=$(($main_loop + 1))
+    main_loop=$((main_loop + 1))
     if [ $main_loop -gt $RDRETRY ]; then
         if ! [ -f /sysroot/etc/fstab ] || ! [ -e /sysroot/sbin/init ]; then
             emergency_shell "Could not boot."
index cd76a1fa25a2a4dd7b361931a772d138d8dde35a..004fe24d86a740501a9818f401511886728dae80 100755 (executable)
@@ -28,7 +28,7 @@ while :; do
         fi
     done
 
-    i=$(($i + 1))
+    i=$((i + 1))
     [ $i -gt 20 ] && emergency_shell "Can't mount root filesystem"
 done
 
index 7999c81f9e208e993654ab6dfbf65471ece2cbb2..1afdd36277523386c08c6df6a8e47c5a47142898 100755 (executable)
@@ -270,7 +270,7 @@ getargnum() {
     _b=$(getarg "$1")
     [ $? -ne 0 -a -z "$_b" ] && _b=$_default
     if [ -n "$_b" ]; then
-        isdigit "$_b" && _b=$(($_b)) \
+        isdigit "$_b" && _b=$((_b)) \
             && [ $_b -ge $_min ] && [ $_b -le $_max ] && echo $_b && return
     fi
     echo $_default
@@ -471,7 +471,7 @@ check_occurances() {
 
     while [ "${str#*$ch}" != "${str}" ]; do
         str="${str#*$ch}"
-        count=$(($count + 1))
+        count=$((count + 1))
     done
 
     [ $count -eq $expected ]
@@ -609,7 +609,7 @@ funiq() {
     [ -d "${dir}" ] || return 1
 
     while [ -e "${dir}/${prefix}$i" ]; do
-        i=$(($i + 1)) || return 1
+        i=$((i + 1)) || return 1
     done
 
     echo "${dir}/${prefix}$i"
@@ -998,7 +998,7 @@ wait_for_loginit() {
             [ -z "${j##*Running*}" ] || break
         fi
         sleep 0.1
-        i=$(($i + 1))
+        i=$((i + 1))
     done
 
     if [ $i -eq 10 ]; then
index 3f38d45258c5be4d826285c836a4adf4bf42fe39..ab667710a328a81fba836b702d991fa67e27ddde 100755 (executable)
@@ -174,7 +174,7 @@ getarg 'rd.break=initqueue' -d 'rdbreak=initqueue' && emergency_shell -n initque
 
 RDRETRY=$(getarg rd.retry -d 'rd_retry=')
 RDRETRY=${RDRETRY:-180}
-RDRETRY=$(($RDRETRY * 2))
+RDRETRY=$((RDRETRY * 2))
 export RDRETRY
 main_loop=0
 export main_loop
@@ -209,7 +209,7 @@ while :; do
     # no more udev jobs and queues empty.
     sleep 0.5
 
-    if [ $main_loop -gt $((2 * $RDRETRY / 3)) ]; then
+    if [ $main_loop -gt $((2 * RDRETRY / 3)) ]; then
         for job in $hookdir/initqueue/timeout/*.sh; do
             [ -e "$job" ] || break
             job=$job . $job
@@ -218,7 +218,7 @@ while :; do
         done
     fi
 
-    main_loop=$(($main_loop + 1))
+    main_loop=$((main_loop + 1))
     [ $main_loop -gt $RDRETRY ] \
         && {
             flock -s 9
@@ -255,7 +255,7 @@ while :; do
         fi
     done
 
-    _i_mount=$(($_i_mount + 1))
+    _i_mount=$((_i_mount + 1))
     [ $_i_mount -gt 20 ] \
         && {
             flock -s 9
index 8f02b2e535de6b73999778068397661af012161c..2f81c85cbd365eff22ede13d2cbe4f568ba5b531 100755 (executable)
@@ -65,7 +65,7 @@ install() {
     fi
 
     ln -fs /proc/self/mounts "$initdir/etc/mtab"
-    if [[ $ro_mnt = yes ]]; then
+    if [[ $ro_mnt == yes ]]; then
         echo ro >> "${initdir}/etc/cmdline.d/base.conf"
     fi
 
@@ -106,7 +106,7 @@ install() {
 
     ## save host_devs which we need bring up
     if [[ $hostonly_cmdline == "yes" ]]; then
-        if [[ -n "${host_devs[*]}" ]]; then
+        if [[ -n ${host_devs[*]} ]]; then
             dracut_need_initqueue
         fi
         if [[ -f $initdir/lib/dracut/need-initqueue ]] || ! dracut_module_included "systemd"; then
@@ -120,14 +120,14 @@ install() {
 
                 for _dev in "${host_devs[@]}"; do
                     for _dev2 in "${root_devs[@]}"; do
-                        [[ "$_dev" == "$_dev2" ]] && continue 2
+                        [[ $_dev == "$_dev2" ]] && continue 2
                     done
 
                     # We only actually wait for real devs - swap is only needed
                     # for resume and udev rules generated when parsing resume=
                     # argument take care of the waiting for us
                     for _dev2 in "${swap_devs[@]}"; do
-                        [[ "$_dev" == "$_dev2" ]] && continue 2
+                        [[ $_dev == "$_dev2" ]] && continue 2
                     done
 
                     _pdev=$(get_persistent_dev $_dev)
index 7448c2bded768d07ba1c34d8a3b9a1faa21e5778..d7d659b98e5102862b2a42c217637103828435c5 100755 (executable)
@@ -64,9 +64,9 @@ install() {
     inst "$moddir/fs-lib.sh" "/lib/fs-lib.sh"
     > ${initdir}/etc/fstab.empty
 
-    [[ "$nofscks" = "yes" ]] && return
+    [[ $nofscks == "yes" ]] && return
 
-    if [[ "$fscks" = "${fscks#*[^ ]*}" ]]; then
+    if [[ $fscks == "${fscks#*[^ ]*}" ]]; then
         _helpers="\
             umount mount /sbin/fsck* /usr/sbin/fsck*
             xfs_db xfs_check xfs_repair xfs_metadump
@@ -80,7 +80,7 @@ install() {
         _helpers="$fscks"
     fi
 
-    if [[ "$_helpers" == *e2fsck* ]] && [[ -e $dracutsysrootdir/etc/e2fsck.conf ]]; then
+    if [[ $_helpers == *e2fsck* ]] && [[ -e $dracutsysrootdir/etc/e2fsck.conf ]]; then
         inst_simple /etc/e2fsck.conf
     fi
 
index cda291c9cb30c4f88910d569abcc6f4ff3fd7f03..ac23de51b2d52edd04c7a66feda1a52df5f33e0e 100755 (executable)
@@ -96,7 +96,7 @@ umount_a() {
 _cnt=0
 while [ $_cnt -le 40 ]; do
     umount_a || break
-    _cnt=$(($_cnt + 1))
+    _cnt=$((_cnt + 1))
 done
 
 [ $_cnt -ge 40 ] && umount_a -v
@@ -142,7 +142,7 @@ _check_shutdown() {
 _cnt=0
 while [ $_cnt -le 40 ]; do
     _check_shutdown && break
-    _cnt=$(($_cnt + 1))
+    _cnt=$((_cnt + 1))
 done
 [ $_cnt -ge 40 ] && _check_shutdown final
 
index 5fde9af77fdb028738e7ac7e8d7524576ccf24c6..775200273ce2ff01db275094e122f9f26039b5e6 100644 (file)
@@ -25,7 +25,7 @@ installpost() {
     # Move everything under $initdir except $squash_dir
     # itself into squash image
     for i in "$initdir"/*; do
-        [[ "$squash_dir" == "$i"/* ]] || mv "$i" "$squash_dir"/
+        [[ $squash_dir == "$i"/* ]] || mv "$i" "$squash_dir"/
     done
 
     # Create mount points for squash loader
index 171a982111a63b32e8ff70cbd10d20d30ca5eb14..bdc87db3e882225f0afa9bbeb102016d211aa564 100755 (executable)
@@ -61,7 +61,7 @@ uefi_device_path() {
                 0101)
                     # PCI
                     tt=$(getword)
-                    printf "PCI(0x%x,0x%x)" $(($tt / 256)) $(($tt & 255))
+                    printf "PCI(0x%x,0x%x)" $((tt / 256)) $((tt & 255))
                     ;;
                 0201)
                     # ACPI
index c5ddb7362d62fab5fc990672e6a5600fe124e4d9..93555cdacfd45290ad6ae4314376f12fc852d145 100755 (executable)
@@ -20,7 +20,7 @@ wait_for_if_link() {
             [ -n "$li" ] && return 0
         fi
         sleep 0.1
-        cnt=$(($cnt + 1))
+        cnt=$((cnt + 1))
     done
     return 1
 }
@@ -32,7 +32,7 @@ wait_for_if_up() {
         li=$(ip -o link show up dev $1)
         [ -n "$li" ] && return 0
         sleep 0.1
-        cnt=$(($cnt + 1))
+        cnt=$((cnt + 1))
     done
     return 1
 }
@@ -43,7 +43,7 @@ wait_for_route_ok() {
         li=$(ip route show)
         [ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
         sleep 0.1
-        cnt=$(($cnt + 1))
+        cnt=$((cnt + 1))
     done
     return 1
 }
index be299e953fa70652e9a7ab1894c27afc18308616..2f6206eaf2d418736737a06fa9f11485301c07ae 100755 (executable)
@@ -82,7 +82,7 @@ client_test() {
     # nfsinfo=( server:/path nfs{,4} options )
     nfsinfo=($(awk '{print $2, $3, $4; exit}' $TESTDIR/client.img))
 
-    if [[ "${nfsinfo[0]%%:*}" != "$server" ]]; then
+    if [[ ${nfsinfo[0]%%:*} != "$server" ]]; then
         echo "CLIENT TEST INFO: got server: ${nfsinfo[0]%%:*}"
         echo "CLIENT TEST INFO: expected server: $server"
         echo "CLIENT TEST END: $test_name [FAILED - WRONG SERVER]"
@@ -91,14 +91,14 @@ client_test() {
 
     found=0
     expected=1
-    if [[ ${check_opt:0:1} = '-' ]]; then
+    if [[ ${check_opt:0:1} == '-' ]]; then
         expected=0
         check_opt=${check_opt:1}
     fi
 
     opts=${nfsinfo[2]},
     while [[ $opts ]]; do
-        if [[ ${opts%%,*} = $check_opt ]]; then
+        if [[ ${opts%%,*} == $check_opt ]]; then
             found=1
             break
         fi
index 163e484267c619a8beeb9753a4dbab94fc08d8b5..f633be781249867d9f540329d4ef662fb1c10aad 100755 (executable)
@@ -19,7 +19,7 @@ wait_for_if_link() {
             [ -n "$li" ] && return 0
         fi
         sleep 0.1
-        cnt=$(($cnt + 1))
+        cnt=$((cnt + 1))
     done
     return 1
 }
index 49ec07ee47a84749343ca0dc4737cefd3b18e315..1e0c3ff86b2d75c4626f00b8c079ef08fe9781ed 100755 (executable)
@@ -19,7 +19,7 @@ wait_for_if_link() {
             [ -n "$li" ] && return 0
         fi
         sleep 0.1
-        cnt=$(($cnt + 1))
+        cnt=$((cnt + 1))
     done
     return 1
 }
@@ -31,7 +31,7 @@ wait_for_if_up() {
         li=$(ip -o link show up dev $1)
         [ -n "$li" ] && return 0
         sleep 0.1
-        cnt=$(($cnt + 1))
+        cnt=$((cnt + 1))
     done
     return 1
 }
@@ -42,7 +42,7 @@ wait_for_route_ok() {
         li=$(ip route show)
         [ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
         sleep 0.1
-        cnt=$(($cnt + 1))
+        cnt=$((cnt + 1))
     done
     return 1
 }
index 6c7462d317594ce0d0a9108225f8f9d8fee14f89..eb7e9942d05399bc9a6eaa93c8b8c7a756873b99 100755 (executable)
@@ -19,7 +19,7 @@ wait_for_if_link() {
             [ -n "$li" ] && return 0
         fi
         sleep 0.1
-        cnt=$(($cnt + 1))
+        cnt=$((cnt + 1))
     done
     return 1
 }
@@ -31,7 +31,7 @@ wait_for_if_up() {
         li=$(ip -o link show up dev $1)
         [ -n "$li" ] && return 0
         sleep 0.1
-        cnt=$(($cnt + 1))
+        cnt=$((cnt + 1))
     done
     return 1
 }
@@ -42,7 +42,7 @@ wait_for_route_ok() {
         li=$(ip route show)
         [ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
         sleep 0.1
-        cnt=$(($cnt + 1))
+        cnt=$((cnt + 1))
     done
     return 1
 }
index 02a5d70a672908acdffc999f5f1f966c37738a40..b9abd2d01645c7f08921d14139d3a8afe209ae6f 100755 (executable)
@@ -91,14 +91,14 @@ client_test() {
     # nbdinfo=( fstype fsoptions )
     nbdinfo=($(awk '{print $2, $3; exit}' $TESTDIR/flag.img))
 
-    if [[ "${nbdinfo[0]}" != "$fstype" ]]; then
+    if [[ ${nbdinfo[0]} != "$fstype" ]]; then
         echo "CLIENT TEST END: $test_name [FAILED - WRONG FS TYPE] \"${nbdinfo[0]}\" != \"$fstype\""
         return 1
     fi
 
     opts=${nbdinfo[1]},
     while [[ $opts ]]; do
-        if [[ ${opts%%,*} = $fsopt ]]; then
+        if [[ ${opts%%,*} == $fsopt ]]; then
             found=1
             break
         fi
index 4f550084bd5603bc9ba3c92fb943545712807a8a..816eb86103932427f0ab97ab64f622b19a997411 100755 (executable)
@@ -20,7 +20,7 @@ wait_for_if_link() {
             [ -n "$li" ] && return 0
         fi
         sleep 0.1
-        cnt=$(($cnt + 1))
+        cnt=$((cnt + 1))
     done
     return 1
 }
@@ -32,7 +32,7 @@ wait_for_if_up() {
         li=$(ip -o link show up dev $1)
         [ -n "$li" ] && return 0
         sleep 0.1
-        cnt=$(($cnt + 1))
+        cnt=$((cnt + 1))
     done
     return 1
 }
@@ -43,7 +43,7 @@ wait_for_route_ok() {
         li=$(ip route show)
         [ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
         sleep 0.1
-        cnt=$(($cnt + 1))
+        cnt=$((cnt + 1))
     done
     return 1
 }
index 21fbcaf41309c1aec30928534beb5fe548026313..98f187f322d1fbf97c48d24e9937519eee9e619a 100755 (executable)
@@ -83,7 +83,7 @@ client_test() {
         read IFACES
     } < "$TESTDIR"/client.img
 
-    if [[ "$OK" != "OK" ]]; then
+    if [[ $OK != "OK" ]]; then
         echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
         return 1
     fi
index 9a18db188a124401c7c9980b8f315b81c2ca83c0..9028dc9364daf968ce17da9ec583ee58e8f68df8 100755 (executable)
@@ -22,7 +22,7 @@ wait_for_if_link() {
             [ -n "$li" ] && return 0
         fi
         sleep 0.1
-        cnt=$(($cnt + 1))
+        cnt=$((cnt + 1))
     done
     return 1
 }
@@ -34,7 +34,7 @@ wait_for_if_up() {
         li=$(ip -o link show up dev $1)
         [ -n "$li" ] && return 0
         sleep 0.1
-        cnt=$(($cnt + 1))
+        cnt=$((cnt + 1))
     done
     return 1
 }
@@ -45,7 +45,7 @@ wait_for_route_ok() {
         li=$(ip route show)
         [ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
         sleep 0.1
-        cnt=$(($cnt + 1))
+        cnt=$((cnt + 1))
     done
     return 1
 }
index e4090c581bdc0296ec61e58f25d3951008e5fca6..eb9e79e4c602c7656bdf71ae8d5db1731cb67bc2 100755 (executable)
@@ -96,7 +96,7 @@ client_test() {
 
     {
         read OK
-        if [[ "$OK" != "OK" ]]; then
+        if [[ $OK != "OK" ]]; then
             echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
             return 1
         fi
@@ -107,7 +107,7 @@ client_test() {
         done
     } < "$TESTDIR"/client.img || return 1
 
-    if [[ "$check" != "$CONF" ]]; then
+    if [[ $check != "$CONF" ]]; then
         echo "Expected: '$check'"
         echo
         echo
index 64ff9cdfb5c6871109205b6b418e66e9cf71342d..e47b93bbca634d71335e83b35f2d1e4149fad4a7 100755 (executable)
@@ -21,8 +21,8 @@ test_run() {
     set -x
     (
         cd "$TESTDIR"
-        export CMDLINE="key1=0 key2=val key2=val2 key3=\"  val  3  \" \"  key 4  =\"val4 \"key  5=val  5\" \"key 6=\"\"val  6\" key7=\"foo\"bar\" baz=\"end \"  key8  =  val 8  \"
-\"key 9\"=\"val 9\""
+        export CMDLINE='key1=0 key2=val key2=val2 key3="  val  3  " "  key 4  ="val4 "key  5=val  5" "key 6=""val  6" key7="foo"bar" baz="end "  key8  =  val 8  "
+"key 9"="val 9"'
 
         ret=0
 
@@ -33,10 +33,10 @@ test_run() {
             ["key3"]="  val  3  "
             ["  key 4  "]="val4"
             ["key  5"]="val  5"
-            ["key 6"]="\"val  6"
-            ["key7"]="foo\"bar\" baz=\"end"
+            ["key 6"]='"val  6'
+            ["key7"]='foo"bar" baz="end'
             ["  key8  "]="  val 8  "
-            ["key 9\""]="val 9"
+            ['key 9"']="val 9"
         )
         for key in "${!TEST[@]}"; do
             if ! val=$(./dracut-getarg "${key}="); then
@@ -52,7 +52,7 @@ test_run() {
 
         declare -a INVALIDKEYS
 
-        INVALIDKEYS=("key" "4" "5" "6" "key8" "9" "\"" "baz")
+        INVALIDKEYS=("key" "4" "5" "6" "key8" "9" '"' "baz")
         for key in "${INVALIDKEYS[@]}"; do
             val=$(./dracut-getarg "$key")
             if (($? == 0)); then
index 387fb901df98725926f62a00aa7e84917c6f8bc2..7c215219bba7d9b94f41866a1345fca4bee618a0 100755 (executable)
@@ -20,7 +20,7 @@ $(lsmod | grep -q '^kqemu ') && BIN=/usr/bin/qemu && ARGS="-kernel-kqemu -cpu ho
 # Provide rng device sourcing the hosts /dev/urandom and other standard parameters
 ARGS="$ARGS -smp 2 -m 512 -nodefaults -vga none -display none -no-reboot -device virtio-rng-pci"
 
-if ! [[ $* = *-daemonize* ]] && ! [[ $* = *-daemonize* ]]; then
+if ! [[ $* == *-daemonize* ]] && ! [[ $* == *-daemonize* ]]; then
     ARGS="$ARGS -serial stdio"
 fi
 
index 3e3fdf8a73b290f3c7cafe47ec09ce792a887c27..53da5cc5b63bc5e1fc438d429b22b2c965d18739 100644 (file)
@@ -3,7 +3,7 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin
 export PATH
 
 [[ -e .testdir${TEST_RUN_ID:+-$TEST_RUN_ID} ]] && . .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
-if [[ -z "$TESTDIR" ]] || [[ ! -d "$TESTDIR" ]]; then
+if [[ -z $TESTDIR ]] || [[ ! -d $TESTDIR ]]; then
     TESTDIR=$(mktemp -d -p "/var/tmp" -t dracut-test.XXXXXX)
 fi
 echo "TESTDIR=\"$TESTDIR\"" > .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
@@ -28,7 +28,7 @@ COLOR_WARNING='\033[0;33m'
 COLOR_NORMAL='\033[0;39m'
 
 check_root() {
-    if (($EUID != 0)); then
+    if ((EUID != 0)); then
         SETCOLOR_FAILURE
         echo "Tests must be run as root! Please use 'sudo'."
         SETCOLOR_NORMAL
@@ -65,7 +65,7 @@ while (($# > 0)); do
             else
                 echo -e "TEST: $TEST_DESCRIPTION " $COLOR_SUCCESS "[STARTED]" $COLOR_NORMAL
             fi
-            if [[ "$V" == "1" ]]; then
+            if [[ $V == "1" ]]; then
                 set -o pipefail
                 (
                     test_setup && test_run
@@ -78,7 +78,7 @@ while (($# > 0)); do
                     rm -f -- .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
                     exit $ret
                 ) < /dev/null 2>&1 | tee test${TEST_RUN_ID:+-$TEST_RUN_ID}.log
-            elif [[ "$V" == "2" ]]; then
+            elif [[ $V == "2" ]]; then
                 set -o pipefail
                 (
                     test_setup && test_run