]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
style: shfmt reformat
authorHarald Hoyer <harald@redhat.com>
Thu, 25 Feb 2021 08:42:54 +0000 (09:42 +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 .
```

319 files changed:
configure
dracut-bash-completion.sh
dracut-catimages.sh
dracut-functions.sh
dracut-init.sh
dracut-initramfs-restore.sh
dracut-logger.sh
dracut.sh
examples/yocto/postinst-intercepts/execute_dracut
fedora-test-github.sh
fedora-test.sh
lsinitrd-bash-completion.sh
lsinitrd.sh
mkinitrd-dracut.sh
mkinitrd-suse.sh
modules.d/00bash/module-setup.sh
modules.d/00dash/module-setup.sh
modules.d/00mksh/module-setup.sh
modules.d/00systemd/module-setup.sh
modules.d/00warpclock/warpclock.sh
modules.d/01fips/fips-boot.sh
modules.d/01fips/fips-load-crypto.sh
modules.d/01fips/fips-noboot.sh
modules.d/01fips/fips.sh
modules.d/01systemd-ask-password/module-setup.sh
modules.d/01systemd-coredump/module-setup.sh
modules.d/01systemd-modules-load/module-setup.sh
modules.d/01systemd-sysusers/module-setup.sh
modules.d/02caps/caps.sh
modules.d/02caps/module-setup.sh
modules.d/02systemd-networkd/module-setup.sh
modules.d/03modsign/load-modsign-keys.sh
modules.d/03modsign/module-setup.sh
modules.d/03rescue/module-setup.sh
modules.d/04watchdog/module-setup.sh
modules.d/04watchdog/watchdog.sh
modules.d/05busybox/module-setup.sh
modules.d/06dbus-broker/module-setup.sh
modules.d/06dbus-daemon/module-setup.sh
modules.d/09dbus/module-setup.sh
modules.d/10i18n/console_init.sh
modules.d/10i18n/module-setup.sh
modules.d/10i18n/parse-i18n.sh
modules.d/30convertfs/convertfs.sh
modules.d/30convertfs/module-setup.sh
modules.d/35network-legacy/dhclient-script.sh
modules.d/35network-legacy/dhcp-multi.sh
modules.d/35network-legacy/ifup.sh
modules.d/35network-legacy/kill-dhclient.sh
modules.d/35network-legacy/module-setup.sh
modules.d/35network-legacy/net-genrules.sh
modules.d/35network-legacy/parse-bond.sh
modules.d/35network-legacy/parse-bridge.sh
modules.d/35network-legacy/parse-ibft.sh
modules.d/35network-legacy/parse-ifname.sh
modules.d/35network-legacy/parse-ip-opts.sh
modules.d/35network-legacy/parse-team.sh
modules.d/35network-legacy/parse-vlan.sh
modules.d/35network-manager/nm-config.sh
modules.d/35network-manager/nm-lib.sh
modules.d/35network-manager/nm-run.sh
modules.d/35network-wicked/module-setup.sh
modules.d/40network/ifname-genrules.sh
modules.d/40network/module-setup.sh
modules.d/40network/net-lib.sh
modules.d/40network/netroot.sh
modules.d/45ifcfg/module-setup.sh
modules.d/45ifcfg/write-ifcfg.sh
modules.d/45url-lib/module-setup.sh
modules.d/45url-lib/url-lib.sh
modules.d/50drm/module-setup.sh
modules.d/50gensplash/module-setup.sh
modules.d/50plymouth/module-setup.sh
modules.d/50plymouth/plymouth-emergency.sh
modules.d/50plymouth/plymouth-newroot.sh
modules.d/50plymouth/plymouth-populate-initrd.sh
modules.d/50plymouth/plymouth-pretrigger.sh
modules.d/80cms/cms-write-ifcfg.sh
modules.d/80cms/cmsifup.sh
modules.d/80cms/cmssetup.sh
modules.d/80lvmmerge/lvmmerge.sh
modules.d/81cio_ignore/module-setup.sh
modules.d/81cio_ignore/parse-cio_accept.sh
modules.d/90btrfs/btrfs_device_ready.sh
modules.d/90btrfs/btrfs_finished.sh
modules.d/90btrfs/btrfs_timeout.sh
modules.d/90btrfs/module-setup.sh
modules.d/90crypt/crypt-cleanup.sh
modules.d/90crypt/crypt-lib.sh
modules.d/90crypt/crypt-run-generator.sh
modules.d/90crypt/cryptroot-ask.sh
modules.d/90crypt/module-setup.sh
modules.d/90crypt/parse-crypt.sh
modules.d/90crypt/parse-keydev.sh
modules.d/90crypt/probe-keydev.sh
modules.d/90dm/dm-pre-udev.sh
modules.d/90dm/dm-shutdown.sh
modules.d/90dm/module-setup.sh
modules.d/90dmraid/dmraid.sh
modules.d/90dmraid/module-setup.sh
modules.d/90dmraid/parse-dm.sh
modules.d/90dmsquash-live/apply-live-updates.sh
modules.d/90dmsquash-live/dmsquash-generator.sh
modules.d/90dmsquash-live/dmsquash-live-genrules.sh
modules.d/90dmsquash-live/dmsquash-live-root.sh
modules.d/90dmsquash-live/iso-scan.sh
modules.d/90dmsquash-live/parse-dmsquash-live.sh
modules.d/90kernel-modules-extra/module-setup.sh
modules.d/90kernel-modules/module-setup.sh
modules.d/90kernel-modules/parse-kernel.sh
modules.d/90kernel-network-modules/module-setup.sh
modules.d/90livenet/fetch-liveupdate.sh
modules.d/90livenet/livenet-generator.sh
modules.d/90livenet/livenetroot.sh
modules.d/90livenet/parse-livenet.sh
modules.d/90lvm/lvm_scan.sh
modules.d/90lvm/module-setup.sh
modules.d/90lvm/parse-lvm.sh
modules.d/90mdraid/md-shutdown.sh
modules.d/90mdraid/mdmon-pre-shutdown.sh
modules.d/90mdraid/mdraid-cleanup.sh
modules.d/90mdraid/mdraid-needshutdown.sh
modules.d/90mdraid/mdraid-waitclean.sh
modules.d/90mdraid/mdraid_start.sh
modules.d/90mdraid/module-setup.sh
modules.d/90mdraid/parse-md.sh
modules.d/90multipath/module-setup.sh
modules.d/90multipath/multipath-shutdown.sh
modules.d/90multipath/multipathd-needshutdown.sh
modules.d/90multipath/multipathd-stop.sh
modules.d/90multipath/multipathd.sh
modules.d/90nvdimm/module-setup.sh
modules.d/90ppcmac/load-thermal.sh
modules.d/90ppcmac/module-setup.sh
modules.d/90qemu/module-setup.sh
modules.d/91crypt-gpg/crypt-gpg-lib.sh
modules.d/91crypt-gpg/module-setup.sh
modules.d/91crypt-loop/crypt-loop-lib.sh
modules.d/91zipl/install_zipl_cmdline.sh
modules.d/91zipl/module-setup.sh
modules.d/91zipl/parse-zipl.sh
modules.d/95cifs/cifs-lib.sh
modules.d/95cifs/cifsroot.sh
modules.d/95cifs/module-setup.sh
modules.d/95cifs/parse-cifsroot.sh
modules.d/95dasd/module-setup.sh
modules.d/95dasd_mod/module-setup.sh
modules.d/95dasd_mod/parse-dasd-mod.sh
modules.d/95dasd_rules/module-setup.sh
modules.d/95dasd_rules/parse-dasd.sh
modules.d/95dcssblk/module-setup.sh
modules.d/95dcssblk/parse-dcssblk.sh
modules.d/95debug/module-setup.sh
modules.d/95fcoe-uefi/parse-uefifcoe.sh
modules.d/95fcoe/fcoe-edd.sh
modules.d/95fcoe/fcoe-genrules.sh
modules.d/95fcoe/fcoe-up.sh
modules.d/95fcoe/lldpad.sh
modules.d/95fcoe/module-setup.sh
modules.d/95fcoe/parse-fcoe.sh
modules.d/95fcoe/stop-fcoe.sh
modules.d/95fstab-sys/module-setup.sh
modules.d/95fstab-sys/mount-sys.sh
modules.d/95iscsi/cleanup-iscsi.sh
modules.d/95iscsi/iscsiroot.sh
modules.d/95iscsi/module-setup.sh
modules.d/95iscsi/parse-iscsiroot.sh
modules.d/95lunmask/fc_transport_scan_lun.sh
modules.d/95lunmask/module-setup.sh
modules.d/95lunmask/parse-lunmask.sh
modules.d/95lunmask/sas_transport_scan_lun.sh
modules.d/95nbd/module-setup.sh
modules.d/95nbd/nbd-generator.sh
modules.d/95nbd/nbdroot.sh
modules.d/95nbd/parse-nbdroot.sh
modules.d/95nfs/module-setup.sh
modules.d/95nfs/nfs-lib.sh
modules.d/95nfs/nfs-start-rpc.sh
modules.d/95nfs/nfsroot-cleanup.sh
modules.d/95nfs/nfsroot.sh
modules.d/95nfs/parse-nfsroot.sh
modules.d/95nvmf/module-setup.sh
modules.d/95nvmf/parse-nvmf-boot-connections.sh
modules.d/95qeth_rules/module-setup.sh
modules.d/95resume/module-setup.sh
modules.d/95resume/parse-resume.sh
modules.d/95resume/resume.sh
modules.d/95rootfs-block/mount-root.sh
modules.d/95rootfs-block/parse-block.sh
modules.d/95rootfs-block/rootfallback.sh
modules.d/95ssh-client/module-setup.sh
modules.d/95udev-rules/module-setup.sh
modules.d/95virtfs/mount-virtfs.sh
modules.d/95virtfs/parse-virtfs.sh
modules.d/95zfcp/parse-zfcp.sh
modules.d/95zfcp_rules/module-setup.sh
modules.d/95zfcp_rules/parse-zfcp.sh
modules.d/95znet/module-setup.sh
modules.d/96securityfs/securityfs.sh
modules.d/97biosdevname/module-setup.sh
modules.d/97biosdevname/parse-biosdevname.sh
modules.d/97masterkey/masterkey.sh
modules.d/98dracut-systemd/dracut-cmdline-ask.sh
modules.d/98dracut-systemd/dracut-cmdline.sh
modules.d/98dracut-systemd/dracut-emergency.sh
modules.d/98dracut-systemd/dracut-initqueue.sh
modules.d/98dracut-systemd/dracut-mount.sh
modules.d/98dracut-systemd/dracut-pre-mount.sh
modules.d/98dracut-systemd/dracut-pre-pivot.sh
modules.d/98dracut-systemd/dracut-pre-trigger.sh
modules.d/98dracut-systemd/dracut-pre-udev.sh
modules.d/98dracut-systemd/module-setup.sh
modules.d/98dracut-systemd/rootfs-generator.sh
modules.d/98ecryptfs/ecryptfs-mount.sh
modules.d/98integrity/evm-enable.sh
modules.d/98integrity/ima-keys-load.sh
modules.d/98integrity/ima-policy-load.sh
modules.d/98pollcdrom/module-setup.sh
modules.d/98selinux/module-setup.sh
modules.d/98selinux/selinux-loadpolicy.sh
modules.d/98syslog/module-setup.sh
modules.d/98syslog/parse-syslog-opts.sh
modules.d/98syslog/rsyslogd-start.sh
modules.d/98syslog/rsyslogd-stop.sh
modules.d/98syslog/syslog-cleanup.sh
modules.d/98usrmount/module-setup.sh
modules.d/98usrmount/mount-usr.sh
modules.d/99base/dracut-lib.sh
modules.d/99base/init.sh
modules.d/99base/initqueue.sh
modules.d/99base/loginit.sh
modules.d/99base/module-setup.sh
modules.d/99base/parse-root-opts.sh
modules.d/99base/rdsosreport.sh
modules.d/99fs-lib/fs-lib.sh
modules.d/99fs-lib/module-setup.sh
modules.d/99img-lib/img-lib.sh
modules.d/99img-lib/module-setup.sh
modules.d/99memstrack/memstrack-report.sh
modules.d/99memstrack/memstrack-start.sh
modules.d/99memstrack/module-setup.sh
modules.d/99shutdown/module-setup.sh
modules.d/99shutdown/shutdown.sh
modules.d/99squash/module-setup.sh
modules.d/99uefi-lib/module-setup.sh
modules.d/99uefi-lib/uefi-lib.sh
test/TEST-01-BASIC/create-root.sh
test/TEST-01-BASIC/test-init.sh
test/TEST-01-BASIC/test.sh
test/TEST-02-SYSTEMD/create-root.sh
test/TEST-02-SYSTEMD/test-init.sh
test/TEST-02-SYSTEMD/test.sh
test/TEST-03-USR-MOUNT/create-root.sh
test/TEST-03-USR-MOUNT/test-init.sh
test/TEST-03-USR-MOUNT/test.sh
test/TEST-04-FULL-SYSTEMD/create-root.sh
test/TEST-04-FULL-SYSTEMD/test-init.sh
test/TEST-04-FULL-SYSTEMD/test.sh
test/TEST-10-RAID/create-root.sh
test/TEST-10-RAID/cryptroot-ask.sh
test/TEST-10-RAID/test-init.sh
test/TEST-10-RAID/test.sh
test/TEST-11-LVM/create-root.sh
test/TEST-11-LVM/test-init.sh
test/TEST-11-LVM/test.sh
test/TEST-12-RAID-DEG/create-root.sh
test/TEST-12-RAID-DEG/cryptroot-ask.sh
test/TEST-12-RAID-DEG/test-init.sh
test/TEST-12-RAID-DEG/test.sh
test/TEST-13-ENC-RAID-LVM/create-root.sh
test/TEST-13-ENC-RAID-LVM/cryptroot-ask.sh
test/TEST-13-ENC-RAID-LVM/test-init.sh
test/TEST-13-ENC-RAID-LVM/test.sh
test/TEST-14-IMSM/create-root.sh
test/TEST-14-IMSM/cryptroot-ask.sh
test/TEST-14-IMSM/hard-off.sh
test/TEST-14-IMSM/test-init.sh
test/TEST-14-IMSM/test.sh
test/TEST-15-BTRFSRAID/create-root.sh
test/TEST-15-BTRFSRAID/test-init.sh
test/TEST-15-BTRFSRAID/test.sh
test/TEST-16-DMSQUASH/test-init.sh
test/TEST-16-DMSQUASH/test.sh
test/TEST-17-LVM-THIN/create-root.sh
test/TEST-17-LVM-THIN/test-init.sh
test/TEST-17-LVM-THIN/test.sh
test/TEST-20-NFS/client-init.sh
test/TEST-20-NFS/create-root.sh
test/TEST-20-NFS/server-init.sh
test/TEST-20-NFS/test.sh
test/TEST-30-ISCSI/client-init.sh
test/TEST-30-ISCSI/create-client-root.sh
test/TEST-30-ISCSI/create-server-root.sh
test/TEST-30-ISCSI/server-init.sh
test/TEST-30-ISCSI/test.sh
test/TEST-35-ISCSI-MULTI/client-init.sh
test/TEST-35-ISCSI-MULTI/create-client-root.sh
test/TEST-35-ISCSI-MULTI/create-server-root.sh
test/TEST-35-ISCSI-MULTI/server-init.sh
test/TEST-35-ISCSI-MULTI/test.sh
test/TEST-40-NBD/client-init.sh
test/TEST-40-NBD/create-client-root.sh
test/TEST-40-NBD/create-encrypted-root.sh
test/TEST-40-NBD/create-server-root.sh
test/TEST-40-NBD/cryptroot-ask.sh
test/TEST-40-NBD/server-init.sh
test/TEST-40-NBD/test.sh
test/TEST-50-MULTINIC/client-init.sh
test/TEST-50-MULTINIC/create-root.sh
test/TEST-50-MULTINIC/server-init.sh
test/TEST-50-MULTINIC/test.sh
test/TEST-60-BONDBRIDGEVLANIFCFG/client-init.sh
test/TEST-60-BONDBRIDGEVLANIFCFG/create-root.sh
test/TEST-60-BONDBRIDGEVLANIFCFG/server-init.sh
test/TEST-60-BONDBRIDGEVLANIFCFG/test.sh
test/TEST-98-GETARG/test.sh
test/TEST-99-RPM/test.sh
test/run-qemu
test/test-functions

index a8b6e5760f585aad67a1f73a67997ceccd965aa6..3010cece7da42a350fdcf500c698cd9595c036b3 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 # We don't support srcdir != builddir
-echo \#buildapi-variable-no-builddir >/dev/null
+echo \#buildapi-variable-no-builddir > /dev/null
 
 prefix=/usr
 
@@ -31,24 +31,24 @@ read_arg() {
 
 while (($# > 0)); do
     case "${1%%=*}" in
-        --prefix) read_arg prefix "$@" || shift;;
-        --libdir) read_arg libdir "$@" || shift;;
-        --datadir) read_arg datadir "$@" || shift;;
-        --sysconfdir) read_arg sysconfdir "$@" || shift;;
-        --sbindir) read_arg sbindir "$@" || shift;;
-        --mandir) read_arg mandir "$@" || shift;;
-        --disable-documentation) enable_documentation=no;;
-        --program-prefix) read_arg programprefix "$@" || shift;;
-        --exec-prefix) read_arg execprefix "$@" || shift;;
-        --bindir) read_arg bindir "$@" || shift;;
-        --includedir) read_arg includedir "$@" || shift;;
-        --libexecdir) read_arg libexecdir "$@" || shift;;
-        --localstatedir) read_arg localstatedir "$@" || shift;;
-        --sharedstatedir) read_arg sharedstatedir "$@" || shift;;
-        --infodir) read_arg infodir "$@" || shift;;
-        --systemdsystemunitdir) read_arg systemdsystemunitdir "$@" || shift;;
-        --bashcompletiondir) read_arg bashcompletiondir "$@" || shift;;
-        *) echo "Ignoring unknown option '$1'";;
+        --prefix) read_arg prefix "$@" || shift ;;
+        --libdir) read_arg libdir "$@" || shift ;;
+        --datadir) read_arg datadir "$@" || shift ;;
+        --sysconfdir) read_arg sysconfdir "$@" || shift ;;
+        --sbindir) read_arg sbindir "$@" || shift ;;
+        --mandir) read_arg mandir "$@" || shift ;;
+        --disable-documentation) enable_documentation=no ;;
+        --program-prefix) read_arg programprefix "$@" || shift ;;
+        --exec-prefix) read_arg execprefix "$@" || shift ;;
+        --bindir) read_arg bindir "$@" || shift ;;
+        --includedir) read_arg includedir "$@" || shift ;;
+        --libexecdir) read_arg libexecdir "$@" || shift ;;
+        --localstatedir) read_arg localstatedir "$@" || shift ;;
+        --sharedstatedir) read_arg sharedstatedir "$@" || shift ;;
+        --infodir) read_arg infodir "$@" || shift ;;
+        --systemdsystemunitdir) read_arg systemdsystemunitdir "$@" || shift ;;
+        --bashcompletiondir) read_arg bashcompletiondir "$@" || shift ;;
+        *) echo "Ignoring unknown option '$1'" ;;
     esac
     shift
 done
@@ -58,7 +58,7 @@ if ! ${PKG_CONFIG} --exists --print-errors " libkmod >= 23 "; then
     exit 1
 fi
 
-cat <<EOF >conftest.c
+cat << EOF > conftest.c
 #include <fts.h>
 int main() {
        return 0;
@@ -66,17 +66,17 @@ int main() {
 EOF
 
 # shellcheck disable=SC2086
-${CC} $CFLAGS $LDFLAGS conftest.c >/dev/null 2>&1
+${CC} $CFLAGS $LDFLAGS conftest.c > /dev/null 2>&1
 ret=$?
 rm -f conftest.c a.out
 
 # musl doesn't have fts.h included
 if test $ret -ne 0; then
-       echo "dracut needs fts development files." >&2
-       exit 1
+    echo "dracut needs fts development files." >&2
+    exit 1
 fi
 
-cat <<EOF >conftest.c
+cat << EOF > conftest.c
 #include <fts.h>
 int main(void) {
        fts_open(0, 0, 0);
@@ -86,23 +86,23 @@ EOF
 
 found=no
 for lib in "-lc" "-lfts"; do
-  # shellcheck disable=SC2086
-  ${CC} $CFLAGS $LDFLAGS conftest.c -Wl,$lib >/dev/null 2>&1
-       ret=$?
-       if test $ret -eq 0; then
-               FTS_LIBS="$lib"
-               found=yes
-               break;
-       fi
+    # shellcheck disable=SC2086
+    ${CC} $CFLAGS $LDFLAGS conftest.c -Wl,$lib > /dev/null 2>&1
+    ret=$?
+    if test $ret -eq 0; then
+        FTS_LIBS="$lib"
+        found=yes
+        break
+    fi
 done
 rm -f conftest.c a.out
 
 if test $found = no; then
-       echo "dracut couldn't find usable fts library" >&2
-       exit 1
+    echo "dracut couldn't find usable fts library" >&2
+    exit 1
 fi
 
-cat > Makefile.inc.$$ <<EOF
+cat > Makefile.inc.$$ << EOF
 prefix ?= ${prefix}
 libdir ?= ${libdir:-${prefix}/lib}
 datadir ?= ${datadir:-${prefix}/share}
index 9fbd55589a4950ce21d804aec6f20cfb9c72582b..99755d1a0975062181e5a4bba53938efe54ba24b 100644 (file)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
-__contains_word () {
-        local word="$1"; shift
-        for w in "$@"; do [[ $w = "$word" ]] && return 0; done
-        return 1
+__contains_word() {
+    local word="$1"
+    shift
+    for w in "$@"; do [[ $w = "$word" ]] && return 0; done
+    return 1
 }
 
 _dracut() {
-        local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
-        local -A OPTS=(
-                [STANDALONE]='-f -v -q -l -H -h -M -N
+    local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD - 1]}
+    local -A OPTS=(
+        [STANDALONE]='-f -v -q -l -H -h -M -N
                               --ro-mnt --force --kernel-only --no-kernel --strip --nostrip
                               --hardlink --nohardlink --noprefix --mdadmconf --nomdadmconf
                               --lvmconf --nolvmconf --debug --profile --verbose --quiet
@@ -32,65 +33,74 @@ _dracut() {
                               --xz --zstd --no-compress --gzip --list-modules --show-modules --keep
                               --printsize --regenerate-all --noimageifnotneeded --early-microcode
                               --no-early-microcode --print-cmdline --reproducible --uefi'
-                [ARG]='-a -m -o -d -I -k -c -L --kver --add --force-add --add-drivers
+        [ARG]='-a -m -o -d -I -k -c -L --kver --add --force-add --add-drivers
                               --omit-drivers --modules --omit --drivers --filesystems --install
                               --fwdir --libdirs --fscks --add-fstab --mount --device --nofscks
                               --kmoddir --conf --confdir --tmpdir --stdlog --compress --prefix
                               --kernel-cmdline --sshkey --persistent-policy --install-optional
                               --loginstall --uefi-stub --kernel-image
                               '
-        )
+    )
 
-        # shellcheck disable=SC2086
-        if __contains_word "$prev" ${OPTS[ARG]}; then
-                case $prev in
-                        --kmoddir|-k|--fwdir|--confdir|--tmpdir)
-                                comps=$(compgen -d -- "$cur")
-                                compopt -o filenames
-                        ;;
-                        -c|--conf|--sshkey|--add-fstab|--add-device|-I|--install|--install-optional)
-                                comps=$(compgen -f -- "$cur")
-                                compopt -o filenames
-                        ;;
-                        -a|-m|-o|--add|--modules|--omit)
-                                comps=$(dracut --list-modules 2>/dev/null)
-                        ;;
-                        --persistent-policy)
-                                comps=$(cd /dev/disk/ || return 0; printf -- "%s " *)
-                        ;;
-                        --kver)
-                                comps=$(cd /lib/modules || return 0; echo [0-9]*)
-                        ;;
-                        *)
-                                return 0
-                        ;;
-                esac
-                # shellcheck disable=SC2207
-                # shellcheck disable=SC2016
-                COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
+    # shellcheck disable=SC2086
+    if __contains_word "$prev" ${OPTS[ARG]}; then
+        case $prev in
+            --kmoddir | -k | --fwdir | --confdir | --tmpdir)
+                comps=$(compgen -d -- "$cur")
+                compopt -o filenames
+                ;;
+            -c | --conf | --sshkey | --add-fstab | --add-device | -I | --install | --install-optional)
+                comps=$(compgen -f -- "$cur")
+                compopt -o filenames
+                ;;
+            -a | -m | -o | --add | --modules | --omit)
+                comps=$(dracut --list-modules 2> /dev/null)
+                ;;
+            --persistent-policy)
+                comps=$(
+                    cd /dev/disk/ || return 0
+                    printf -- "%s " *
+                )
+                ;;
+            --kver)
+                comps=$(
+                    cd /lib/modules || return 0
+                    echo [0-9]*
+                )
+                ;;
+            *)
                 return 0
-        fi
+                ;;
+        esac
+        # shellcheck disable=SC2207
+        # shellcheck disable=SC2016
+        COMPREPLY=($(compgen -W '$comps' -- "$cur"))
+        return 0
+    fi
 
-        if [[ $cur = -* ]]; then
-                # shellcheck disable=SC2207
-                # shellcheck disable=SC2016
-                COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
-                return 0
-        fi
+    if [[ $cur = -* ]]; then
+        # shellcheck disable=SC2207
+        # shellcheck disable=SC2016
+        COMPREPLY=($(compgen -W '${OPTS[*]}' -- "$cur"))
+        return 0
+    fi
 
-        local args
-        _count_args
-        if [[ $args -eq 1 ]]; then
-                _filedir
-                return 0
-        elif [[ $args -eq 2 ]]; then
-                # shellcheck disable=SC2034
-                comps=$(cd /lib/modules || return 0; echo [0-9]*)
-                # shellcheck disable=SC2207
-                # shellcheck disable=SC2016
-                COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
-                return 0
-        fi
+    local args
+    _count_args
+    if [[ $args -eq 1 ]]; then
+        _filedir
+        return 0
+    elif [[ $args -eq 2 ]]; then
+        # shellcheck disable=SC2034
+        comps=$(
+            cd /lib/modules || return 0
+            echo [0-9]*
+        )
+        # shellcheck disable=SC2207
+        # shellcheck disable=SC2016
+        COMPREPLY=($(compgen -W '$comps' -- "$cur"))
+        return 0
+    fi
 }
 
 complete -F _dracut dracut
index a7d7563636601a0e26136f17593a319eda12f903..b87e0003fddab6b589b80de414fb6fc5976db510 100755 (executable)
@@ -16,7 +16,6 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
-
 dwarning() {
     echo "Warning: $*" >&2
 }
@@ -49,27 +48,46 @@ line and /boot/dracut/
 EOF
 }
 
-
 imagedir=/boot/dracut/
 overlay=/var/lib/dracut/overlay
 
 while (($# > 0)); do
     case $1 in
-        -f|--force) force=yes;;
-        -i|--imagedir) imagedir=$2;shift;;
-        -o|--overlaydir) overlay=$2;shift;;
-        --nooverlay) no_overlay=yes;shift;;
-        --noimagedir) no_imagedir=yes;shift;;
-        -h|--help) usage; exit 1 ;;
-        --debug) export debug="yes";;
-        -v|--verbose) beverbose="yes";;
-        -*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
+        -f | --force) force=yes ;;
+        -i | --imagedir)
+            imagedir=$2
+            shift
+            ;;
+        -o | --overlaydir)
+            overlay=$2
+            shift
+            ;;
+        --nooverlay)
+            no_overlay=yes
+            shift
+            ;;
+        --noimagedir)
+            no_imagedir=yes
+            shift
+            ;;
+        -h | --help)
+            usage
+            exit 1
+            ;;
+        --debug) export debug="yes" ;;
+        -v | --verbose) beverbose="yes" ;;
+        -*)
+            printf "\nUnknown option: %s\n\n" "$1" >&2
+            usage
+            exit 1
+            ;;
         *) break ;;
     esac
     shift
 done
 
-outfile=$1; shift
+outfile=$1
+shift
 
 if [[ -z $outfile ]]; then
     derror "No output file specified."
@@ -77,7 +95,8 @@ if [[ -z $outfile ]]; then
     exit 1
 fi
 
-baseimage=$1; shift
+baseimage=$1
+shift
 
 if [[ -z $baseimage ]]; then
     derror "No base image specified."
@@ -103,8 +122,11 @@ fi
 if [[ ! $no_overlay ]]; then
     ofile="$imagedir/90-overlay.img"
     dinfo "Creating image $ofile from directory $overlay"
-    type pigz &>/dev/null && gzip=pigz || gzip=gzip
-    ( cd "$overlay" || return 1 ; find . |cpio --quiet -H newc -o |$gzip -9 > "$ofile"; )
+    type pigz &> /dev/null && gzip=pigz || gzip=gzip
+    (
+        cd "$overlay" || return 1
+        find . | cpio --quiet -H newc -o | $gzip -9 > "$ofile"
+    )
 fi
 
 if [[ ! $no_imagedir ]]; then
@@ -113,7 +135,7 @@ if [[ ! $no_imagedir ]]; then
     done
 fi
 
-images+=( "$@" )
+images+=("$@")
 
 dinfo "Using base image $baseimage"
 cat -- "$baseimage" > "$outfile"
index 8ce1ef05ed4da2940106aaabd73256e38ab799eb..a35dc016fd0b54bead241e0ed77359fd08ce7b68 100755 (executable)
@@ -25,7 +25,6 @@ is_func() {
     [[ "$(type -t "$1")" = "function" ]]
 }
 
-
 # Generic substring function.  If $2 is in $1, return 0.
 strstr() { [[ $1 = *"$2"* ]]; }
 # Generic glob matching function. If glob pattern $2 matches anywhere in $1, OK
@@ -49,15 +48,15 @@ find_binary() {
 
     if [[ "$1" == *.so* ]]; then
         # shellcheck disable=SC2154
-        for l in $libdirs ; do
+        for l in $libdirs; do
             _path="${l}${_delim}${1}"
-            if { $DRACUT_LDD "${dracutsysrootdir}${_path}" &>/dev/null; };  then
+            if { $DRACUT_LDD "${dracutsysrootdir}${_path}" &> /dev/null; }; then
                 printf "%s\n" "${_path}"
                 return 0
             fi
         done
         _path="${_delim}${1}"
-        if { $DRACUT_LDD "${dracutsysrootdir}${_path}" &>/dev/null; }; then
+        if { $DRACUT_LDD "${dracutsysrootdir}${_path}" &> /dev/null; }; then
             printf "%s\n" "${_path}"
             return 0
         fi
@@ -69,9 +68,9 @@ find_binary() {
             return 0
         fi
     fi
-    for p in $DRACUT_PATH ; do
+    for p in $DRACUT_PATH; do
         _path="${p}${_delim}${1}"
-        if [[ -L ${dracutsysrootdir}${_path} ]] || [[ -x ${dracutsysrootdir}${_path} ]];  then
+        if [[ -L ${dracutsysrootdir}${_path} ]] || [[ -x ${dracutsysrootdir}${_path} ]]; then
             printf "%s\n" "${_path}"
             return 0
         fi
@@ -81,9 +80,8 @@ find_binary() {
     type -P "${1##*/}"
 }
 
-ldconfig_paths()
-{
-    $DRACUT_LDCONFIG ${dracutsysrootdir:+-r ${dracutsysrootdir} -f /etc/ld.so.conf} -pN 2>/dev/null | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | sed -n 's,.* => \(.*\)/.*,\1,p' | sort | uniq
+ldconfig_paths() {
+    $DRACUT_LDCONFIG ${dracutsysrootdir:+-r ${dracutsysrootdir} -f /etc/ld.so.conf} -pN 2> /dev/null | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | sed -n 's,.* => \(.*\)/.*,\1,p' | sort | uniq
 }
 
 # Version comparision function.  Assumes Linux style version scheme.
@@ -98,23 +96,26 @@ vercmp() {
     read -a _n2 <<< "${3//./ }"
     local _i _res
 
-    for ((_i=0; ; _i++))
-    do
-        if [[ ! ${_n1[_i]}${_n2[_i]} ]]; then _res=0
-        elif ((${_n1[_i]:-0} > ${_n2[_i]:-0})); then _res=1
-        elif ((${_n1[_i]:-0} < ${_n2[_i]:-0})); then _res=2
-        else continue
+    for ((_i = 0; ; _i++)); do
+        if [[ ! ${_n1[_i]}${_n2[_i]} ]]; then
+            _res=0
+        elif ((${_n1[_i]:-0} > ${_n2[_i]:-0})); then
+            _res=1
+        elif ((${_n1[_i]:-0} < ${_n2[_i]:-0})); then
+            _res=2
+        else
+            continue
         fi
         break
     done
 
     case $_op in
-        gt) ((_res == 1));;
-        ge) ((_res != 2));;
-        eq) ((_res == 0));;
-        le) ((_res != 1));;
-        lt) ((_res == 2));;
-        ne) ((_res != 0));;
+        gt) ((_res == 1)) ;;
+        ge) ((_res != 2)) ;;
+        eq) ((_res == 0)) ;;
+        le) ((_res != 1)) ;;
+        lt) ((_res == 2)) ;;
+        ne) ((_res != 0)) ;;
     esac
 }
 
@@ -130,8 +131,7 @@ mksubdirs() {
 print_vars() {
     local _var _value
 
-    for _var in "$@"
-    do
+    for _var in "$@"; do
         eval printf -v _value "%s" \""\$$_var"\"
         [[ ${_value} ]] && printf '%s="%s"\n' "$_var" "$_value"
     done
@@ -163,10 +163,16 @@ convert_abs_rel() {
     set -- "$(normalize_path "$1")" "$(normalize_path "$2")"
 
     # corner case #1 - self looping link
-    [[ "$1" == "$2" ]] && { printf "%s\n" "${1##*/}"; return; }
+    [[ "$1" == "$2" ]] && {
+        printf "%s\n" "${1##*/}"
+        return
+    }
 
     # corner case #2 - own dir link
-    [[ "${1%/*}" == "$2" ]] && { printf ".\n"; return; }
+    [[ "${1%/*}" == "$2" ]] && {
+        printf ".\n"
+        return
+    }
 
     read -d '/' -r -a __current <<< "$1"
     read -d '/' -a __absolute <<< "$2"
@@ -174,28 +180,22 @@ convert_abs_rel() {
     __abssize=${#__absolute[@]}
     __cursize=${#__current[@]}
 
-    while [[ "${__absolute[__level]}" == "${__current[__level]}" ]]
-    do
-        (( __level++ ))
-        if (( __level > __abssize || __level > __cursize ))
-        then
+    while [[ "${__absolute[__level]}" == "${__current[__level]}" ]]; do
+        ((__level++))
+        if ((__level > __abssize || __level > __cursize)); then
             break
         fi
     done
 
-    for ((__i = __level; __i < __cursize-1; __i++))
-    do
-        if ((__i > __level))
-        then
+    for ((__i = __level; __i < __cursize - 1; __i++)); do
+        if ((__i > __level)); then
             __newpath=$__newpath"/"
         fi
         __newpath=$__newpath".."
     done
 
-    for ((__i = __level; __i < __abssize; __i++))
-    do
-        if [[ -n $__newpath ]]
-        then
+    for ((__i = __level; __i < __abssize; __i++)); do
+        if [[ -n $__newpath ]]; then
             __newpath=$__newpath"/"
         fi
         __newpath=$__newpath${__absolute[__i]}
@@ -204,7 +204,6 @@ convert_abs_rel() {
     printf -- "%s\n" "$__newpath"
 }
 
-
 # get_fs_env <device>
 # Get and the ID_FS_TYPE variable from udev for a device.
 # Example:
@@ -216,10 +215,10 @@ get_fs_env() {
     ID_FS_TYPE=$(blkid -u filesystem -o export -- "$1" \
         | while read line || [ -n "$line" ]; do
             if [[ "$line" == TYPE\=* ]]; then
-                printf "%s" "${line#TYPE=}";
-                exit 0;
+                printf "%s" "${line#TYPE=}"
+                exit 0
             fi
-            done)
+        done)
     if [[ $ID_FS_TYPE ]]; then
         printf "%s" "$ID_FS_TYPE"
         return 0
@@ -234,11 +233,10 @@ get_fs_env() {
 # 8:2
 get_maj_min() {
     local _majmin
-    _majmin="$(stat -L -c '%t:%T' "$1" 2>/dev/null)"
+    _majmin="$(stat -L -c '%t:%T' "$1" 2> /dev/null)"
     printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))"
 }
 
-
 # get_devpath_block <device>
 # get the DEVPATH in /sys of a block device
 get_devpath_block() {
@@ -247,7 +245,7 @@ get_devpath_block() {
 
     for _i in /sys/block/*/dev /sys/block/*/*/dev; do
         [[ -e "$_i" ]] || continue
-        if [[ "$_majmin" == "$(<"$_i")" ]]; then
+        if [[ "$_majmin" == "$(< "$_i")" ]]; then
             printf "%s" "${_i%/dev}"
             return 0
         fi
@@ -263,9 +261,9 @@ get_persistent_dev() {
     [ -z "$_dev" ] && return
 
     if [[ -n "$persistent_policy" ]]; then
-       _pol="/dev/disk/${persistent_policy}/*"
+        _pol="/dev/disk/${persistent_policy}/*"
     else
-       _pol=
+        _pol=
     fi
 
     for i in \
@@ -276,8 +274,7 @@ get_persistent_dev() {
         /dev/disk/by-partuuid/* \
         /dev/disk/by-partlabel/* \
         /dev/disk/by-id/* \
-        /dev/disk/by-path/* \
-        ; do
+        /dev/disk/by-path/*; do
         [[ -e "$i" ]] || continue
         [[ $i == /dev/mapper/control ]] && continue
         [[ $i == /dev/mapper/mpath* ]] && continue
@@ -318,15 +315,20 @@ shorten_persistent_dev() {
     local _dev="$1"
     case "$_dev" in
         /dev/disk/by-uuid/*)
-            printf "%s" "UUID=${_dev##*/}";;
+            printf "%s" "UUID=${_dev##*/}"
+            ;;
         /dev/disk/by-label/*)
-            printf "%s" "LABEL=${_dev##*/}";;
+            printf "%s" "LABEL=${_dev##*/}"
+            ;;
         /dev/disk/by-partuuid/*)
-            printf "%s" "PARTUUID=${_dev##*/}";;
+            printf "%s" "PARTUUID=${_dev##*/}"
+            ;;
         /dev/disk/by-partlabel/*)
-            printf "%s" "PARTLABEL=${_dev##*/}";;
+            printf "%s" "PARTLABEL=${_dev##*/}"
+            ;;
         *)
-            printf "%s" "$_dev";;
+            printf "%s" "$_dev"
+            ;;
     esac
 }
 
@@ -346,7 +348,7 @@ find_block_device() {
 
     if [[ $use_fstab != yes ]]; then
         [[ -d $_find_mpt/. ]]
-        findmnt -e -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt" | { \
+        findmnt -e -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt" | {
             while read _majmin _dev || [ -n "$_dev" ]; do
                 if [[ -b $_dev ]]; then
                     if ! [[ $_majmin ]] || [[ $_majmin == 0:* ]]; then
@@ -363,11 +365,13 @@ find_block_device() {
                     printf "%s\n" "$_dev"
                     return 0
                 fi
-            done; return 1; } && return 0
+            done
+            return 1
+        } && return 0
     fi
     # fall back to /etc/fstab
 
-    findmnt -e --fstab -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt" | { \
+    findmnt -e --fstab -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt" | {
         while read _majmin _dev || [ -n "$_dev" ]; do
             if ! [[ $_dev ]]; then
                 _dev="$_majmin"
@@ -386,7 +390,9 @@ find_block_device() {
                 printf "%s\n" "$_dev"
                 return 0
             fi
-        done; return 1; } && return 0
+        done
+        return 1
+    } && return 0
 
     return 1
 }
@@ -403,22 +409,26 @@ find_mp_fstype() {
     local _fs
 
     if [[ $use_fstab != yes ]]; then
-        findmnt -e -v -n -o 'FSTYPE' --target "$1" | { \
+        findmnt -e -v -n -o 'FSTYPE' --target "$1" | {
             while read _fs || [ -n "$_fs" ]; do
                 [[ $_fs ]] || continue
                 [[ $_fs = "autofs" ]] && continue
                 printf "%s" "$_fs"
                 return 0
-            done; return 1; } && return 0
+            done
+            return 1
+        } && return 0
     fi
 
-    findmnt --fstab -e -v -n -o 'FSTYPE' --target "$1" | { \
+    findmnt --fstab -e -v -n -o 'FSTYPE' --target "$1" | {
         while read _fs || [ -n "$_fs" ]; do
             [[ $_fs ]] || continue
             [[ $_fs = "autofs" ]] && continue
             printf "%s" "$_fs"
             return 0
-        done; return 1; } && return 0
+        done
+        return 1
+    } && return 0
 
     return 1
 }
@@ -439,22 +449,26 @@ find_dev_fstype() {
     fi
 
     if [[ $use_fstab != yes ]]; then
-        findmnt -e -v -n -o 'FSTYPE' --source "$_find_dev" | { \
+        findmnt -e -v -n -o 'FSTYPE' --source "$_find_dev" | {
             while read _fs || [ -n "$_fs" ]; do
                 [[ $_fs ]] || continue
                 [[ $_fs = "autofs" ]] && continue
                 printf "%s" "$_fs"
                 return 0
-            done; return 1; } && return 0
+            done
+            return 1
+        } && return 0
     fi
 
-    findmnt --fstab -e -v -n -o 'FSTYPE' --source "$_find_dev" | { \
+    findmnt --fstab -e -v -n -o 'FSTYPE' --source "$_find_dev" | {
         while read _fs || [ -n "$_fs" ]; do
             [[ $_fs ]] || continue
             [[ $_fs = "autofs" ]] && continue
             printf "%s" "$_fs"
             return 0
-        done; return 1; } && return 0
+        done
+        return 1
+    } && return 0
 
     return 1
 }
@@ -469,7 +483,7 @@ find_dev_fstype() {
 # rw,relatime,discard,data=ordered
 find_mp_fsopts() {
     if [[ $use_fstab != yes ]]; then
-        findmnt -e -v -n -o 'OPTIONS' --target "$1" 2>/dev/null && return 0
+        findmnt -e -v -n -o 'OPTIONS' --target "$1" 2> /dev/null && return 0
     fi
 
     findmnt --fstab -e -v -n -o 'OPTIONS' --target "$1"
@@ -492,36 +506,32 @@ find_dev_fsopts() {
     fi
 
     if [[ $use_fstab != yes ]]; then
-        findmnt -e -v -n -o 'OPTIONS' --source "$_find_dev" 2>/dev/null && return 0
+        findmnt -e -v -n -o 'OPTIONS' --source "$_find_dev" 2> /dev/null && return 0
     fi
 
     findmnt --fstab -e -v -n -o 'OPTIONS' --source "$_find_dev"
 }
 
-
 # finds the major:minor of the block device backing the root filesystem.
 find_root_block_device() { find_block_device /; }
 
 # for_each_host_dev_fs <func>
 # Execute "<func> <dev> <filesystem>" for every "<dev> <fs>" pair found
 # in ${host_fs_types[@]}
-for_each_host_dev_fs()
-{
+for_each_host_dev_fs() {
     local _func="$1"
     local _dev
     local _ret=1
 
     [[ "${#host_fs_types[@]}" ]] || return 2
 
-
     for _dev in "${!host_fs_types[@]}"; do
         $_func "$_dev" "${host_fs_types[$_dev]}" && _ret=0
     done
     return $_ret
 }
 
-host_fs_all()
-{
+host_fs_all() {
     printf "%s\n" "${host_fs_types[@]}"
 }
 
@@ -535,12 +545,12 @@ check_block_and_slaves() {
     if ! lvm_internal_dev $2; then "$1" $2 && return; fi
     check_vol_slaves "$@" && return 0
     if [[ -f /sys/dev/block/$2/../dev ]] && [[ /sys/dev/block/$2/../subsystem -ef /sys/class/block ]]; then
-        check_block_and_slaves $1 $(<"/sys/dev/block/$2/../dev") && return 0
+        check_block_and_slaves $1 $(< "/sys/dev/block/$2/../dev") && return 0
     fi
     for _x in /sys/dev/block/$2/slaves/*; do
         [[ -f $_x/dev ]] || continue
         [[ $_x/subsystem -ef /sys/class/block ]] || continue
-        check_block_and_slaves $1 $(<"$_x/dev") && return 0
+        check_block_and_slaves $1 $(< "$_x/dev") && return 0
     done
     return 1
 }
@@ -553,20 +563,19 @@ check_block_and_slaves_all() {
     fi
     check_vol_slaves_all "$@" && return 0
     if [[ -f /sys/dev/block/$2/../dev ]] && [[ /sys/dev/block/$2/../subsystem -ef /sys/class/block ]]; then
-        check_block_and_slaves_all $1 $(<"/sys/dev/block/$2/../dev") && _ret=0
+        check_block_and_slaves_all $1 $(< "/sys/dev/block/$2/../dev") && _ret=0
     fi
     for _x in /sys/dev/block/$2/slaves/*; do
         [[ -f $_x/dev ]] || continue
         [[ $_x/subsystem -ef /sys/class/block ]] || continue
-        check_block_and_slaves_all $1 $(<"$_x/dev") && _ret=0
+        check_block_and_slaves_all $1 $(< "$_x/dev") && _ret=0
     done
     return $_ret
 }
 # for_each_host_dev_and_slaves <func>
 # Execute "<func> <dev>" for every "<dev>" found
 # in ${host_devs[@]} and their slaves
-for_each_host_dev_and_slaves_all()
-{
+for_each_host_dev_and_slaves_all() {
     local _func="$1"
     local _dev
     local _ret=1
@@ -582,8 +591,7 @@ for_each_host_dev_and_slaves_all()
     return $_ret
 }
 
-for_each_host_dev_and_slaves()
-{
+for_each_host_dev_and_slaves() {
     local _func="$1"
     local _dev
 
@@ -607,13 +615,12 @@ check_vol_slaves() {
     _majmin="$2"
     _lv="/dev/block/$_majmin"
     _dm=/sys/dev/block/$_majmin/dm
-    [[ -f $_dm/uuid  && $(<$_dm/uuid) =~ LVM-* ]] || return 1
-    _vg=$(dmsetup splitname --noheadings -o vg_name $(<"$_dm/name") )
+    [[ -f $_dm/uuid && $(< $_dm/uuid) =~ LVM-* ]] || return 1
+    _vg=$(dmsetup splitname --noheadings -o vg_name $(< "$_dm/name"))
     # strip space
     _vg="${_vg//[[:space:]]/}"
     if [[ $_vg ]]; then
-        for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
-        do
+        for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2> /dev/null); do
             check_block_and_slaves $1 $(get_maj_min $_pv) && return 0
         done
     fi
@@ -625,19 +632,18 @@ check_vol_slaves_all() {
     _majmin="$2"
     _lv="/dev/block/$_majmin"
     _dm="/sys/dev/block/$_majmin/dm"
-    [[ -f $_dm/uuid  && $(<$_dm/uuid) =~ LVM-* ]] || return 1
-    _vg=$(dmsetup splitname --noheadings -o vg_name $(<"$_dm/name") )
+    [[ -f $_dm/uuid && $(< $_dm/uuid) =~ LVM-* ]] || return 1
+    _vg=$(dmsetup splitname --noheadings -o vg_name $(< "$_dm/name"))
     # strip space
     _vg="${_vg//[[:space:]]/}"
     if [[ $_vg ]]; then
         # when filter/global_filter is set, lvm may be failed
-        lvm lvs --noheadings -o vg_name $_vg 2>/dev/null 1>/dev/null
+        lvm lvs --noheadings -o vg_name $_vg 2> /dev/null 1> /dev/null
         if [ $? -ne 0 ]; then
-             return 1
+            return 1
         fi
 
-        for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
-        do
+        for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2> /dev/null); do
             check_block_and_slaves_all $1 $(get_maj_min $_pv)
         done
         return 0
@@ -645,8 +651,6 @@ check_vol_slaves_all() {
     return 1
 }
 
-
-
 # fs_get_option <filesystem options> <search for option>
 # search for a specific option in a bunch of filesystem options
 # and return the value
@@ -662,13 +666,13 @@ fs_get_option() {
             $_option=*)
                 echo ${1#${_option}=}
                 break
+                ;;
         esac
         shift
     done
 }
 
-check_kernel_config()
-{
+check_kernel_config() {
     local _config_opt="$1"
     local _config_file
     [[ -f $dracutsysrootdir/boot/config-$kernel ]] \
@@ -686,13 +690,12 @@ check_kernel_config()
 # 0 if the kernel module is either built-in or available
 # 1 if the kernel module is not enabled
 check_kernel_module() {
-    modprobe -S $kernel --dry-run $1 &>/dev/null || return 1
+    modprobe -S $kernel --dry-run $1 &> /dev/null || return 1
 }
 
 # get_cpu_vendor
 # Only two values are returned: AMD or Intel
-get_cpu_vendor ()
-{
+get_cpu_vendor() {
     if grep -qE AMD /proc/cpuinfo; then
         printf "AMD"
     fi
@@ -703,11 +706,10 @@ get_cpu_vendor ()
 
 # get_host_ucode
 # Get the hosts' ucode file based on the /proc/cpuinfo
-get_ucode_file ()
-{
-    local family=`grep -E "cpu family" /proc/cpuinfo | head -1 | sed s/.*:\ //`
-    local model=`grep -E "model" /proc/cpuinfo |grep -v name | head -1 | sed s/.*:\ //`
-    local stepping=`grep -E "stepping" /proc/cpuinfo | head -1 | sed s/.*:\ //`
+get_ucode_file() {
+    local family=$(grep -E "cpu family" /proc/cpuinfo | head -1 | sed s/.*:\ //)
+    local model=$(grep -E "model" /proc/cpuinfo | grep -v name | head -1 | sed s/.*:\ //)
+    local stepping=$(grep -E "stepping" /proc/cpuinfo | head -1 | sed s/.*:\ //)
 
     if [[ "$(get_cpu_vendor)" == "AMD" ]]; then
         if [[ $family -ge 21 ]]; then
@@ -726,9 +728,9 @@ get_ucode_file ()
 # If it is an LVM device, touch only devices which have /dev/VG/LV symlink.
 lvm_internal_dev() {
     local dev_dm_dir=/sys/dev/block/$1/dm
-    [[ ! -f $dev_dm_dir/uuid || $(<$dev_dm_dir/uuid) != LVM-* ]] && return 1 # Not an LVM device
+    [[ ! -f $dev_dm_dir/uuid || $(< $dev_dm_dir/uuid) != LVM-* ]] && return 1 # Not an LVM device
     local DM_VG_NAME DM_LV_NAME DM_LV_LAYER
-    eval $(dmsetup splitname --nameprefixes --noheadings --rows "$(<$dev_dm_dir/name)" 2>/dev/null)
+    eval $(dmsetup splitname --nameprefixes --noheadings --rows "$(< $dev_dm_dir/name)" 2> /dev/null)
     [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 0 # Better skip this!
     [[ ${DM_LV_LAYER} ]] || [[ ! -L /dev/${DM_VG_NAME}/${DM_LV_NAME} ]]
 }
@@ -737,9 +739,9 @@ btrfs_devs() {
     local _mp="$1"
     btrfs device usage "$_mp" \
         | while read _dev _rest; do
-        str_starts "$_dev" "/" || continue
-        _dev=${_dev%,}
-        printf -- "%s\n" "$_dev"
+            str_starts "$_dev" "/" || continue
+            _dev=${_dev%,}
+            printf -- "%s\n" "$_dev"
         done
 }
 
@@ -759,8 +761,8 @@ peer_for_addr() {
 
     # quote periods in IPv4 address
     qtd=${addr//./\\.}
-    ip -o addr show \
-        sed -n 's%^.* '"$qtd"' peer \([0-9a-f.:]\{1,\}\(/[0-9]*\)\?\).*$%\1%p'
+    ip -o addr show \
+        sed -n 's%^.* '"$qtd"' peer \([0-9a-f.:]\{1,\}\(/[0-9]*\)\?\).*$%\1%p'
 }
 
 netmask_for_addr() {
@@ -776,12 +778,12 @@ gateway_for_iface() {
     local ifname=$1 addr=$2
 
     case $addr in
-        *.*) proto=4;;
-        *:*) proto=6;;
-        *)   return;;
+        *.*) proto=4 ;;
+        *:*) proto=6 ;;
+        *) return ;;
     esac
-    ip -o -$proto route show \
-        sed -n "s/^default via \([0-9a-z.:]\{1,\}\) dev $ifname .*\$/\1/p"
+    ip -o -$proto route show \
+        sed -n "s/^default via \([0-9a-z.:]\{1,\}\) dev $ifname .*\$/\1/p"
 }
 
 # This works only for ifcfg-style network configuration!
@@ -819,21 +821,24 @@ ip_params_for_remote_addr() {
     # ifname clause to bind the interface name to a MAC address
     if [ -d "/sys/class/net/$ifname/bonding" ]; then
         dinfo "Found bonded interface '${ifname}'. Make sure to provide an appropriate 'bond=' cmdline."
-    elif [ -e "/sys/class/net/$ifname/address" ] ; then
+    elif [ -e "/sys/class/net/$ifname/address" ]; then
         ifmac=$(cat "/sys/class/net/$ifname/address")
         [[ $ifmac ]] && printf 'ifname=%s:%s ' "${ifname}" "${ifmac}"
     fi
 
     bootproto=$(bootproto_for_iface "$ifname")
     case $bootproto in
-        dhcp|dhcp6|auto6) ;;
+        dhcp | dhcp6 | auto6) ;;
         dhcp4)
-            bootproto=dhcp;;
-        static*|"")
-            bootproto=;;
+            bootproto=dhcp
+            ;;
+        static* | "")
+            bootproto=
+            ;;
         *)
             derror "bootproto \"$bootproto\" is unsupported by dracut, trying static configuration"
-            bootproto=;;
+            bootproto=
+            ;;
     esac
     if [[ $bootproto ]]; then
         printf 'ip=%s:%s ' "${ifname}" "${bootproto}"
@@ -852,7 +857,7 @@ ip_params_for_remote_addr() {
         is_unbracketed_ipv6_address "$peer" && peer="[$peer]"
         is_unbracketed_ipv6_address "$gateway" && gateway="[$gateway]"
         printf 'ip=%s:%s:%s:%s::%s:none ' \
-               "${local_addr}" "${peer}" "${gateway}" "${netmask}" "${ifname}"
+            "${local_addr}" "${peer}" "${gateway}" "${netmask}" "${ifname}"
     fi
 
 }
index e4c7bd5e24049d71a7a06f56e4dded212c08ca1a..641d0934b732f7eec577ae0a13e11fbb351f031d 100644 (file)
@@ -38,7 +38,7 @@ if ! [[ $dracutbasedir ]]; then
     dracutbasedir="$(readlink -f $dracutbasedir)"
 fi
 
-if ! is_func dinfo >/dev/null 2>&1; then
+if ! is_func dinfo > /dev/null 2>&1; then
     # shellcheck source=./dracut-logger.sh
     . "$dracutbasedir/dracut-logger.sh"
     dlog_init
@@ -64,7 +64,7 @@ srcmods="$dracutsysrootdir/lib/modules/$kernel/"
 
 # shellcheck disable=SC2154
 [[ $drivers_dir ]] && {
-    if ! command -v kmod &>/dev/null && vercmp "$(modprobe --version | cut -d' ' -f3)" lt 3.7; then
+    if ! command -v kmod &> /dev/null && vercmp "$(modprobe --version | cut -d' ' -f3)" lt 3.7; then
         dfatal 'To use --kmoddir option module-init-tools >= 3.7 is required.'
         exit 1
     fi
@@ -91,8 +91,8 @@ DRACUT_LDCONFIG=${DRACUT_LDCONFIG:-ldconfig}
 . "$dracutbasedir"/dracut-functions.sh
 
 # Detect lib paths
-if ! [[ $libdirs ]] ; then
-    if [[ $("$DRACUT_LDD" "$dracutsysrootdir$DRACUT_TESTBIN") == */lib64/* ]] &>/dev/null \
+if ! [[ $libdirs ]]; then
+    if [[ $("$DRACUT_LDD" "$dracutsysrootdir$DRACUT_TESTBIN") == */lib64/* ]] &> /dev/null \
         && [[ -d $dracutsysrootdir/lib64 ]]; then
         libdirs+=" /lib64"
         [[ -d $dracutsysrootdir/usr/lib64 ]] && libdirs+=" /usr/lib64"
@@ -120,7 +120,7 @@ require_binaries() {
     fi
 
     for cmd in "$@"; do
-        if ! find_binary "$cmd" &>/dev/null; then
+        if ! find_binary "$cmd" &> /dev/null; then
             dinfo "dracut module '${_module_name#[0-9][0-9]}' will not be installed, because command '$cmd' could not be found!"
             ((_ret++))
         fi
@@ -138,13 +138,13 @@ require_any_binary() {
     fi
 
     for cmd in "$@"; do
-        if find_binary "$cmd" &>/dev/null; then
+        if find_binary "$cmd" &> /dev/null; then
             _ret=0
             break
         fi
     done
 
-    if (( _ret != 0 )); then
+    if ((_ret != 0)); then
         dinfo "$_module_name: Could not find any command of '$*'!"
         return 1
     fi
@@ -153,7 +153,7 @@ require_any_binary() {
 }
 
 dracut_need_initqueue() {
-    : >"$initdir/lib/dracut/need-initqueue"
+    : > "$initdir/lib/dracut/need-initqueue"
 }
 
 dracut_module_included() {
@@ -162,7 +162,7 @@ dracut_module_included() {
 }
 
 dracut_no_switch_root() {
-    : >"$initdir/lib/dracut/no-switch-root"
+    : > "$initdir/lib/dracut/no-switch-root"
 }
 
 dracut_module_path() {
@@ -193,11 +193,11 @@ fi
 # DRACUT_INSTALL="dracut-install --debug"
 # in which case the string cannot be tested for being executable.
 DRINSTALLPARTS=0
-for i in $DRACUT_INSTALL ; do
-    DRINSTALLPARTS=$((DRINSTALLPARTS+1))
+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
@@ -211,7 +211,7 @@ fi
 
 [[ $DRACUT_RESOLVE_LAZY ]] || export DRACUT_RESOLVE_DEPS=1
 inst_dir() {
-    [[ -e ${initdir}/"$1" ]] && return 0  # already there
+    [[ -e ${initdir}/"$1" ]] && return 0 # already there
     if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -d "$@"; then
         derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -d "$@"
     fi
@@ -223,7 +223,7 @@ inst() {
         _hostonly_install="-H"
         shift
     fi
-    [[ -e ${initdir}/"${2:-$1}" ]] && return 0  # already there
+    [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
     # shellcheck disable=SC2154
     if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then
         derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
@@ -236,8 +236,8 @@ inst_simple() {
         _hostonly_install="-H"
         shift
     fi
-    [[ -e ${initdir}/"${2:-$1}" ]] && return 0  # already there
-    [[ -e $1 ]] || return 1  # no source
+    [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
+    [[ -e $1 ]] || return 1                    # no source
     if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@"; then
         derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@" || :
     fi
@@ -249,20 +249,20 @@ inst_symlink() {
         _hostonly_install="-H"
         shift
     fi
-    [[ -e ${initdir}/"${2:-$1}" ]] && return 0  # already there
+    [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
     [[ -L $1 ]] || return 1
-    if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then
-        derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
+    if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then
+        derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
     fi
 }
 
 inst_multiple() {
     local _ret
-    if "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} "$@"; then
+    if "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"; then
         return 0
     else
         _ret=$?
-        derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
+        derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
         return $_ret
     fi
 }
@@ -272,8 +272,8 @@ dracut_install() {
 }
 
 dracut_instmods() {
-    local _silent=0;
-    local i;
+    local _silent=0
+    local i
     # shellcheck disable=SC2154
     [[ $no_kernel = yes ]] && return
     for i in "$@"; do
@@ -296,29 +296,29 @@ inst_library() {
         _hostonly_install="-H"
         shift
     fi
-    [[ -e ${initdir}/"${2:-$1}" ]] && return 0  # already there
-    [[ -e $1 ]] || return 1  # no source
-    if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then
-        derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
+    [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
+    [[ -e $1 ]] || return 1                    # no source
+    if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then
+        derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
     fi
 }
 
 inst_binary() {
-    if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} "$@"; then
-        derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} "$@" || :
+    if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"; then
+        derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
     fi
 }
 
 inst_script() {
     if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"; then
-        derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} "$@" || :
+        derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
     fi
 }
 
 inst_fsck_help() {
     local _helper="/run/dracut/fsck/fsck_help_$1.txt"
     if ! "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" "$_helper"; then
-        derror "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} "$2" "$_helper" || :
+        derror "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" "$_helper" || :
     fi
 }
 
@@ -366,7 +366,7 @@ rev_lib_symlinks() {
 
     until [[ ${_fn##*.} == so ]]; do
         _fn="${_fn%.*}"
-        [[ -L ${_fn} ]] && [[ $(readlink -f "${_fn}") == "${_orig}" ]] && _links+=( "${_fn}" )
+        [[ -L ${_fn} ]] && [[ $(readlink -f "${_fn}") == "${_orig}" ]] && _links+=("${_fn}")
     done
 
     echo "${_links[*]}}"
@@ -385,7 +385,7 @@ inst_rule_programs() {
         elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then
             _bin=$(find_binary "$_prog") || {
                 dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
-                continue;
+                continue
             }
         fi
 
@@ -400,7 +400,7 @@ inst_rule_programs() {
         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;
+                continue
             }
         fi
 
@@ -415,7 +415,7 @@ inst_rule_programs() {
         elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then
             _bin=$(find_binary "$_prog") || {
                 dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found"
-                continue;
+                continue
             }
         fi
 
@@ -429,15 +429,15 @@ inst_rule_group_owner() {
 
     # shellcheck disable=SC2013
     for i in $(sed -nr 's/.*OWNER=?"([^ "]+).*/\1/p' "$1"); do
-        if ! grep -Eq "^$i:" "$initdir/etc/passwd" 2>/dev/null; then
-            grep -E "^$i:" "$dracutsysrootdir"/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
+        if ! grep -Eq "^$i:" "$initdir/etc/passwd" 2> /dev/null; then
+            grep -E "^$i:" "$dracutsysrootdir"/etc/passwd 2> /dev/null >> "$initdir/etc/passwd"
         fi
     done
 
     # shellcheck disable=SC2013
     for i in $(sed -nr 's/.*GROUP=?"([^ "]+).*/\1/p' "$1"); do
-        if ! grep -Eq "^$i:" "$initdir/etc/group" 2>/dev/null; then
-            grep -E "^$i:" "$dracutsysrootdir"/etc/group 2>/dev/null >> "$initdir/etc/group"
+        if ! grep -Eq "^$i:" "$initdir/etc/group" 2> /dev/null; then
+            grep -E "^$i:" "$dracutsysrootdir"/etc/group 2> /dev/null >> "$initdir/etc/group"
         fi
     done
 }
@@ -485,7 +485,7 @@ inst_rules_wildcard() {
 
     inst_dir "${udevdir}/rules.d"
     inst_dir "$_target"
-    for _rule in ${udevdir}/rules.d/$1 ${dracutbasedir}/rules.d/$1 ; do
+    for _rule in ${udevdir}/rules.d/$1 ${dracutbasedir}/rules.d/$1; do
         [[ -e $_rule ]] || continue
         inst_rule_programs "$_rule"
         inst_rule_group_owner "$_rule"
@@ -493,8 +493,8 @@ inst_rules_wildcard() {
         inst_simple "$_rule"
         _found=$_rule
     done
-    if [[ -n ${hostonly} ]] ; then
-        for _rule in ${_target}/$1 ; do
+    if [[ -n ${hostonly} ]]; then
+        for _rule in ${_target}/$1; do
             [[ -f $_rule ]] || continue
             inst_rule_programs "$_rule"
             inst_rule_group_owner "$_rule"
@@ -526,13 +526,13 @@ prepare_udev_rules() {
         [ -e "$f" ] || continue
         while read -r line || [ -n "$line" ]; do
             if [ "${line%%IMPORT PATH_ID}" != "$line" ]; then
-                if (( UDEVVERSION >= 174 )); then
+                if ((UDEVVERSION >= 174)); then
                     printf '%sIMPORT{builtin}="path_id"\n' "${line%%IMPORT PATH_ID}"
                 else
                     printf '%sIMPORT{program}="path_id %%p"\n' "${line%%IMPORT PATH_ID}"
                 fi
             elif [ "${line%%IMPORT BLKID}" != "$line" ]; then
-                if (( UDEVVERSION >= 176 )); then
+                if ((UDEVVERSION >= 176)); then
                     printf '%sIMPORT{builtin}="blkid"\n' "${line%%IMPORT BLKID}"
                 else
                     # shellcheck disable=SC2016
@@ -588,7 +588,6 @@ inst_any() {
     return 1
 }
 
-
 # inst_libdir_file [-n <pattern>] <file> [<file>...]
 # Install a <file> located on a lib directory to the initramfs image
 # -n <pattern> install matching files
@@ -836,7 +835,8 @@ check_mount() {
     fi
 
     if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then
-        module_check_mount "$_mod" "$_moddir"; ret=$?
+        module_check_mount "$_mod" "$_moddir"
+        ret=$?
 
         # explicit module, so also accept ret=255
         [[ $ret = 0 || $ret = 255 ]] || return 1
@@ -869,8 +869,8 @@ check_mount() {
         fi
     done
 
-    [[ " $mods_to_load " == *\ $_mod\ * ]] || \
-        mods_to_load+=" $_mod "
+    [[ " $mods_to_load " == *\ $_mod\ * ]] \
+        || mods_to_load+=" $_mod "
 
     return 0
 }
@@ -902,9 +902,11 @@ check_module() {
 
     if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then
         if [[ " $dracutmodules $force_add_dracutmodules " == *\ $_mod\ * ]]; then
-            module_check "$_mod" 1 "$_moddir"; ret=$?
+            module_check "$_mod" 1 "$_moddir"
+            ret=$?
         else
-            module_check "$_mod" 0 "$_moddir"; ret=$?
+            module_check "$_mod" 0 "$_moddir"
+            ret=$?
         fi
         # explicit module, so also accept ret=255
         [[ $ret = 0 || $ret = 255 ]] || return 1
@@ -912,7 +914,8 @@ check_module() {
         # module not in our list
         if [[ $dracutmodules = all ]]; then
             # check, if we can and should install this module
-            module_check "$_mod" 0 "$_moddir"; ret=$?
+            module_check "$_mod" 0 "$_moddir"
+            ret=$?
             if [[ $ret != 0 ]]; then
                 [[ $2 ]] && return 1
                 [[ $ret != 255 ]] && return 1
@@ -941,8 +944,8 @@ check_module() {
         fi
     done
 
-    [[ " $mods_to_load " == *\ $_mod\ * ]] || \
-        mods_to_load+=" $_mod "
+    [[ " $mods_to_load " == *\ $_mod\ * ]] \
+        || mods_to_load+=" $_mod "
 
     return 0
 }
@@ -956,10 +959,11 @@ for_each_module_dir() {
     local _func
     _func=$1
     for _moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
-        [[ -d $_moddir ]] || continue;
-        [[ -e $_moddir/install || -e $_moddir/installkernel || \
-            -e $_moddir/module-setup.sh ]] || continue
-        _mod=${_moddir##*/}; _mod=${_mod#[0-9][0-9]}
+        [[ -d $_moddir ]] || continue
+        [[ -e $_moddir/install || -e $_moddir/installkernel || -e \
+        $_moddir/module-setup.sh ]] || continue
+        _mod=${_moddir##*/}
+        _mod=${_mod#[0-9][0-9]}
         $_func "$_mod" 1 "$_moddir"
     done
 
@@ -987,8 +991,8 @@ dracut_kernel_post() {
     done
 
     # generate module dependencies for the initrd
-    if [[ -d $initdir/lib/modules/$kernel ]] && \
-        ! depmod -a -b "$initdir" "$kernel"; then
+    if [[ -d $initdir/lib/modules/$kernel ]] \
+        && ! depmod -a -b "$initdir" "$kernel"; then
         dfatal "\"depmod -a $kernel\" failed."
         exit 1
     fi
@@ -1041,15 +1045,15 @@ instmods() {
     if ((_ret != 0)) && [[ -z "$_silent" ]]; then
         derror "FAILED: " \
             "$DRACUT_INSTALL" \
-                ${initdir:+-D "$initdir"} \
-                ${dracutsysrootdir:+-r "$dracutsysrootdir"} \
-                ${loginstall:+-L "$loginstall"} \
-                ${hostonly:+-H} \
-                ${omit_drivers:+-N "$omit_drivers"} \
-                ${srcmods:+--kerneldir "$srcmods"} \
-                ${_optional:+-o} \
-                ${_silent:+--silent} \
-                -m "$@"
+            ${initdir:+-D "$initdir"} \
+            ${dracutsysrootdir:+-r "$dracutsysrootdir"} \
+            ${loginstall:+-L "$loginstall"} \
+            ${hostonly:+-H} \
+            ${omit_drivers:+-N "$omit_drivers"} \
+            ${srcmods:+--kerneldir "$srcmods"} \
+            ${_optional:+-o} \
+            ${_silent:+--silent} \
+            -m "$@"
     fi
 
     [[ "$optional" ]] && return 0
@@ -1073,8 +1077,8 @@ is_qemu_virtualized() {
     # 0 if a virt environment was detected
     # 1 if a virt environment could not be detected
     # 255 if any error was encountered
-    if type -P systemd-detect-virt >/dev/null 2>&1; then
-        if ! vm=$(systemd-detect-virt --vm >/dev/null 2>&1); then
+    if type -P systemd-detect-virt > /dev/null 2>&1; then
+        if ! vm=$(systemd-detect-virt --vm > /dev/null 2>&1); then
             return 255
         fi
         [[ $vm = "qemu" ]] && return 0
@@ -1085,9 +1089,9 @@ is_qemu_virtualized() {
     for i in /sys/class/dmi/id/*_vendor; do
         [[ -f $i ]] || continue
         read -r vendor < "$i"
-        [[  "$vendor" == "QEMU" ]] && return 0
+        [[ "$vendor" == "QEMU" ]] && return 0
         [[ "$vendor" == "Red Hat" ]] && return 0
-        [[  "$vendor" == "Bochs" ]] && return 0
+        [[ "$vendor" == "Bochs" ]] && return 0
     done
     return 1
 }
index 1feec10879dabe77709f90fd7b779e8eda33725d..872a5fbdb7c731e3b3f46b930d40695e425bb37a 100644 (file)
@@ -14,15 +14,15 @@ SKIP="$dracutbasedir/skipcpio"
 
 [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
 
-mount -o ro /boot &>/dev/null || true
+mount -o ro /boot &> /dev/null || true
 
 if [[ -d /efi/loader/entries || -L /efi/loader/entries ]] \
     && [[ $MACHINE_ID ]] \
-    && [[ -d /efi/${MACHINE_ID} || -L /efi/${MACHINE_ID} ]] ; then
+    && [[ -d /efi/${MACHINE_ID} || -L /efi/${MACHINE_ID} ]]; then
     IMG="/efi/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
 elif [[ -d /boot/loader/entries || -L /boot/loader/entries ]] \
     && [[ $MACHINE_ID ]] \
-    && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then
+    && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]]; then
     IMG="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
 else
     IMG="/boot/initramfs-${KERNEL_VERSION}.img"
@@ -32,13 +32,13 @@ cd /run/initramfs
 
 [ -f .need_shutdown -a -f "$IMG" ] || exit 1
 
-if $SKIP "$IMG" | zcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then
+if $SKIP "$IMG" | zcat | cpio -id --no-absolute-filenames --quiet > /dev/null; then
     rm -f -- .need_shutdown
-elif $SKIP "$IMG" | xzcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then
+elif $SKIP "$IMG" | xzcat | cpio -id --no-absolute-filenames --quiet > /dev/null; then
     rm -f -- .need_shutdown
-elif $SKIP "$IMG" | lz4 -d -c | cpio -id --no-absolute-filenames --quiet >/dev/null; then
+elif $SKIP "$IMG" | lz4 -d -c | cpio -id --no-absolute-filenames --quiet > /dev/null; then
     rm -f -- .need_shutdown
-elif $SKIP "$IMG" | zstd -d -c | cpio -id --no-absolute-filenames --quiet >/dev/null; then
+elif $SKIP "$IMG" | zstd -d -c | cpio -id --no-absolute-filenames --quiet > /dev/null; then
     rm -f -- .need_shutdown
 else
     # something failed, so we clean up
@@ -48,7 +48,7 @@ else
 fi
 
 if [[ -d squash ]]; then
-    unsquashfs -no-xattrs -f -d . squash-root.img >/dev/null
+    unsquashfs -no-xattrs -f -d . squash-root.img > /dev/null
     if [ $? -ne 0 ]; then
         echo "Squash module is enabled for this initramfs but failed to unpack squash-root.img" >&2
         rm -f -- /run/initramfs/shutdown
@@ -56,7 +56,7 @@ if [[ -d squash ]]; then
     fi
 fi
 
-if [ -e /etc/selinux/config -a -x /usr/sbin/setfiles ] ; then
+if [ -e /etc/selinux/config -a -x /usr/sbin/setfiles ]; then
     . /etc/selinux/config
     /usr/sbin/setfiles -v -r /run/initramfs /etc/selinux/${SELINUXTYPE}/contexts/files/file_contexts /run/initramfs > /dev/null
 fi
index a0f3cd82b2187d38a2809d7cb7d0ded7b9cfde7a..ad548d0548bc1f86026f402da371e7a3c55cf87f 100755 (executable)
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-
 export __DRACUT_LOGGER__=1
 
-
 ## @brief Logging facility module for dracut both at build- and boot-time.
 #
 # @section intro Introduction
@@ -86,7 +84,6 @@ export __DRACUT_LOGGER__=1
 #
 # @see dlog_init()
 
-
 ## @brief Initializes dracut Logger.
 #
 # @retval 1 if something has gone wrong
@@ -105,7 +102,8 @@ export __DRACUT_LOGGER__=1
 # See file doc comment for details.
 dlog_init() {
     local __oldumask
-    local ret=0; local errmsg
+    local ret=0
+    local errmsg
     [ -z "$stdloglvl" ] && stdloglvl=4
     [ -z "$sysloglvl" ] && sysloglvl=0
     [ -z "$kmsgloglvl" ] && kmsgloglvl=0
@@ -114,23 +112,23 @@ dlog_init() {
 
     if [ -z "$fileloglvl" ]; then
         [ -w "$logfile" ] && fileloglvl=4 || fileloglvl=0
-    elif (( fileloglvl > 0 )); then
+    elif ((fileloglvl > 0)); then
         if [[ $logfile ]]; then
             __oldumask=$(umask)
             umask 0377
-            ! [ -e "$logfile" ] && : >"$logfile"
+            ! [ -e "$logfile" ] && : > "$logfile"
             umask "$__oldumask"
             if [[ -w $logfile ]] && [[ -f $logfile ]]; then
-            # Mark new run in the log file
-                echo >>"$logfile"
-                if command -v date >/dev/null; then
-                    echo "=== $(date) ===" >>"$logfile"
+                # Mark new run in the log file
+                echo >> "$logfile"
+                if command -v date > /dev/null; then
+                    echo "=== $(date) ===" >> "$logfile"
                 else
-                    echo "===============================================" >>"$logfile"
+                    echo "===============================================" >> "$logfile"
                 fi
-                echo >>"$logfile"
+                echo >> "$logfile"
             else
-            # We cannot log to file, so turn this facility off.
+                # We cannot log to file, so turn this facility off.
                 fileloglvl=0
                 ret=1
                 errmsg="'$logfile' is not a writable file"
@@ -138,22 +136,22 @@ dlog_init() {
         fi
     fi
 
-    if (( UID  != 0 )); then
+    if ((UID != 0)); then
         kmsgloglvl=0
         sysloglvl=0
     fi
 
-    if (( sysloglvl > 0 )); then
+    if ((sysloglvl > 0)); then
         if [[ -d /run/systemd/journal ]] \
-            && type -P systemd-cat &>/dev/null \
-            && systemctl --quiet is-active systemd-journald.socket &>/dev/null \
-            && { echo "dracut-$DRACUT_VERSION" | systemd-cat -t 'dracut' &>/dev/null; } ; then
+            && type -P systemd-cat &> /dev/null \
+            && systemctl --quiet is-active systemd-journald.socket &> /dev/null \
+            && { echo "dracut-$DRACUT_VERSION" | systemd-cat -t 'dracut' &> /dev/null; }; then
             readonly _systemdcatfile="$DRACUT_TMPDIR/systemd-cat"
             mkfifo "$_systemdcatfile"
             readonly _dlogfd=15
-            systemd-cat -t 'dracut' --level-prefix=true <"$_systemdcatfile" &
-            exec 15>"$_systemdcatfile"
-        elif ! [[ -S /dev/log ]] && [[ -w /dev/log ]] || ! command -v logger >/dev/null; then
+            systemd-cat -t 'dracut' --level-prefix=true < "$_systemdcatfile" &
+            exec 15> "$_systemdcatfile"
+        elif ! [[ -S /dev/log ]] && [[ -w /dev/log ]] || ! command -v logger > /dev/null; then
             # We cannot log to syslog, so turn this facility off.
             kmsgloglvl=$sysloglvl
             sysloglvl=0
@@ -162,7 +160,7 @@ dlog_init() {
         fi
     fi
 
-    if (( sysloglvl > 0 )) || (( kmsgloglvl > 0 )); then
+    if ((sysloglvl > 0)) || ((kmsgloglvl > 0)); then
         if [ -n "$dracutbasedir" ]; then
             readonly syslogfacility=user
         else
@@ -171,44 +169,44 @@ dlog_init() {
         export syslogfacility
     fi
 
-    local lvl; local maxloglvl_l=0
+    local lvl
+    local maxloglvl_l=0
     for lvl in $stdloglvl $sysloglvl $fileloglvl $kmsgloglvl; do
-        (( lvl > maxloglvl_l )) && maxloglvl_l=$lvl
+        ((lvl > maxloglvl_l)) && maxloglvl_l=$lvl
     done
     readonly maxloglvl=$maxloglvl_l
     export maxloglvl
 
-
-    if (( stdloglvl < 6 )) && ((kmsgloglvl < 6)) && ((fileloglvl < 6)) && ((sysloglvl < 6)); then
+    if ((stdloglvl < 6)) && ((kmsgloglvl < 6)) && ((fileloglvl < 6)) && ((sysloglvl < 6)); then
         unset dtrace
-        dtrace() { :; };
+        dtrace() { :; }
     fi
 
     if ((stdloglvl < 5)) && ((kmsgloglvl < 5)) && ((fileloglvl < 5)) && ((sysloglvl < 5)); then
         unset ddebug
-        ddebug() { :; };
+        ddebug() { :; }
     fi
 
     if ((stdloglvl < 4)) && ((kmsgloglvl < 4)) && ((fileloglvl < 4)) && ((sysloglvl < 4)); then
         unset dinfo
-        dinfo() { :; };
+        dinfo() { :; }
     fi
 
     if ((stdloglvl < 3)) && ((kmsgloglvl < 3)) && ((fileloglvl < 3)) && ((sysloglvl < 3)); then
         unset dwarn
-        dwarn() { :; };
+        dwarn() { :; }
         unset dwarning
-        dwarning() { :; };
+        dwarning() { :; }
     fi
 
     if ((stdloglvl < 2)) && ((kmsgloglvl < 2)) && ((fileloglvl < 2)) && ((sysloglvl < 2)); then
         unset derror
-        derror() { :; };
+        derror() { :; }
     fi
 
     if ((stdloglvl < 1)) && ((kmsgloglvl < 1)) && ((fileloglvl < 1)) && ((sysloglvl < 1)); then
         unset dfatal
-        dfatal() { :; };
+        dfatal() { :; }
     fi
 
     [ -n "$errmsg" ] && derror "$errmsg"
@@ -224,13 +222,13 @@ dlog_init() {
 # @result Echoes first letter of level name.
 _lvl2char() {
     case "$1" in
-        1) echo F;;
-        2) echo E;;
-        3) echo W;;
-        4) echo I;;
-        5) echo D;;
-        6) echo T;;
-        *) return 1;;
+        1) echo F ;;
+        2) echo E ;;
+        3) echo W ;;
+        4) echo I ;;
+        5) echo D ;;
+        6) echo T ;;
+        *) return 1 ;;
     esac
 }
 
@@ -243,13 +241,13 @@ _lvl2char() {
 _lvl2syspri() {
     printf "%s" -- "$syslogfacility."
     case "$1" in
-        1) echo crit;;
-        2) echo error;;
-        3) echo warning;;
-        4) echo info;;
-        5) echo debug;;
-        6) echo debug;;
-        *) return 1;;
+        1) echo crit ;;
+        2) echo error ;;
+        3) echo warning ;;
+        4) echo info ;;
+        5) echo debug ;;
+        6) echo debug ;;
+        *) return 1 ;;
     esac
 }
 
@@ -279,16 +277,16 @@ _dlvl2syslvl() {
     local lvl
 
     case "$1" in
-        1) lvl=2;;
-        2) lvl=3;;
-        3) lvl=4;;
-        4) lvl=6;;
-        5) lvl=7;;
-        6) lvl=7;;
-        *) return 1;;
+        1) lvl=2 ;;
+        2) lvl=3 ;;
+        3) lvl=4 ;;
+        4) lvl=6 ;;
+        5) lvl=7 ;;
+        6) lvl=7 ;;
+        *) return 1 ;;
     esac
 
-    [ "$syslogfacility" = user ] && echo $(( 8 + lvl )) || echo $(( 24 + lvl ))
+    [ "$syslogfacility" = user ] && echo $((8 + lvl)) || echo $((24 + lvl))
 }
 
 ## @brief Prints to stderr and/or writes to file, to syslog and/or /dev/kmsg
@@ -318,14 +316,15 @@ _dlvl2syslvl() {
 #   - @c INFO to @c info
 #   - @c DEBUG and @c TRACE both to @c debug
 _do_dlog() {
-    local lvl="$1"; shift
+    local lvl="$1"
+    shift
     local lvlc=$(_lvl2char "$lvl") || return 0
     local msg="$*"
     local lmsg="$lvlc: $*"
 
-    (( lvl <= stdloglvl )) && printf -- 'dracut: %s\n' "$msg" >&2
+    ((lvl <= stdloglvl)) && printf -- 'dracut: %s\n' "$msg" >&2
 
-    if (( lvl <= sysloglvl )); then
+    if ((lvl <= sysloglvl)); then
         if [[ "$_dlogfd" ]]; then
             printf -- "<%s>%s\n" "$(($(_dlvl2syslvl "$lvl") & 7))" "$msg" >&$_dlogfd
         else
@@ -333,12 +332,12 @@ _do_dlog() {
         fi
     fi
 
-    if (( lvl <= fileloglvl )) && [[ -w "$logfile" ]] && [[ -f "$logfile" ]]; then
-        echo "$lmsg" >>"$logfile"
+    if ((lvl <= fileloglvl)) && [[ -w "$logfile" ]] && [[ -f "$logfile" ]]; then
+        echo "$lmsg" >> "$logfile"
     fi
 
-    (( lvl <= kmsgloglvl )) && \
-        echo "<$(_dlvl2syslvl "$lvl")>dracut[$$] $msg" >/dev/kmsg
+    ((lvl <= kmsgloglvl)) \
+        && echo "<$(_dlvl2syslvl "$lvl")>dracut[$$] $msg" > /dev/kmsg
 }
 
 ## @brief Internal helper function for _do_dlog()
@@ -359,9 +358,9 @@ _do_dlog() {
 # echo "This is a warning" | dwarn
 dlog() {
     [ -z "$maxloglvl" ] && return 0
-    (( $1 <= maxloglvl )) || return 0
+    (($1 <= maxloglvl)) || return 0
 
-    if (( $# > 1 )); then
+    if (($# > 1)); then
         _do_dlog "$@"
     else
         while read -r line || [ -n "$line" ]; do
index f716f7bb77a6cd8d7b2788bf4d13657011a74ed7..c5644bddbf01fd3502c260fb8c1c701c3664b173 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -27,12 +27,12 @@ unset BASH_ENV
 unset GZIP
 
 # Verify bash version, current minimum is 4
-if (( BASH_VERSINFO[0] < 4 )); then
+if ((BASH_VERSINFO[0] < 4)); then
     printf -- 'You need at least Bash 4 to use dracut, sorry.' >&2
     exit 1
 fi
 
-dracut_args=( "$@" )
+dracut_args=("$@")
 readonly dracut_cmd=$(readlink -f "$0")
 
 set -o pipefail
@@ -273,7 +273,7 @@ push_host_devs() {
     local _dev
     for _dev in "$@"; do
         [[ " ${host_devs[*]} " == *" $_dev "* ]] && return
-        host_devs+=( "$_dev" )
+        host_devs+=("$_dev")
     done
 }
 
@@ -295,17 +295,16 @@ read_arg() {
     fi
 }
 
-check_conf_file()
-{
+check_conf_file() {
     if grep -H -e '^[^#]*[+]=\("[^ ]\|.*[^ ]"\)' "$@"; then
         printf '\ndracut: WARNING: <key>+=" <values> ": <values> should have surrounding white spaces!\n' >&2
         printf 'dracut: WARNING: This will lead to unwanted side effects! Please fix the configuration file.\n\n' >&2
     fi
 }
 
-dropindirs_sort()
-{
-    local suffix=$1; shift
+dropindirs_sort() {
+    local suffix=$1
+    shift
     local -a files
     local f d
 
@@ -329,12 +328,11 @@ dropindirs_sort()
     }
 }
 
-rearrange_params()
-{
+rearrange_params() {
     # Workaround -i, --include taking 2 arguments
     newat=()
     for i in "$@"; do
-      if [[ $i == "-i" ]] || [[ $i == "--include" ]]; then
+        if [[ $i == "-i" ]] || [[ $i == "--include" ]]; then
             newat+=("++include") # Replace --include by ++include
         else
             newat+=("$i")
@@ -342,103 +340,106 @@ rearrange_params()
     done
     set -- "${newat[@]}" # Set new $@
 
-    TEMP=$(unset POSIXLY_CORRECT; getopt \
-        -o "a:m:o:d:I:k:c:r:L:fvqlHhMN" \
-        --long kver: \
-        --long add: \
-        --long force-add: \
-        --long add-drivers: \
-        --long force-drivers: \
-        --long omit-drivers: \
-        --long modules: \
-        --long omit: \
-        --long drivers: \
-        --long filesystems: \
-        --long install: \
-        --long install-optional: \
-        --long fwdir: \
-        --long libdirs: \
-        --long fscks: \
-        --long add-fstab: \
-        --long mount: \
-        --long device: \
-        --long add-device: \
-        --long nofscks \
-        --long ro-mnt \
-        --long kmoddir: \
-        --long conf: \
-        --long confdir: \
-        --long tmpdir: \
-        --long sysroot: \
-        --long stdlog: \
-        --long compress: \
-        --long prefix: \
-        --long rebuild: \
-        --long force \
-        --long kernel-only \
-        --long no-kernel \
-        --long print-cmdline \
-        --long kernel-cmdline: \
-        --long strip \
-        --long nostrip \
-        --long hardlink \
-        --long nohardlink \
-        --long noprefix \
-        --long mdadmconf \
-        --long nomdadmconf \
-        --long lvmconf \
-        --long nolvmconf \
-        --long debug \
-        --long profile \
-        --long sshkey: \
-        --long logfile: \
-        --long verbose \
-        --long quiet \
-        --long local \
-        --long hostonly \
-        --long host-only \
-        --long no-hostonly \
-        --long no-host-only \
-        --long hostonly-mode: \
-        --long hostonly-cmdline \
-        --long no-hostonly-cmdline \
-        --long no-hostonly-default-device \
-        --long persistent-policy: \
-        --long fstab \
-        --long help \
-        --long bzip2 \
-        --long lzma \
-        --long xz \
-        --long lzo \
-        --long lz4 \
-        --long zstd \
-        --long no-compress \
-        --long gzip \
-        --long list-modules \
-        --long show-modules \
-        --long keep \
-        --long printsize \
-        --long regenerate-all \
-        --long noimageifnotneeded \
-        --long early-microcode \
-        --long no-early-microcode \
-        --long reproducible \
-        --long no-reproducible \
-        --long loginstall: \
-        --long uefi \
-        --long no-uefi \
-        --long uefi-stub: \
-        --long uefi-splash-image: \
-        --long kernel-image: \
-        --long no-hostonly-i18n \
-        --long hostonly-i18n \
-        --long hostonly-nics: \
-        --long no-machineid \
-        --long version \
-        -- "$@")
+    TEMP=$(
+        unset POSIXLY_CORRECT
+        getopt \
+            -o "a:m:o:d:I:k:c:r:L:fvqlHhMN" \
+            --long kver: \
+            --long add: \
+            --long force-add: \
+            --long add-drivers: \
+            --long force-drivers: \
+            --long omit-drivers: \
+            --long modules: \
+            --long omit: \
+            --long drivers: \
+            --long filesystems: \
+            --long install: \
+            --long install-optional: \
+            --long fwdir: \
+            --long libdirs: \
+            --long fscks: \
+            --long add-fstab: \
+            --long mount: \
+            --long device: \
+            --long add-device: \
+            --long nofscks \
+            --long ro-mnt \
+            --long kmoddir: \
+            --long conf: \
+            --long confdir: \
+            --long tmpdir: \
+            --long sysroot: \
+            --long stdlog: \
+            --long compress: \
+            --long prefix: \
+            --long rebuild: \
+            --long force \
+            --long kernel-only \
+            --long no-kernel \
+            --long print-cmdline \
+            --long kernel-cmdline: \
+            --long strip \
+            --long nostrip \
+            --long hardlink \
+            --long nohardlink \
+            --long noprefix \
+            --long mdadmconf \
+            --long nomdadmconf \
+            --long lvmconf \
+            --long nolvmconf \
+            --long debug \
+            --long profile \
+            --long sshkey: \
+            --long logfile: \
+            --long verbose \
+            --long quiet \
+            --long local \
+            --long hostonly \
+            --long host-only \
+            --long no-hostonly \
+            --long no-host-only \
+            --long hostonly-mode: \
+            --long hostonly-cmdline \
+            --long no-hostonly-cmdline \
+            --long no-hostonly-default-device \
+            --long persistent-policy: \
+            --long fstab \
+            --long help \
+            --long bzip2 \
+            --long lzma \
+            --long xz \
+            --long lzo \
+            --long lz4 \
+            --long zstd \
+            --long no-compress \
+            --long gzip \
+            --long list-modules \
+            --long show-modules \
+            --long keep \
+            --long printsize \
+            --long regenerate-all \
+            --long noimageifnotneeded \
+            --long early-microcode \
+            --long no-early-microcode \
+            --long reproducible \
+            --long no-reproducible \
+            --long loginstall: \
+            --long uefi \
+            --long no-uefi \
+            --long uefi-stub: \
+            --long uefi-splash-image: \
+            --long kernel-image: \
+            --long no-hostonly-i18n \
+            --long hostonly-i18n \
+            --long hostonly-nics: \
+            --long no-machineid \
+            --long version \
+            -- "$@"
+    )
 
     # shellcheck disable=SC2181
-    if (( $? != 0 )); then
+    if (($? != 0)); then
         usage
         exit 1
     fi
@@ -454,20 +455,21 @@ eval set -- "$TEMP"
 # parse command line args to check if '--rebuild' option is present
 unset append_args_l
 unset rebuild_file
-while :
-do
+while :; do
     if [ "$1" == "--" ]; then
-        shift; break
+        shift
+        break
     fi
     if [ "$1" == "--rebuild" ]; then
         append_args_l="yes"
-            rebuild_file="$2"
-            if [ ! -e "$rebuild_file" ]; then
-                echo "Image file '$rebuild_file', for rebuild, does not exist!"
-                exit 1
-            fi
-            abs_rebuild_file=$(readlink -f "$rebuild_file") && rebuild_file="$abs_rebuild_file"
-        shift; continue
+        rebuild_file="$2"
+        if [ ! -e "$rebuild_file" ]; then
+            echo "Image file '$rebuild_file', for rebuild, does not exist!"
+            exit 1
+        fi
+        abs_rebuild_file=$(readlink -f "$rebuild_file") && rebuild_file="$abs_rebuild_file"
+        shift
+        continue
     fi
     shift
 done
@@ -476,7 +478,8 @@ done
 while (($# > 0)); do
     case ${1%%=*} in
         ++include)
-            shift 2;;
+            shift 2
+            ;;
         *)
             if ! [[ ${outfile+x} ]]; then
                 outfile=$1
@@ -484,7 +487,8 @@ while (($# > 0)); do
                 kernel=$1
             else
                 printf "\nUnknown arguments: %s\n\n" "$*" >&2
-                usage; exit 1;
+                usage
+                exit 1
             fi
             ;;
     esac
@@ -520,128 +524,298 @@ eval set -- "$TEMP"
 
 while :; do
     if [[ $1 != "--" ]] && [[ $1 != "--rebuild" ]]; then
-        PARMS_TO_STORE+=" $1";
+        PARMS_TO_STORE+=" $1"
     fi
     case $1 in
-        --kver)        kernel="$2";                           PARMS_TO_STORE+=" '$2'"; shift;;
-        -a|--add)      add_dracutmodules_l+=("$2");           PARMS_TO_STORE+=" '$2'"; shift;;
-        --force-add)   force_add_dracutmodules_l+=("$2");     PARMS_TO_STORE+=" '$2'"; shift;;
-        --add-drivers) add_drivers_l+=("$2");                 PARMS_TO_STORE+=" '$2'"; shift;;
-        --force-drivers) force_drivers_l+=("$2");             PARMS_TO_STORE+=" '$2'"; shift;;
-        --omit-drivers) omit_drivers_l+=("$2");               PARMS_TO_STORE+=" '$2'"; shift;;
-        -m|--modules)  dracutmodules_l+=("$2");               PARMS_TO_STORE+=" '$2'"; shift;;
-        -o|--omit)     omit_dracutmodules_l+=("$2");          PARMS_TO_STORE+=" '$2'"; shift;;
-        -d|--drivers)  drivers_l+=("$2");                     PARMS_TO_STORE+=" '$2'"; shift;;
-        --filesystems) filesystems_l+=("$2");                 PARMS_TO_STORE+=" '$2'"; shift;;
-        -I|--install)  install_items_l+=("$2");               PARMS_TO_STORE+=" '$2'"; shift;;
-        --install-optional) install_optional_items_l+=("$2"); PARMS_TO_STORE+=" '$2'"; shift;;
-        --fwdir)       fw_dir_l+=("$2");                      PARMS_TO_STORE+=" '$2'"; shift;;
-        --libdirs)     libdirs_l+=("$2");                     PARMS_TO_STORE+=" '$2'"; shift;;
-        --fscks)       fscks_l+=("$2");                       PARMS_TO_STORE+=" '$2'"; shift;;
-        --add-fstab)   add_fstab_l+=("$2");                   PARMS_TO_STORE+=" '$2'"; shift;;
-        --mount)       fstab_lines+=("$2");                   PARMS_TO_STORE+=" '$2'"; shift;;
-        --add-device|--device) add_device_l+=("$2");          PARMS_TO_STORE+=" '$2'"; shift;;
-        --kernel-cmdline) kernel_cmdline_l+=("$2");           PARMS_TO_STORE+=" '$2'"; shift;;
-        --nofscks)     nofscks_l="yes";;
-        --ro-mnt)      ro_mnt_l="yes";;
-        -k|--kmoddir)  drivers_dir_l="$2";             PARMS_TO_STORE+=" '$2'"; shift;;
-        -c|--conf)     conffile="$2";                  PARMS_TO_STORE+=" '$2'"; shift;;
-        --confdir)     confdir="$2";                   PARMS_TO_STORE+=" '$2'"; shift;;
-        --tmpdir)      tmpdir_l="$2";                  PARMS_TO_STORE+=" '$2'"; shift;;
-        -r|--sysroot)  sysroot_l="$2";                 PARMS_TO_STORE+=" '$2'"; shift;;
-        -L|--stdlog)   stdloglvl_l="$2";               PARMS_TO_STORE+=" '$2'"; shift;;
-        --compress)    compress_l="$2";                PARMS_TO_STORE+=" '$2'"; shift;;
-        --prefix)      prefix_l="$2";                  PARMS_TO_STORE+=" '$2'"; shift;;
-        --loginstall)  loginstall_l="$2";              PARMS_TO_STORE+=" '$2'"; shift;;
-        --rebuild)     if [[ $rebuild_file == "$outfile" ]]; then
-                           force=yes
-                       fi
-                       shift
-                       ;;
-        -f|--force)    force=yes;;
-        --kernel-only) kernel_only="yes"; no_kernel="no";;
-        --no-kernel)   kernel_only="no"; no_kernel="yes";;
+        --kver)
+            kernel="$2"
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        -a | --add)
+            add_dracutmodules_l+=("$2")
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        --force-add)
+            force_add_dracutmodules_l+=("$2")
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        --add-drivers)
+            add_drivers_l+=("$2")
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        --force-drivers)
+            force_drivers_l+=("$2")
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        --omit-drivers)
+            omit_drivers_l+=("$2")
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        -m | --modules)
+            dracutmodules_l+=("$2")
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        -o | --omit)
+            omit_dracutmodules_l+=("$2")
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        -d | --drivers)
+            drivers_l+=("$2")
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        --filesystems)
+            filesystems_l+=("$2")
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        -I | --install)
+            install_items_l+=("$2")
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        --install-optional)
+            install_optional_items_l+=("$2")
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        --fwdir)
+            fw_dir_l+=("$2")
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        --libdirs)
+            libdirs_l+=("$2")
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        --fscks)
+            fscks_l+=("$2")
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        --add-fstab)
+            add_fstab_l+=("$2")
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        --mount)
+            fstab_lines+=("$2")
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        --add-device | --device)
+            add_device_l+=("$2")
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        --kernel-cmdline)
+            kernel_cmdline_l+=("$2")
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        --nofscks) nofscks_l="yes" ;;
+        --ro-mnt) ro_mnt_l="yes" ;;
+        -k | --kmoddir)
+            drivers_dir_l="$2"
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        -c | --conf)
+            conffile="$2"
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        --confdir)
+            confdir="$2"
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        --tmpdir)
+            tmpdir_l="$2"
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        -r | --sysroot)
+            sysroot_l="$2"
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        -L | --stdlog)
+            stdloglvl_l="$2"
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        --compress)
+            compress_l="$2"
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        --prefix)
+            prefix_l="$2"
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        --loginstall)
+            loginstall_l="$2"
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        --rebuild)
+            if [[ $rebuild_file == "$outfile" ]]; then
+                force=yes
+            fi
+            shift
+            ;;
+        -f | --force) force=yes ;;
+        --kernel-only)
+            kernel_only="yes"
+            no_kernel="no"
+            ;;
+        --no-kernel)
+            kernel_only="no"
+            no_kernel="yes"
+            ;;
         --print-cmdline)
-                       print_cmdline="yes"; hostonly_l="yes"; kernel_only="yes"; no_kernel="yes";;
+            print_cmdline="yes"
+            hostonly_l="yes"
+            kernel_only="yes"
+            no_kernel="yes"
+            ;;
         --early-microcode)
-                       early_microcode_l="yes";;
+            early_microcode_l="yes"
+            ;;
         --no-early-microcode)
-                       early_microcode_l="no";;
-        --strip)       do_strip_l="yes";;
-        --nostrip)     do_strip_l="no";;
-        --hardlink)    do_hardlink_l="yes";;
-        --nohardlink)  do_hardlink_l="no";;
-        --noprefix)    prefix_l="/";;
-        --mdadmconf)   mdadmconf_l="yes";;
-        --nomdadmconf) mdadmconf_l="no";;
-        --lvmconf)     lvmconf_l="yes";;
-        --nolvmconf)   lvmconf_l="no";;
-        --debug)       debug="yes";;
-        --profile)     profile="yes";;
-        --sshkey)      sshkey="$2";                    PARMS_TO_STORE+=" '$2'"; shift;;
-        --logfile)     logfile_l="$2"; shift;;
-        -v|--verbose)  ((verbosity_mod_l++));;
-        -q|--quiet)    ((verbosity_mod_l--));;
-        -l|--local)
-                       allowlocal="yes"
-                       [[ -f "$(readlink -f "${0%/*}")/dracut-init.sh" ]] \
-                           && dracutbasedir="$(readlink -f "${0%/*}")"
-                       ;;
-        -H|--hostonly|--host-only)
-                       hostonly_l="yes" ;;
-        -N|--no-hostonly|--no-host-only)
-                       hostonly_l="no" ;;
+            early_microcode_l="no"
+            ;;
+        --strip) do_strip_l="yes" ;;
+        --nostrip) do_strip_l="no" ;;
+        --hardlink) do_hardlink_l="yes" ;;
+        --nohardlink) do_hardlink_l="no" ;;
+        --noprefix) prefix_l="/" ;;
+        --mdadmconf) mdadmconf_l="yes" ;;
+        --nomdadmconf) mdadmconf_l="no" ;;
+        --lvmconf) lvmconf_l="yes" ;;
+        --nolvmconf) lvmconf_l="no" ;;
+        --debug) debug="yes" ;;
+        --profile) profile="yes" ;;
+        --sshkey)
+            sshkey="$2"
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        --logfile)
+            logfile_l="$2"
+            shift
+            ;;
+        -v | --verbose) ((verbosity_mod_l++)) ;;
+        -q | --quiet) ((verbosity_mod_l--)) ;;
+        -l | --local)
+            allowlocal="yes"
+            [[ -f "$(readlink -f "${0%/*}")/dracut-init.sh" ]] \
+                && dracutbasedir="$(readlink -f "${0%/*}")"
+            ;;
+        -H | --hostonly | --host-only)
+            hostonly_l="yes"
+            ;;
+        -N | --no-hostonly | --no-host-only)
+            hostonly_l="no"
+            ;;
         --hostonly-mode)
-                       hostonly_mode_l="$2";           PARMS_TO_STORE+=" '$2'"; shift;;
+            hostonly_mode_l="$2"
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
         --hostonly-cmdline)
-                       hostonly_cmdline_l="yes" ;;
+            hostonly_cmdline_l="yes"
+            ;;
         --hostonly-i18n)
-                       i18n_install_all_l="no" ;;
+            i18n_install_all_l="no"
+            ;;
         --hostonly-nics)
-                       hostonly_nics_l+=("$2");           PARMS_TO_STORE+=" '$2'"; shift;;
+            hostonly_nics_l+=("$2")
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
         --no-hostonly-i18n)
-                       i18n_install_all_l="yes" ;;
+            i18n_install_all_l="yes"
+            ;;
         --no-hostonly-cmdline)
-                       hostonly_cmdline_l="no" ;;
+            hostonly_cmdline_l="no"
+            ;;
         --no-hostonly-default-device)
-                       hostonly_default_device="no" ;;
+            hostonly_default_device="no"
+            ;;
         --persistent-policy)
-                       persistent_policy_l="$2";       PARMS_TO_STORE+=" '$2'"; shift;;
-        --fstab)       use_fstab_l="yes" ;;
-        -h|--help)     long_usage; exit 1 ;;
-        --bzip2)       compress_l="bzip2";;
-        --lzma)        compress_l="lzma";;
-        --xz)          compress_l="xz";;
-        --lzo)         compress_l="lzo";;
-        --lz4)         compress_l="lz4";;
-        --zstd)        compress_l="zstd";;
-        --no-compress) _no_compress_l="cat";;
-        --gzip)        compress_l="gzip";;
-        --list-modules) do_list="yes";;
-        -M|--show-modules)
-                       show_modules_l="yes"
-                       ;;
-        --keep)        keep="yes";;
-        --printsize)   printsize="yes";;
-        --regenerate-all) regenerate_all="yes";;
-        --noimageifnotneeded) noimageifnotneeded="yes";;
-        --reproducible) reproducible_l="yes";;
-        --no-reproducible) reproducible_l="no";;
-        --uefi)        uefi_l="yes";;
-        --no-uefi)     uefi_l="no";;
+            persistent_policy_l="$2"
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
+        --fstab) use_fstab_l="yes" ;;
+        -h | --help)
+            long_usage
+            exit 1
+            ;;
+        --bzip2) compress_l="bzip2" ;;
+        --lzma) compress_l="lzma" ;;
+        --xz) compress_l="xz" ;;
+        --lzo) compress_l="lzo" ;;
+        --lz4) compress_l="lz4" ;;
+        --zstd) compress_l="zstd" ;;
+        --no-compress) _no_compress_l="cat" ;;
+        --gzip) compress_l="gzip" ;;
+        --list-modules) do_list="yes" ;;
+        -M | --show-modules)
+            show_modules_l="yes"
+            ;;
+        --keep) keep="yes" ;;
+        --printsize) printsize="yes" ;;
+        --regenerate-all) regenerate_all="yes" ;;
+        --noimageifnotneeded) noimageifnotneeded="yes" ;;
+        --reproducible) reproducible_l="yes" ;;
+        --no-reproducible) reproducible_l="no" ;;
+        --uefi) uefi_l="yes" ;;
+        --no-uefi) uefi_l="no" ;;
         --uefi-stub)
-                       uefi_stub_l="$2";               PARMS_TO_STORE+=" '$2'"; shift;;
+            uefi_stub_l="$2"
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
         --uefi-splash-image)
-                       uefi_splash_image_l="$2";       PARMS_TO_STORE+=" '$2'"; shift;;
+            uefi_splash_image_l="$2"
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
         --kernel-image)
-                       kernel_image_l="$2";            PARMS_TO_STORE+=" '$2'"; shift;;
+            kernel_image_l="$2"
+            PARMS_TO_STORE+=" '$2'"
+            shift
+            ;;
         --no-machineid)
-                       machine_id_l="no";;
-        --version)     long_version; exit 1 ;;
-        --) shift; break;;
+            machine_id_l="no"
+            ;;
+        --version)
+            long_version
+            exit 1
+            ;;
+        --)
+            shift
+            break
+            ;;
 
-        *)  # should not even reach this point
-            printf "\n!Unknown option: '%s'\n\n" "$1" >&2; usage; exit 1;;
+        *) # should not even reach this point
+            printf "\n!Unknown option: '%s'\n\n" "$1" >&2
+            usage
+            exit 1
+            ;;
     esac
     shift
 done
@@ -673,17 +847,17 @@ if [[ $regenerate_all == "yes" ]]; then
         exit 1
     fi
 
-    ((len=${#dracut_args[@]}))
-    for ((i=0; i < len; i++)); do
-        [[ ${dracut_args[$i]} == "--regenerate-all" ]] && \
-            unset "dracut_args[$i]"
+    ((len = ${#dracut_args[@]}))
+    for ((i = 0; i < len; i++)); do
+        [[ ${dracut_args[$i]} == "--regenerate-all" ]] \
+            && unset "dracut_args[$i]"
     done
 
     cd "$dracutsysrootdir"/lib/modules || exit 1
     for i in *; do
         [[ -f $i/modules.dep ]] || [[ -f $i/modules.dep.bin ]] || continue
         "$dracut_cmd" --kver="$i" "${dracut_args[@]}"
-        ((ret+=$?))
+        ((ret += $?))
     done
     exit "$ret"
 fi
@@ -703,12 +877,12 @@ unset GREP_OPTIONS
 export DRACUT_LOG_LEVEL=warning
 [[ $debug ]] && {
     export DRACUT_LOG_LEVEL=debug
-    export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): ';
+    export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): '
     set -x
 }
 
 [[ $profile ]] && {
-    export PS4='+ $(date "+%s.%N") ${BASH_SOURCE}@${LINENO}: ';
+    export PS4='+ $(date "+%s.%N") ${BASH_SOURCE}@${LINENO}: '
     set -x
     debug=yes
 }
@@ -754,7 +928,7 @@ 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
@@ -764,20 +938,20 @@ unset NPATH
 export SYSTEMCTL=${SYSTEMCTL:-systemctl}
 
 # these options add to the stuff in the config file
-(( ${#add_dracutmodules_l[@]} )) && add_dracutmodules+=" ${add_dracutmodules_l[*]} "
-(( ${#force_add_dracutmodules_l[@]} )) && force_add_dracutmodules+=" ${force_add_dracutmodules_l[*]} "
-(( ${#fscks_l[@]} )) && fscks+=" ${fscks_l[*]} "
-(( ${#add_fstab_l[@]} )) && add_fstab+=" ${add_fstab_l[*]} "
-(( ${#install_items_l[@]} )) && install_items+=" ${install_items_l[*]} "
-(( ${#install_optional_items_l[@]} )) && install_optional_items+=" ${install_optional_items_l[*]} "
-(( ${#hostonly_nics_l[@]} )) && hostonly_nics+=" ${hostonly_nics_l[*]} "
+((${#add_dracutmodules_l[@]})) && add_dracutmodules+=" ${add_dracutmodules_l[*]} "
+((${#force_add_dracutmodules_l[@]})) && force_add_dracutmodules+=" ${force_add_dracutmodules_l[*]} "
+((${#fscks_l[@]})) && fscks+=" ${fscks_l[*]} "
+((${#add_fstab_l[@]})) && add_fstab+=" ${add_fstab_l[*]} "
+((${#install_items_l[@]})) && install_items+=" ${install_items_l[*]} "
+((${#install_optional_items_l[@]})) && install_optional_items+=" ${install_optional_items_l[*]} "
+((${#hostonly_nics_l[@]})) && hostonly_nics+=" ${hostonly_nics_l[*]} "
 
 # these options override the stuff in the config file
-(( ${#dracutmodules_l[@]} )) && dracutmodules="${dracutmodules_l[*]}"
-(( ${#omit_dracutmodules_l[@]} )) && omit_dracutmodules="${omit_dracutmodules_l[*]}"
-(( ${#filesystems_l[@]} )) && filesystems="${filesystems_l[*]}"
-(( ${#fw_dir_l[@]} )) && fw_dir="${fw_dir_l[*]}"
-(( ${#libdirs_l[@]} ))&& libdirs="${libdirs_l[*]}"
+((${#dracutmodules_l[@]})) && dracutmodules="${dracutmodules_l[*]}"
+((${#omit_dracutmodules_l[@]})) && omit_dracutmodules="${omit_dracutmodules_l[*]}"
+((${#filesystems_l[@]})) && filesystems="${filesystems_l[*]}"
+((${#fw_dir_l[@]})) && fw_dir="${fw_dir_l[*]}"
+((${#libdirs_l[@]})) && libdirs="${libdirs_l[*]}"
 
 [[ $stdloglvl_l ]] && stdloglvl=$stdloglvl_l
 [[ ! $stdloglvl ]] && stdloglvl=4
@@ -816,8 +990,8 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
 [[ $early_microcode_l ]] && early_microcode=$early_microcode_l
 [[ $early_microcode ]] || early_microcode=yes
 [[ $early_microcode_image_dir ]] || early_microcode_image_dir=('/boot')
-[[ $early_microcode_image_name ]] || \
-    early_microcode_image_name=('intel-uc.img' 'intel-ucode.img' 'amd-uc.img' 'amd-ucode.img' 'early_ucode.cpio' 'microcode.cpio')
+[[ $early_microcode_image_name ]] \
+    || early_microcode_image_name=('intel-uc.img' 'intel-ucode.img' 'amd-uc.img' 'amd-ucode.img' 'early_ucode.cpio' 'microcode.cpio')
 [[ $logfile_l ]] && logfile="$logfile_l"
 [[ $reproducible_l ]] && reproducible="$reproducible_l"
 [[ $loginstall_l ]] && loginstall="$loginstall_l"
@@ -839,15 +1013,15 @@ if ! [[ $outfile ]]; then
             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
 
         BUILD_ID=$(cat "$dracutsysrootdir"/etc/os-release "$dracutsysrootdir"/usr/lib/os-release \
-                       | while read -r line || [[ $line ]]; do \
-                       [[ $line =~ BUILD_ID\=* ]] && eval "$line" && echo "$BUILD_ID" && break; \
-                   done)
+            | while read -r line || [[ $line ]]; do
+                [[ $line =~ BUILD_ID\=* ]] && eval "$line" && echo "$BUILD_ID" && break
+            done)
         if [[ -z $dracutsysrootdir ]]; then
             if [[ -d /efi ]] && mountpoint -q /efi; then
                 efidir=/efi/EFI
@@ -868,7 +1042,7 @@ if ! [[ $outfile ]]; then
     else
         if [[ -e $dracutsysrootdir/boot/vmlinuz-$kernel ]]; then
             outfile="/boot/initramfs-$kernel.img"
-        elif [[ $MACHINE_ID ]] && { [[ -d $dracutsysrootdir/boot/${MACHINE_ID} ]] || [[ -L $dracutsysrootdir/boot/${MACHINE_ID} ]] ;}; then
+        elif [[ $MACHINE_ID ]] && { [[ -d $dracutsysrootdir/boot/${MACHINE_ID} ]] || [[ -L $dracutsysrootdir/boot/${MACHINE_ID} ]]}; then
             outfile="$dracutsysrootdir/boot/${MACHINE_ID}/$kernel/initrd"
         else
             outfile="$dracutsysrootdir/boot/initramfs-$kernel.img"
@@ -910,8 +1084,9 @@ fi
 
 case $hostonly_mode in
     '')
-        [[ $hostonly ]] && hostonly_mode="sloppy" ;;
-    sloppy|strict)
+        [[ $hostonly ]] && hostonly_mode="sloppy"
+        ;;
+    sloppy | strict)
         if [[ ! $hostonly ]]; then
             unset hostonly_mode
         fi
@@ -919,12 +1094,13 @@ case $hostonly_mode in
     *)
         printf "%s\n" "dracut: Invalid hostonly mode '$hostonly_mode'." >&2
         exit 1
+        ;;
 esac
 
 [[ $reproducible == yes ]] && DRACUT_REPRODUCIBLE=1
 
 case "${drivers_dir}" in
-    ''|*lib/modules/${kernel}|*lib/modules/${kernel}/) ;;
+    '' | *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,"
@@ -972,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
@@ -1010,7 +1186,7 @@ fi
 
 if ! [[ $print_cmdline ]]; then
     inst "$DRACUT_TESTBIN"
-    if ! $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${dracutsysrootdir:+-r "$dracutsysrootdir"} -R "$DRACUT_TESTBIN" &>/dev/null; then
+    if ! $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${dracutsysrootdir:+-r "$dracutsysrootdir"} -R "$DRACUT_TESTBIN" &> /dev/null; then
         unset DRACUT_RESOLVE_LAZY
         export DRACUT_RESOLVE_DEPS=1
     fi
@@ -1020,19 +1196,19 @@ fi
 dracutfunctions=$dracutbasedir/dracut-functions.sh
 export dracutfunctions
 
-(( ${#drivers_l[@]} )) && drivers="${drivers_l[*]}"
+((${#drivers_l[@]})) && drivers="${drivers_l[*]}"
 drivers=${drivers/-/_}
 
-(( ${#add_drivers_l[@]} )) && add_drivers+=" ${add_drivers_l[*]} "
+((${#add_drivers_l[@]})) && add_drivers+=" ${add_drivers_l[*]} "
 add_drivers=${add_drivers/-/_}
 
-(( ${#force_drivers_l[@]} )) && force_drivers+=" ${force_drivers_l[*]} "
+((${#force_drivers_l[@]})) && force_drivers+=" ${force_drivers_l[*]} "
 force_drivers=${force_drivers/-/_}
 
-(( ${#omit_drivers_l[@]} )) && omit_drivers+=" ${omit_drivers_l[*]} "
+((${#omit_drivers_l[@]})) && omit_drivers+=" ${omit_drivers_l[*]} "
 omit_drivers=${omit_drivers/-/_}
 
-(( ${#kernel_cmdline_l[@]} )) && kernel_cmdline+=" ${kernel_cmdline_l[*]} "
+((${#kernel_cmdline_l[@]})) && kernel_cmdline+=" ${kernel_cmdline_l[*]} "
 
 omit_drivers_corrected=""
 for d in $omit_drivers; do
@@ -1044,19 +1220,19 @@ omit_drivers="${omit_drivers_corrected%|}"
 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]}\""
-        #" keep vim happy
+for ((i = 0; i < ${#dracut_args[@]}; i++)); do
+    [[ "${dracut_args[$i]}" == *\ * ]] \
+        && dracut_args[$i]="\"${dracut_args[$i]}\""
+    #" keep vim happy
 done
 
 dinfo "Executing: $dracut_cmd ${dracut_args[*]}"
 
 [[ $do_list = yes ]] && {
     for mod in "$dracutbasedir"/modules.d/*; do
-        [[ -d $mod ]] || continue;
-        [[ -e $mod/install || -e $mod/installkernel || \
-            -e $mod/module-setup.sh ]] || continue
+        [[ -d $mod ]] || continue
+        [[ -e $mod/install || -e $mod/installkernel || -e \
+        $mod/module-setup.sh ]] || continue
         printf "%s\n" "${mod##*/??}"
     done
     exit 0
@@ -1064,14 +1240,13 @@ dinfo "Executing: $dracut_cmd ${dracut_args[*]}"
 
 # This is kinda legacy -- eventually it should go away.
 case $dracutmodules in
-    ""|auto) dracutmodules="all" ;;
+    "" | auto) dracutmodules="all" ;;
 esac
 
 abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
 
-
 [[ -d $dracutsysrootdir$systemdutildir ]] \
-    || systemdutildir=$(pkg-config systemd --variable=systemdutildir 2>/dev/null)
+    || systemdutildir=$(pkg-config systemd --variable=systemdutildir 2> /dev/null)
 
 if ! [[ -d $dracutsysrootdir$systemdutildir ]]; then
     [[ -e $dracutsysrootdir/lib/systemd/systemd-udevd ]] && systemdutildir=/lib/systemd
@@ -1079,7 +1254,7 @@ if ! [[ -d $dracutsysrootdir$systemdutildir ]]; then
 fi
 
 [[ -d $dracutsysrootdir$systemdutilconfdir ]] \
-    || systemdutilconfdir=$(pkg-config systemd --variable=systemdutilconfdir 2>/dev/null)
+    || systemdutilconfdir=$(pkg-config systemd --variable=systemdutilconfdir 2> /dev/null)
 
 [[ -d $dracutsysrootdir$systemdutilconfdir ]] || systemdutilconfdir=/etc/systemd
 
@@ -1091,17 +1266,17 @@ if [[ $no_kernel != yes ]] && [[ -d $srcmods ]]; then
         else
             dwarn "$srcmods/modules.dep is missing. Did you run depmod?"
         fi
-    elif ! ( command -v gzip &>/dev/null && command -v xz &>/dev/null); then
+    elif ! (command -v gzip &> /dev/null && command -v xz &> /dev/null); then
         read -r _mod < "$srcmods"/modules.dep
         _mod=${_mod%%:*}
         if [[ -f $srcmods/"$_mod" ]]; then
             # Check, if kernel modules are compressed, and if we can uncompress them
             case "$_mod" in
-                *.ko.gz) kcompress=gzip;;
-                *.ko.xz) kcompress=xz;;
+                *.ko.gz) kcompress=gzip ;;
+                *.ko.xz) kcompress=xz ;;
             esac
             if [[ $kcompress ]]; then
-                if ! command -v "$kcompress" &>/dev/null; then
+                if ! command -v "$kcompress" &> /dev/null; then
                     dfatal "Kernel modules are compressed with $kcompress, but $kcompress is not available."
                     exit 1
                 fi
@@ -1139,16 +1314,18 @@ if [[ ! $print_cmdline ]]; then
     fi
 
     if [[ $uefi = yes ]]; then
-        if ! command -v objcopy &>/dev/null; then
+        if ! command -v objcopy &> /dev/null; then
             dfatal "Need 'objcopy' to create a UEFI executable"
             exit 1
         fi
         unset EFI_MACHINE_TYPE_NAME
         case $(uname -m) in
             x86_64)
-                EFI_MACHINE_TYPE_NAME=x64;;
+                EFI_MACHINE_TYPE_NAME=x64
+                ;;
             i?86)
-                EFI_MACHINE_TYPE_NAME=ia32;;
+                EFI_MACHINE_TYPE_NAME=ia32
+                ;;
             *)
                 dfatal "Architecture '$(uname -m)' not supported to create a UEFI executable"
                 exit 1
@@ -1158,7 +1335,7 @@ if [[ ! $print_cmdline ]]; then
         if ! [[ -s $uefi_stub ]]; then
             for uefi_stub in \
                 "$dracutsysrootdir${systemdutildir}/boot/efi/linux${EFI_MACHINE_TYPE_NAME}.efi.stub" \
-                    "$dracutsysrootdir/usr/lib/gummiboot/linux${EFI_MACHINE_TYPE_NAME}.efi.stub"; do
+                "$dracutsysrootdir/usr/lib/gummiboot/linux${EFI_MACHINE_TYPE_NAME}.efi.stub"; do
                 [[ -s $uefi_stub ]] || continue
                 break
             done
@@ -1181,7 +1358,7 @@ 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
@@ -1202,7 +1379,7 @@ if [[ $early_microcode = yes ]]; then
     fi
     # Do not complain on non-x86 architectures as it makes no sense
     case $(uname -m) in
-        x86_64|i?86)
+        x86_64 | i?86)
             [[ $early_microcode != yes ]] \
                 && dwarn "Disabling early microcode, because kernel does not support it. CONFIG_MICROCODE_[AMD|INTEL]!=y"
             ;;
@@ -1215,7 +1392,7 @@ chmod 755 "$initdir"
 
 if [[ $hostonly ]]; then
     for i in /sys /proc /run /dev; do
-        if ! findmnt --target "$i" &>/dev/null; then
+        if ! findmnt --target "$i" &> /dev/null; then
             dwarning "Turning off host-only mode: '$i' is not mounted!"
             unset hostonly
         fi
@@ -1264,7 +1441,7 @@ for dev in $add_device; do
     push_host_devs "$dev"
 done
 
-if (( ${#add_device_l[@]} )); then
+if ((${#add_device_l[@]})); then
     add_device+=" ${add_device_l[*]} "
     push_host_devs "${add_device_l[@]}"
 fi
@@ -1287,11 +1464,9 @@ if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
         "/usr/lib64" \
         "/boot" \
         "/boot/efi" \
-        "/boot/zipl" \
-        ;
-    do
+        "/boot/zipl"; do
         mp=$(readlink -f "$dracutsysrootdir$mp")
-        mountpoint "$mp" >/dev/null 2>&1 || continue
+        mountpoint "$mp" > /dev/null 2>&1 || continue
         _dev=$(find_block_device "$mp")
         _bdev=$(readlink -f "/dev/block/$_dev")
         [[ -b $_bdev ]] && _dev=$_bdev
@@ -1402,159 +1577,159 @@ for dev in "${!host_fs_types[@]}"; do
 done
 
 [[ -d $dracutsysrootdir$dbus ]] \
-         || dbus=$(pkg-config dbus --variable=dbus 2>/dev/null)
+    || dbus=$(pkg-config dbus --variable=dbus 2> /dev/null)
 
 [[ -d $dracutsysrootdir$dbus ]] || dbus=/usr/share/dbus-1
 
 [[ -d $dracutsysrootdir$dbusconfdir ]] \
-         || dbusconfdir=$(pkg-config dbus --variable=dbusconfdir 2>/dev/null)
+    || dbusconfdir=$(pkg-config dbus --variable=dbusconfdir 2> /dev/null)
 
 [[ -d $dracutsysrootdir$dbusconfdir ]] || dbusconfdir=/etc/dbus-1
 
 [[ -d $dracutsysrootdir$dbusinterfaces ]] \
-          || dbusinterfaces=$(pkg-config dbus --variable=dbusinterfaces 2>/dev/null)
+    || dbusinterfaces=$(pkg-config dbus --variable=dbusinterfaces 2> /dev/null)
 
 [[ -d $dracutsysrootdir$dbusinterfaces ]] || dbusinterfaces=${dbus}/interfaces
 
 [[ -d $dracutsysrootdir$dbusinterfacesconfdir ]] \
-          || dbusinterfacesconfdir=$(pkg-config dbus --variable=dbusinterfacesconfdir 2>/dev/null)
+    || dbusinterfacesconfdir=$(pkg-config dbus --variable=dbusinterfacesconfdir 2> /dev/null)
 
 [[ -d $dracutsysrootdir$dbusinterfacesconfdir ]] || dbusinterfacesconfdir=${dbusconfdir}/interfaces
 
 [[ -d $dracutsysrootdir$dbusservices ]] \
-          || dbusservices=$(pkg-config dbus --variable=dbusservices 2>/dev/null)
+    || dbusservices=$(pkg-config dbus --variable=dbusservices 2> /dev/null)
 
 [[ -d $dracutsysrootdir$dbusservices ]] || dbusservices=${dbus}/services
 
 [[ -d $dracutsysrootdir$dbusservicesconfdir ]] \
-          || dbusservicesconfdir=$(pkg-config dbus --variable=dbusservicesconfdir 2>/dev/null)
+    || dbusservicesconfdir=$(pkg-config dbus --variable=dbusservicesconfdir 2> /dev/null)
 
 [[ -d $dracutsysrootdir$dbusservicesconfdir ]] || dbusservicesconfdir=${dbusconfdir}/services
 
 [[ -d $dracutsysrootdir$dbussession ]] \
-          || dbussession=$(pkg-config dbus --variable=dbussession 2>/dev/null)
+    || dbussession=$(pkg-config dbus --variable=dbussession 2> /dev/null)
 
 [[ -d $dracutsysrootdir$dbussession ]] || dbussession=${dbus}/session.d
 
 [[ -d $dracutsysrootdir$dbussessionconfdir ]] \
-          || dbussessionconfdir=$(pkg-config dbus --variable=dbussessionconfdir 2>/dev/null)
+    || dbussessionconfdir=$(pkg-config dbus --variable=dbussessionconfdir 2> /dev/null)
 
 [[ -d $dracutsysrootdir$dbussessionconfdir ]] || dbussessionconfdir=${dbusconfdir}/session.d
 
 [[ -d $dracutsysrootdir$dbussystem ]] \
-          || dbussystem=$(pkg-config dbus --variable=dbussystem 2>/dev/null)
+    || dbussystem=$(pkg-config dbus --variable=dbussystem 2> /dev/null)
 
 [[ -d $dracutsysrootdir$dbussystem ]] || dbussystem=${dbus}/system.d
 
 [[ -d $dracutsysrootdir$dbussystemconfdir ]] \
-          || dbussystemconfdir=$(pkg-config dbus --variable=dbussystemconfdir 2>/dev/null)
+    || dbussystemconfdir=$(pkg-config dbus --variable=dbussystemconfdir 2> /dev/null)
 
 [[ -d $dracutsysrootdir$dbussystemconfdir ]] || dbussystemconfdir=${dbusconfdir}/system.d
 
 [[ -d $dracutsysrootdir$dbussystemservices ]] \
-          || dbussystemservices=$(pkg-config dbus --variable=dbussystemservices 2>/dev/null)
+    || dbussystemservices=$(pkg-config dbus --variable=dbussystemservices 2> /dev/null)
 
 [[ -d $dracutsysrootdir$dbussystemservices ]] || dbussystemservices=${dbus}/system-services
 
 [[ -d $dracutsysrootdir$dbussystemservicesconfdir ]] \
-           || dbussystemservicesconfdir=$(pkg-config dbus --variable=dbussystemservicesconfdir 2>/dev/null)
+    || dbussystemservicesconfdir=$(pkg-config dbus --variable=dbussystemservicesconfdir 2> /dev/null)
 
 [[ -d $dracutsysrootdir$dbussystemservicesconfdir ]] || dbussystemservicesconfdir=${dbusconfdir}/system-services
 
 [[ -d $dracutsysrootdir$udevdir ]] \
-    || udevdir="$(pkg-config udev --variable=udevdir 2>/dev/null)"
+    || udevdir="$(pkg-config udev --variable=udevdir 2> /dev/null)"
 if ! [[ -d $dracutsysrootdir$udevdir ]]; then
     [[ -e $dracutsysrootdir/lib/udev/ata_id ]] && udevdir=/lib/udev
     [[ -e $dracutsysrootdir/usr/lib/udev/ata_id ]] && udevdir=/usr/lib/udev
 fi
 
 [[ -d $dracutsysrootdir$sysctl ]] \
-      || sysctl=$(pkg-config systemd --variable=sysctl 2>/dev/null)
+    || sysctl=$(pkg-config systemd --variable=sysctl 2> /dev/null)
 
 [[ -d $dracutsysrootdir$sysctl ]] || sysctl=/usr/lib/sysctl.d
 
 [[ -d $dracutsysrootdir$sysctlconfdir ]] \
-      || sysctlconfdir=$(pkg-config systemd --variable=sysctlconfdir 2>/dev/null)
+    || sysctlconfdir=$(pkg-config systemd --variable=sysctlconfdir 2> /dev/null)
 
 [[ -d $dracutsysrootdir$sysctlconfdir ]] || sysctlconfdir=/etc/sysctl.d
 
 [[ -d $dracutsysrootdir$environment ]] \
-      || environment=$(pkg-config systemd --variable=environment 2>/dev/null)
+    || environment=$(pkg-config systemd --variable=environment 2> /dev/null)
 
 [[ -d $dracutsysrootdir$environment ]] || environment=/usr/lib/environment.d
 
 [[ -d $dracutsysrootdir$environmentconfdir ]] \
-      || environmentconfdir=$(pkg-config systemd --variable=environmentconfdir 2>/dev/null)
+    || environmentconfdir=$(pkg-config systemd --variable=environmentconfdir 2> /dev/null)
 
 [[ -d $dracutsysrootdir$environmentconfdir ]] || environmentconfdir=/etc/environment.d
 
 [[ -d $dracutsysrootdir$systemdcatalog ]] \
-      || systemdcatalog=$(pkg-config systemd --variable=systemdcatalog 2>/dev/null)
+    || systemdcatalog=$(pkg-config systemd --variable=systemdcatalog 2> /dev/null)
 
 [[ -d $dracutsysrootdir$systemdcatalog ]] || systemdcatalog=${systemdutildir}/catalog
 
 [[ -d $dracutsysrootdir$systemdnetwork ]] \
-      || systemdnetwork=$(pkg-config systemd --variable=systemdnetwork 2>/dev/null)
+    || systemdnetwork=$(pkg-config systemd --variable=systemdnetwork 2> /dev/null)
 
 [[ -d $dracutsysrootdir$systemdnetwork ]] || systemdnetwork=${systemdutildir}/network
 
 [[ -d $dracutsysrootdir$systemdnetworkconfdir ]] \
-       || systemdnetworkconfdir=$(pkg-config systemd --variable=systemdnetworkconfdir 2>/dev/null)
+    || systemdnetworkconfdir=$(pkg-config systemd --variable=systemdnetworkconfdir 2> /dev/null)
 
 [[ -d $dracutsysrootdir$systemdnetworkconfdir ]] || systemdnetworkconfdir=${systemdsystemconfdir}/network
 
 [[ -d $dracutsysrootdir$systemdntpunits ]] \
-      || systemdntpunits=$(pkg-config systemd --variable=systemdntpunits 2>/dev/null)
+    || systemdntpunits=$(pkg-config systemd --variable=systemdntpunits 2> /dev/null)
 
 [[ -d $dracutsysrootdir$systemdntpunits ]] || systemdntpunits=${systemdutildir}/ntp-units.d
 
 [[ -d $dracutsysrootdir$systemdntpunitsconfdir ]] \
-      || systemdntpunitsconfdir=$(pkg-config systemd --variable=systemdntpunitsconfdir 2>/dev/null)
+    || systemdntpunitsconfdir=$(pkg-config systemd --variable=systemdntpunitsconfdir 2> /dev/null)
 
 [[ -d $dracutsysrootdir$systemdntpunitsconfdir ]] || systemdntpunitsconfdir=${systemdsystemconfdir}/ntp-units.d
 
 [[ -d $dracutsysrootdir$systemdportable ]] \
-      || systemdportable=$(pkg-config systemd --variable=systemdportable 2>/dev/null)
+    || systemdportable=$(pkg-config systemd --variable=systemdportable 2> /dev/null)
 
 [[ -d $dracutsysrootdir$systemdportable ]] || systemdportable=${systemdutildir}/portable
 
 [[ -d $dracutsysrootdir$systemdportableconfdir ]] \
-      || systemdportableconfdir=$(pkg-config systemd --variable=systemdportableconfdir 2>/dev/null)
+    || systemdportableconfdir=$(pkg-config systemd --variable=systemdportableconfdir 2> /dev/null)
 
 [[ -d "$dracutsysrootdir$systemdportableconfdir" ]] || systemdportableconfdir=${systemdsystemconfdir}/portable
 
 [[ -d $dracutsysrootdir$systemdsystemunitdir ]] \
-    || systemdsystemunitdir=$(pkg-config systemd --variable=systemdsystemunitdir 2>/dev/null)
+    || systemdsystemunitdir=$(pkg-config systemd --variable=systemdsystemunitdir 2> /dev/null)
 
 [[ -d "$dracutsysrootdir$systemdsystemunitdir" ]] || systemdsystemunitdir=${systemdutildir}/system
 
 [[ -d $dracutsysrootdir$systemduser ]] \
-      || systemduser=$(pkg-config systemd --variable=systemduser 2>/dev/null)
+    || systemduser=$(pkg-config systemd --variable=systemduser 2> /dev/null)
 
 [[ -d $dracutsysrootdir$systemduser ]] || systemduser=${systemdutildir}/user
 
 [[ -d $dracutsysrootdir$systemduserconfdir ]] \
-       || systemduserconfdir=$(pkg-config systemd --variable=systemduserconfdir 2>/dev/null)
+    || systemduserconfdir=$(pkg-config systemd --variable=systemduserconfdir 2> /dev/null)
 
 [[ -d $dracutsysrootdir$systemduserconfdir ]] || systemduserconfdir=${systemdsystemconfdir}/user
 
 [[ -d $dracutsysrootdir$systemdsystemconfdir ]] \
-    || systemdsystemconfdir=$(pkg-config systemd --variable=systemdsystemconfdir 2>/dev/null)
+    || systemdsystemconfdir=$(pkg-config systemd --variable=systemdsystemconfdir 2> /dev/null)
 
 [[ -d $dracutsysrootdir$systemdsystemconfdir ]] || systemdsystemconfdir=/etc/systemd/system
 
 [[ -d $dracutsysrootdir$sysusers ]] \
-       || sysusers=$(pkg-config systemd --variable=sysusers 2>/dev/null)
+    || sysusers=$(pkg-config systemd --variable=sysusers 2> /dev/null)
 
 [[ -d $dracutsysrootdir$sysusers ]] || sysusers=/usr/lib/sysusers.d
 
 [[ -d $dracutsysrootdir$sysusersconfdir ]] \
-       || sysusersconfdir=$(pkg-config systemd --variable=sysusersconfdir 2>/dev/null)
+    || sysusersconfdir=$(pkg-config systemd --variable=sysusersconfdir 2> /dev/null)
 
 [[ -d $dracutsysrootdir$sysusersconfdir ]] || sysusersconfdir=/etc/sysusers.d
 
 [[ -d $dracutsysrootdir$tmpfilesdir ]] \
-    || tmpfilesdir=$(pkg-config systemd --variable=tmpfilesdir 2>/dev/null)
+    || tmpfilesdir=$(pkg-config systemd --variable=tmpfilesdir 2> /dev/null)
 
 if ! [[ -d $dracutsysrootdir$tmpfilesdir ]]; then
     [[ -d $dracutsysrootdir/lib/tmpfiles.d ]] && tmpfilesdir=/lib/tmpfiles.d
@@ -1587,8 +1762,7 @@ for_each_module_dir check_mount
 
 dracut_module_included "fips" && export DRACUT_FIPS_MODE=1
 
-do_print_cmdline()
-{
+do_print_cmdline() {
     local -A _mods_to_print
     for i in $modules_loaded $mods_to_load; do
         _mods_to_print[$i]=1
@@ -1596,7 +1770,8 @@ do_print_cmdline()
 
     # source our modules.
     for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
-        _d_mod=${moddir##*/}; _d_mod=${_d_mod#[0-9][0-9]}
+        _d_mod=${moddir##*/}
+        _d_mod=${_d_mod#[0-9][0-9]}
         [[ ${_mods_to_print[$_d_mod]} ]] || continue
         module_cmdline "$_d_mod" "$moddir"
     done
@@ -1614,7 +1789,7 @@ fi
 [[ $prefix ]] && mkdir -m 0755 -p "${initdir}${prefix}"
 
 # shellcheck disable=SC2174
-[[ -h $dracutsysrootdir/lib ]] || mkdir -m 0755 -p "${initdir}${prefix}/lib"
+[[ -L $dracutsysrootdir/lib ]] || mkdir -m 0755 -p "${initdir}${prefix}/lib"
 [[ $prefix ]] && ln -sfn "${prefix#/}/lib" "$initdir/lib"
 
 if [[ $prefix ]]; then
@@ -1680,7 +1855,8 @@ _isize=0 #initramfs size
 modules_loaded=" "
 # source our modules.
 for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
-    _d_mod=${moddir##*/}; _d_mod=${_d_mod#[0-9][0-9]}
+    _d_mod=${moddir##*/}
+    _d_mod=${_d_mod#[0-9][0-9]}
     [[ "$mods_to_load" == *\ $_d_mod\ * ]] || continue
     if [[ $show_modules = yes ]]; then
         printf "%s\n" "$_d_mod"
@@ -1706,7 +1882,10 @@ for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
 
     #print the module install size
     if [ -n "$printsize" ]; then
-        _isize_new=$(du -sk "${initdir}" | { read -r a _; echo -n "$a"; })
+        _isize_new=$(du -sk "${initdir}" | {
+            read -r a _
+            echo -n "$a"
+        })
         _isize_delta=$((_isize_new - _isize))
         printf "%s\n" "$_d_mod install size: ${_isize_delta}k"
         _isize=$_isize_new
@@ -1732,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
@@ -1741,7 +1920,7 @@ if [[ $no_kernel != yes ]]; then
         hostonly='' instmods -c $force_drivers
         rm -f "$initdir"/etc/cmdline.d/20-force_driver.conf
         for mod in $force_drivers; do
-            echo "rd.driver.pre=$mod" >>"$initdir"/etc/cmdline.d/20-force_drivers.conf
+            echo "rd.driver.pre=$mod" >> "$initdir"/etc/cmdline.d/20-force_drivers.conf
         done
     fi
     if [[ $filesystems ]]; then
@@ -1754,8 +1933,8 @@ if [[ $no_kernel != yes ]]; then
     dinfo "*** Installing kernel module dependencies done ***"
 
     if [[ $noimageifnotneeded == yes ]] && [[ $hostonly ]]; then
-        if [[ ! -f "$initdir/lib/dracut/need-initqueue" ]] && \
-            [[ -f ${initdir}/lib/modules/$kernel/modules.dep && ! -s ${initdir}/lib/modules/$kernel/modules.dep ]]; then
+        if [[ ! -f "$initdir/lib/dracut/need-initqueue" ]] \
+            && [[ -f ${initdir}/lib/modules/$kernel/modules.dep && ! -s ${initdir}/lib/modules/$kernel/modules.dep ]]; then
             for i in "${initdir}"/etc/cmdline.d/*.conf; do
                 # We need no initramfs image and do not generate one.
                 [[ $i == "${initdir}/etc/cmdline.d/*.conf" ]] && exit 0
@@ -1767,9 +1946,9 @@ fi
 if [[ $kernel_only != yes ]]; then
     # FIXME: handle legacy item split
     # shellcheck disable=SC2068
-    (( ${#install_items[@]} > 0 )) && inst_multiple ${install_items[@]}
+    ((${#install_items[@]} > 0)) && inst_multiple ${install_items[@]}
     # shellcheck disable=SC2068
-    (( ${#install_optional_items[@]} > 0 )) && inst_multiple -o ${install_optional_items[@]}
+    ((${#install_optional_items[@]} > 0)) && inst_multiple -o ${install_optional_items[@]}
 
     if [[ $kernel_cmdline ]] && [[ $uefi != yes ]]; then
         printf "%s\n" "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"
@@ -1813,7 +1992,7 @@ if [[ $kernel_only != yes ]]; then
     if [[ $DRACUT_RESOLVE_LAZY ]] && [[ $DRACUT_INSTALL ]]; then
         dinfo "*** Resolving executable dependencies ***"
         find "$initdir" -type f -perm /0111 -not -path '*.ko' -print0 \
-        | xargs -r -0 "$DRACUT_INSTALL" ${initdir:+-D "$initdir"} ${dracutsysrootdir:+-r "$dracutsysrootdir"} -R ${DRACUT_FIPS_MODE:+-f} --
+            | xargs -r -0 "$DRACUT_INSTALL" ${initdir:+-D "$initdir"} ${dracutsysrootdir:+-r "$dracutsysrootdir"} -R ${DRACUT_FIPS_MODE:+-f} --
         dinfo "*** Resolving executable dependencies done ***"
     fi
 
@@ -1822,7 +2001,7 @@ if [[ $kernel_only != yes ]]; then
     export DRACUT_RESOLVE_DEPS=1
 fi
 
-for ((i=0; i < ${#include_src[@]}; i++)); do
+for ((i = 0; i < ${#include_src[@]}; i++)); do
     src="${include_src[$i]}"
     target="${include_target[$i]}"
     if [[ $src && $target ]]; then
@@ -1836,7 +2015,7 @@ 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" || -h "$objectname" ]] || continue
+                [[ -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/}
@@ -1858,21 +2037,21 @@ 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)
     [ -z "$strip_cmd" ] && strip_cmd="strip"
 
     for p in $strip_cmd xargs find; do
-        if ! type -P $p >/dev/null; then
+        if ! type -P $p > /dev/null; then
             dinfo "Could not find '$p'. Not stripping the initramfs."
             do_strip=no
         fi
@@ -1881,7 +2060,7 @@ fi
 
 # cleanup empty ldconfig_paths directories
 for d in $(ldconfig_paths); do
-    rmdir -p --ignore-fail-on-non-empty "$initdir/$d" >/dev/null 2>&1
+    rmdir -p --ignore-fail-on-non-empty "$initdir/$d" > /dev/null 2>&1
 done
 
 if [[ $early_microcode = yes ]]; then
@@ -1925,9 +2104,9 @@ if [[ $early_microcode = yes ]]; then
             if cd "$early_cpio_dir/d"; then
                 for _ucodedir in "${early_microcode_image_dir[@]}"; do
                     for _ucodename in "${early_microcode_image_name[@]}"; do
-                        [[ -e "$_ucodedir/$_ucodename" ]] && \
-                        cpio --extract --file "$_ucodedir/$_ucodename" --quiet \
-                             "kernel/x86/microcode/${ucode_dest[$idx]}"
+                        [[ -e "$_ucodedir/$_ucodename" ]] \
+                            && cpio --extract --file "$_ucodedir/$_ucodename" --quiet \
+                                "kernel/x86/microcode/${ucode_dest[$idx]}"
                         if [[ -e "$_dest_dir/${ucode_dest[$idx]}" ]]; then
                             dinfo "*** Using microcode found in '$_ucodedir/$_ucodename' ***"
                             create_early_cpio="yes"
@@ -1952,16 +2131,16 @@ if [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]]; then
 fi
 
 dinfo "*** Store current command line parameters ***"
-if ! ( echo "$PARMS_TO_STORE" > "$initdir"/lib/dracut/build-parameter.txt ); then
+if ! (echo "$PARMS_TO_STORE" > "$initdir"/lib/dracut/build-parameter.txt); then
     dfatal "Could not store the current command line parameters"
     exit 1
 fi
 
-if [[ $hostonly_cmdline == "yes" ]] ; then
+if [[ $hostonly_cmdline == "yes" ]]; then
     unset _stored_cmdline
-    if [[ -d $initdir/etc/cmdline.d ]];then
+    if [[ -d $initdir/etc/cmdline.d ]]; then
         dinfo "Stored kernel commandline:"
-        for conf in "$initdir"/etc/cmdline.d/*.conf ; do
+        for conf in "$initdir"/etc/cmdline.d/*.conf; do
             [ -e "$conf" ] || continue
             dinfo "$(< "$conf")"
             _stored_cmdline=1
@@ -1984,13 +2163,13 @@ if [[ $kernel_only != yes ]]; then
 
     # FIPS workaround for Fedora/RHEL: libcrypto needs libssl when FIPS is enabled
     if [[ $DRACUT_FIPS_MODE ]]; then
-      for _dir in $libdirs; do
-          for _f in "$dracutsysrootdir$_dir/libcrypto.so"*; do
-              [[ -e "$_f" ]] || continue
-              inst_libdir_file -o "libssl.so*"
-              break 2
-          done
-      done
+        for _dir in $libdirs; do
+            for _f in "$dracutsysrootdir$_dir/libcrypto.so"*; do
+                [[ -e "$_f" ]] || continue
+                inst_libdir_file -o "libssl.so*"
+                break 2
+            done
+        done
     fi
 fi
 
@@ -2020,14 +2199,14 @@ if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
     dinfo "*** Stripping files ***"
     find "$initdir" -type f \
         -executable -not -path '*/lib/modules/*.ko' -print0 \
-        | xargs -r -0 $strip_cmd -g -p 2>/dev/null
+        | xargs -r -0 $strip_cmd -g -p 2> /dev/null
 
     # strip kernel modules, but do not touch signed modules
     find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
         | while read -r -d $'\0' f || [ -n "$f" ]; do
-        SIG=$(tail -c 28 "$f" | tr -d '\000')
-        [[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
-    done | xargs -r -0 $strip_cmd -g -p
+            SIG=$(tail -c 28 "$f" | tr -d '\000')
+            [[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
+        done | xargs -r -0 $strip_cmd -g -p
     dinfo "*** Stripping files done ***"
 fi
 
@@ -2036,7 +2215,7 @@ if dracut_module_included "squash"; then
     declare squash_compress_arg
     # shellcheck disable=SC2086
     if [[ $compress ]]; then
-        if ! mksquashfs /dev/null "$DRACUT_TMPDIR"/.squash-test.img -no-progress -comp $compress &>/dev/null; then
+        if ! mksquashfs /dev/null "$DRACUT_TMPDIR"/.squash-test.img -no-progress -comp $compress &> /dev/null; then
             dwarn "mksquashfs doesn't support compressor '$compress', failing back to default compressor."
         else
             squash_compress_arg="$compress"
@@ -2047,8 +2226,8 @@ if dracut_module_included "squash"; then
     if ! mksquashfs "$squash_dir" "$squash_img" \
         -no-xattrs -no-exports -noappend -no-recovery -always-use-fragments \
         -no-progress ${squash_compress_arg:+-comp $squash_compress_arg} 1> /dev/null; then
-            dfatal "dracut: Failed making squash image"
-            exit 1
+        dfatal "dracut: Failed making squash image"
+        exit 1
     fi
 
     rm -rf "$squash_dir"
@@ -2088,11 +2267,12 @@ if [[ $create_early_cpio = yes ]]; then
 
     # The microcode blob is _before_ the initramfs blob, not after
     if ! (
-            umask 077; cd "$early_cpio_dir/d"
-            find . -print0 | sort -z \
-                | cpio ${CPIO_REPRODUCIBLE:+--reproducible} --null \
-                    ${cpio_owner:+-R "$cpio_owner"} -H newc -o --quiet > "${DRACUT_TMPDIR}/initramfs.img"
-        ); then
+        umask 077
+        cd "$early_cpio_dir/d"
+        find . -print0 | sort -z \
+            | cpio ${CPIO_REPRODUCIBLE:+--reproducible} --null \
+                ${cpio_owner:+-R "$cpio_owner"} -H newc -o --quiet > "${DRACUT_TMPDIR}/initramfs.img"
+    ); then
         dfatal "dracut: creation of $outfile failed"
         exit 1
     fi
@@ -2101,19 +2281,19 @@ fi
 if ! [[ $compress ]]; then
     # check all known compressors, if none specified
     for i in $DRACUT_COMPRESS_PIGZ $DRACUT_COMPRESS_GZIP $DRACUT_COMPRESS_LZ4 $DRACUT_COMPRESS_LZOP $ $DRACUT_COMPRESS_ZSTD $DRACUT_COMPRESS_LZMA $DRACUT_COMPRESS_XZ $DRACUT_COMPRESS_LBZIP2 $OMPRESS_BZIP2 $DRACUT_COMPRESS_CAT; do
-        command -v "$i" &>/dev/null || continue
+        command -v "$i" &> /dev/null || continue
         compress="$i"
         break
     done
     if [[ $compress = cat ]]; then
-            printf "%s\n" "dracut: no compression tool available. Initramfs image is going to be big." >&2
+        printf "%s\n" "dracut: no compression tool available. Initramfs image is going to be big." >&2
     fi
 fi
 
 # choose the right arguments for the compressor
 case $compress in
-    bzip2|lbzip2)
-        if [[ "$compress" =  lbzip2 ]] || command -v "$DRACUT_COMPRESS_LBZIP2" &>/dev/null; then
+    bzip2 | lbzip2)
+        if [[ "$compress" = lbzip2 ]] || command -v "$DRACUT_COMPRESS_LBZIP2" &> /dev/null; then
             compress="$DRACUT_COMPRESS_LBZIP2 -9"
         else
             compress="$DRACUT_COMPRESS_BZIP2 -9"
@@ -2125,42 +2305,43 @@ case $compress in
     xz)
         compress="$DRACUT_COMPRESS_XZ --check=crc32 --lzma2=dict=1MiB -T0"
         ;;
-    gzip|pigz)
-        if [[ "$compress" = pigz ]] || command -v "$DRACUT_COMPRESS_PIGZ" &>/dev/null; then
+    gzip | pigz)
+        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
+        elif command -v gzip &> /dev/null && $DRACUT_COMPRESS_GZIP --help 2>&1 | grep -q rsyncable; then
             compress="$DRACUT_COMPRESS_GZIP -n -9 --rsyncable"
         else
             compress="$DRACUT_COMPRESS_GZIP -n -9"
         fi
         ;;
-    lzo|lzop)
+    lzo | lzop)
         compress="$DRACUT_COMPRESS_LZOP -9"
         ;;
     lz4)
         compress="$DRACUT_COMPRESS_LZ4 -l -9"
         ;;
     zstd)
-       compress="$DRACUT_COMPRESS_ZSTD -15 -q -T0"
-       ;;
+        compress="$DRACUT_COMPRESS_ZSTD -15 -q -T0"
+        ;;
 esac
 
 if ! (
-        umask 077; cd "$initdir"
-        find . -print0 | sort -z \
-            | cpio ${CPIO_REPRODUCIBLE:+--reproducible} --null ${cpio_owner:+-R "$cpio_owner"} -H newc -o --quiet \
-            | $compress >> "${DRACUT_TMPDIR}/initramfs.img"
-    ); then
+    umask 077
+    cd "$initdir"
+    find . -print0 | sort -z \
+        | cpio ${CPIO_REPRODUCIBLE:+--reproducible} --null ${cpio_owner:+-R "$cpio_owner"} -H newc -o --quiet \
+        | $compress >> "${DRACUT_TMPDIR}/initramfs.img"
+); then
     dfatal "dracut: creation of $outfile failed"
     exit 1
 fi
 
 # shellcheck disable=SC2154
-if (( maxloglvl >= 5 )) && (( verbosity_mod_l >= 0 )); then
+if ((maxloglvl >= 5)) && ((verbosity_mod_l >= 0)); then
     if [[ $allowlocal ]]; then
-        "$dracutbasedir/lsinitrd.sh" "${DRACUT_TMPDIR}/initramfs.img"| ddebug
+        "$dracutbasedir/lsinitrd.sh" "${DRACUT_TMPDIR}/initramfs.img" | ddebug
     else
-        lsinitrd "${DRACUT_TMPDIR}/initramfs.img"| ddebug
+        lsinitrd "${DRACUT_TMPDIR}/initramfs.img" | ddebug
     fi
 fi
 
@@ -2169,8 +2350,8 @@ umask 077
 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
-        for conf in "$initdir"/etc/cmdline.d/*.conf ; do
+    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
@@ -2194,17 +2375,17 @@ if [[ $uefi = yes ]]; then
     fi
 
     if objcopy \
-           ${uefi_osrelease:+--add-section .osrel="$uefi_osrelease" --change-section-vma .osrel=0x20000} \
-           ${uefi_cmdline:+--add-section .cmdline="$uefi_cmdline" --change-section-vma .cmdline=0x30000} \
-           ${uefi_splash_image:+--add-section .splash="$uefi_splash_image" --change-section-vma .splash=0x40000} \
-           --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 \
+        ${uefi_osrelease:+--add-section .osrel="$uefi_osrelease" --change-section-vma .osrel=0x20000} \
+        ${uefi_cmdline:+--add-section .cmdline="$uefi_cmdline" --change-section-vma .cmdline=0x30000} \
+        ${uefi_splash_image:+--add-section .splash="$uefi_splash_image" --change-section-vma .splash=0x40000} \
+        --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 sbsign \
-                    --key "${uefi_secureboot_key}" \
-                    --cert "${uefi_secureboot_cert}" \
-                    --output "$outfile" "${uefi_outdir}/linux.efi"; then
+                --key "${uefi_secureboot_key}" \
+                --cert "${uefi_secureboot_cert}" \
+                --output "$outfile" "${uefi_outdir}/linux.efi"; then
                 dinfo "*** Creating signed UEFI image file '$outfile' done ***"
             else
                 dfatal "*** Creating signed UEFI image file '$outfile' failed ***"
@@ -2230,7 +2411,7 @@ else
     fi
 fi
 
-command -v restorecon &>/dev/null && restorecon -- "$outfile"
+command -v restorecon &> /dev/null && restorecon -- "$outfile"
 
 btrfs_uuid() {
     btrfs filesystem show "$1" | sed -n '1s/^.*uuid: //p'
@@ -2258,11 +2439,14 @@ freeze_ok_for_fstype() {
     fstype=$(stat -f -c %T -- "$outfile")
     case $fstype in
         msdos)
-            return 1;;
+            return 1
+            ;;
         btrfs)
-            freeze_ok_for_btrfs "$outfile";;
+            freeze_ok_for_btrfs "$outfile"
+            ;;
         *)
-            return 0;;
+            return 0
+            ;;
     esac
 }
 
@@ -2280,7 +2464,7 @@ if [[ -d $dracutsysrootdir/run/systemd/system ]]; then
     # use fsfreeze only if we're not writing to /
     if [[ "$(stat -c %m -- "$outfile")" != "/" ]] && freeze_ok_for_fstype "$outfile"; then
         FSFROZEN="$(dirname "$outfile")"
-        if ! (fsfreeze -f "${FSFROZEN}" 2>/dev/null && fsfreeze -u "${FSFROZEN}" 2>/dev/null); then
+        if ! (fsfreeze -f "${FSFROZEN}" 2> /dev/null && fsfreeze -u "${FSFROZEN}" 2> /dev/null); then
             dinfo "dracut: warning: could not fsfreeze $(dirname "$outfile")"
         fi
         unset FSFROZEN
index f9c51affe7087907b513669a8dffe1d67504680b..e6f933787f498a13551c5ee147abc692fc0262b0 100755 (executable)
@@ -3,8 +3,8 @@
 set -e
 
 if [[ -z "$DRACUT_TMPDIR" ]]; then
-       echo "DRACUT_TMPDIR is unset, exiting"
-       exit 0
+    echo "DRACUT_TMPDIR is unset, exiting"
+    exit 0
 fi
 
 # We have to unset "prefix" as dracut uses it to move files around.
@@ -21,11 +21,11 @@ export DRACUT_INSTALL_PATH="/usr/sbin:/usr/bin:/sbin:/bin"
 export PLYMOUTH_SYSROOT=$D
 
 export \
-       systemdutildir systemdsystemunitdir systemdsystemconfdir udevdir \
-       DRACUT_ARCH DRACUT_TESTBIN DRACUT_LDD DRACUT_LDCONFIG DRACUT_INSTALL \
-       DRACUT_COMPRESS_GZIP DRACUT_COMPRESS_BZIP2 DRACUT_COMPRESS_LZMA \
-       PLYMOUTH_LDD PLYMOUTH_LDD_PATH PLYMOUTH_PLUGIN_PATH \
-       PLYMOUTH_THEME_NAME PLYMOUTH_THEME
+    systemdutildir systemdsystemunitdir systemdsystemconfdir udevdir \
+    DRACUT_ARCH DRACUT_TESTBIN DRACUT_LDD DRACUT_LDCONFIG DRACUT_INSTALL \
+    DRACUT_COMPRESS_GZIP DRACUT_COMPRESS_BZIP2 DRACUT_COMPRESS_LZMA \
+    PLYMOUTH_LDD PLYMOUTH_LDD_PATH PLYMOUTH_PLUGIN_PATH \
+    PLYMOUTH_THEME_NAME PLYMOUTH_THEME
 
 # List environment for debugging
 echo ROOTFS-POSTINST-ENVIRONMENT
index 4f2a4c2b3c398a633fc7eb426da054136a90921c..6f82d8d585ece7e32c780d73086091957cb221ac 100755 (executable)
@@ -35,11 +35,11 @@ else
     cd test
 
     time LOGTEE_TIMEOUT_MS=590000 make \
-         enable_documentation=$make_docs \
-         KVERSION="$(rpm -qa kernel --qf '%{VERSION}-%{RELEASE}.%{ARCH}\n' | sort -rn | head -1)" \
-         DRACUT_NO_XATTR=1 \
-         TEST_RUN_ID="$RUN_ID" \
-         ${TESTS:+TESTS="$TESTS"} \
-         -k V=1 \
-         check
+        enable_documentation=$make_docs \
+        KVERSION="$(rpm -qa kernel --qf '%{VERSION}-%{RELEASE}.%{ARCH}\n' | sort -rn | head -1)" \
+        DRACUT_NO_XATTR=1 \
+        TEST_RUN_ID="$RUN_ID" \
+        ${TESTS:+TESTS="$TESTS"} \
+        -k V=1 \
+        check
 fi
index 395ed5f5f3e988e67f3fb4c3a3a1eff546b9f9dc..f5c946599237bd75bd80b13a921921a11b57c4d3 100755 (executable)
@@ -20,11 +20,11 @@ else
     cd test
 
     time sudo LOGTEE_TIMEOUT_MS=300000 make \
-         enable_documentation=$make_docs \
-         KVERSION=$(rpm -qa kernel --qf '%{VERSION}-%{RELEASE}.%{ARCH}\n' | sort -rn | head -1) \
-         DRACUT_NO_XATTR=1 \
-         TEST_RUN_ID=$RUN_ID \
-         ${TESTS:+TESTS="$TESTS"} \
-         -k V=2 \
-         check
+        enable_documentation=$make_docs \
+        KVERSION=$(rpm -qa kernel --qf '%{VERSION}-%{RELEASE}.%{ARCH}\n' | sort -rn | head -1) \
+        DRACUT_NO_XATTR=1 \
+        TEST_RUN_ID=$RUN_ID \
+        ${TESTS:+TESTS="$TESTS"} \
+        -k V=2 \
+        check
 fi
index a86da8683e395066435a34925f95f59081d39fa3..77ecff76a86b3625c1d3a105de195bbb3a9a922e 100644 (file)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
-__contains_word () {
-        local word="$1"; shift
-        for w in "$@"; do [[ $w = "$word" ]] && return 0; done
-        return 1
+__contains_word() {
+    local word="$1"
+    shift
+    for w in "$@"; do [[ $w = "$word" ]] && return 0; done
+    return 1
 }
 
 _lsinitrd() {
-        local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
-        local -A OPTS=(
-            [STANDALONE]='-s --size -h --help'
-            [ARG]='-f --file -k --kver'
-        )
+    local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD - 1]}
+    local -A OPTS=(
+        [STANDALONE]='-s --size -h --help'
+        [ARG]='-f --file -k --kver'
+    )
 
-        # shellcheck disable=SC2086
-        if __contains_word "$prev" ${OPTS[ARG]}; then
-                case $prev in
-                        --file|-f)
-                                comps=$(compgen -f -- "$cur")
-                                compopt -o filenames
-                        ;;
-                        --kver|-k)
-                                comps=$(cd /lib/modules || return 1; echo [0-9]*)
-                        ;;
-                        *)
-                                return 0
-                        ;;
-                esac
-                # shellcheck disable=SC2207
-                # shellcheck disable=SC2016
-                COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
+    # shellcheck disable=SC2086
+    if __contains_word "$prev" ${OPTS[ARG]}; then
+        case $prev in
+            --file | -f)
+                comps=$(compgen -f -- "$cur")
+                compopt -o filenames
+                ;;
+            --kver | -k)
+                comps=$(
+                    cd /lib/modules || return 1
+                    echo [0-9]*
+                )
+                ;;
+            *)
                 return 0
-        fi
-
-        if [[ $cur = -* ]]; then
-                # shellcheck disable=SC2207
-                # shellcheck disable=SC2016
-                COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
-                return 0
-        fi
+                ;;
+        esac
+        # shellcheck disable=SC2207
+        # shellcheck disable=SC2016
+        COMPREPLY=($(compgen -W '$comps' -- "$cur"))
+        return 0
+    fi
 
-        # shellcheck disable=SC2034
-        comps=$(compgen -f -- "$cur")
-        compopt -o filenames
+    if [[ $cur = -* ]]; then
         # shellcheck disable=SC2207
         # shellcheck disable=SC2016
-        COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
+        COMPREPLY=($(compgen -W '${OPTS[*]}' -- "$cur"))
         return 0
+    fi
+
+    # shellcheck disable=SC2034
+    comps=$(compgen -f -- "$cur")
+    compopt -o filenames
+    # shellcheck disable=SC2207
+    # shellcheck disable=SC2016
+    COMPREPLY=($(compgen -W '$comps' -- "$cur"))
+    return 0
 }
 
 complete -F _lsinitrd lsinitrd
index 66cfa9bc36db4a805afc21d8012d451bc95f1c3c..d6362db1006f4dcd368e5fb99684d8cf72c14828 100755 (executable)
@@ -17,8 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
-usage()
-{
+usage() {
     {
         echo "Usage: ${0##*/} [options] [<initramfs file> [<filename> [<filename> [...] ]]]"
         echo "Usage: ${0##*/} [options] -k <kernel version>"
@@ -38,7 +37,6 @@ usage()
     } >&2
 }
 
-
 [[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
 
 sorted=0
@@ -59,7 +57,7 @@ TEMP=$(getopt \
     --long verbose \
     -- "$@")
 
-if (( $? != 0 )); then
+if (($? != 0)); then
     usage
     exit 1
 fi
@@ -68,16 +66,31 @@ eval set -- "$TEMP"
 
 while (($# > 0)); do
     case $1 in
-        -k|--kver)     KERNEL_VERSION="$2"; shift;;
-        -f|--file)     filenames[${2#/}]=1; shift;;
-        -s|--size)     sorted=1;;
-        -h|--help)     usage; exit 0;;
-        -m|--mod)      modules=1;;
-        -v|--verbose)  verbose="--verbose";;
-        --unpack)      unpack=1;;
-        --unpackearly) unpackearly=1;;
-        --)            shift;break;;
-        *)             usage; exit 1;;
+        -k | --kver)
+            KERNEL_VERSION="$2"
+            shift
+            ;;
+        -f | --file)
+            filenames[${2#/}]=1
+            shift
+            ;;
+        -s | --size) sorted=1 ;;
+        -h | --help)
+            usage
+            exit 0
+            ;;
+        -m | --mod) modules=1 ;;
+        -v | --verbose) verbose="--verbose" ;;
+        --unpack) unpack=1 ;;
+        --unpackearly) unpackearly=1 ;;
+        --)
+            shift
+            break
+            ;;
+        *)
+            usage
+            exit 1
+            ;;
     esac
     shift
 done
@@ -99,11 +112,11 @@ else
 
     if [[ -d /efi/loader/entries || -L /efi/loader/entries ]] \
         && [[ $MACHINE_ID ]] \
-        && [[ -d /efi/${MACHINE_ID} || -L /efi/${MACHINE_ID} ]] ; then
+        && [[ -d /efi/${MACHINE_ID} || -L /efi/${MACHINE_ID} ]]; then
         image="/efi/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
     elif [[ -d /boot/loader/entries || -L /boot/loader/entries ]] \
         && [[ $MACHINE_ID ]] \
-        && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then
+        && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]]; then
         image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
     else
         image="/boot/initramfs-${KERNEL_VERSION}.img"
@@ -112,7 +125,7 @@ fi
 
 shift
 while (($# > 0)); do
-    filenames[${1#/}]=1;
+    filenames[${1#/}]=1
     shift
 done
 
@@ -134,46 +147,42 @@ dracutlibdirs() {
     done
 }
 
-extract_files()
-{
-    (( ${#filenames[@]} == 1 )) && nofileinfo=1
+extract_files() {
+    ((${#filenames[@]} == 1)) && nofileinfo=1
     for f in "${!filenames[@]}"; do
         [[ $nofileinfo ]] || echo "initramfs:/$f"
         [[ $nofileinfo ]] || echo "========================================================================"
-        $CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout "$f" 2>/dev/null
-        ((ret+=$?))
+        $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout "$f" 2> /dev/null
+        ((ret += $?))
         [[ $nofileinfo ]] || echo "========================================================================"
         [[ $nofileinfo ]] || echo
     done
 }
 
-list_modules()
-{
+list_modules() {
     echo "dracut modules:"
     $CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
-        $(dracutlibdirs modules.txt) 2>/dev/null
-    ((ret+=$?))
+        $(dracutlibdirs modules.txt) 2> /dev/null
+    ((ret += $?))
 }
 
-list_files()
-{
+list_files() {
     echo "========================================================================"
     if [ "$sorted" -eq 1 ]; then
-        $CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --list | sort -n -k5
+        $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --list | sort -n -k5
     else
-        $CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --list | sort -k9
+        $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --list | sort -k9
     fi
-    ((ret+=$?))
+    ((ret += $?))
     echo "========================================================================"
 }
 
-list_squash_content()
-{
+list_squash_content() {
     SQUASH_IMG="squash-root.img"
     SQUASH_TMPFILE="$TMPDIR/initrd.root.sqsh"
 
-    $CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout -- \
-        $SQUASH_IMG > "$SQUASH_TMPFILE" 2>/dev/null
+    $CAT "$image" 2> /dev/null | cpio --extract --verbose --quiet --to-stdout -- \
+        $SQUASH_IMG > "$SQUASH_TMPFILE" 2> /dev/null
     if [[ -s $SQUASH_TMPFILE ]]; then
         echo "Squashed content ($SQUASH_IMG):"
         echo "========================================================================"
@@ -182,22 +191,24 @@ list_squash_content()
     fi
 }
 
-unpack_files()
-{
-    if (( ${#filenames[@]} > 0 )); then
+unpack_files() {
+    if ((${#filenames[@]} > 0)); then
         for f in "${!filenames[@]}"; do
-            $CAT "$image" 2>/dev/null | cpio -id --quiet $verbose $f
-            ((ret+=$?))
+            $CAT "$image" 2> /dev/null | cpio -id --quiet $verbose $f
+            ((ret += $?))
         done
     else
-        $CAT "$image" 2>/dev/null | cpio -id --quiet $verbose
-        ((ret+=$?))
+        $CAT "$image" 2> /dev/null | cpio -id --quiet $verbose
+        ((ret += $?))
     fi
 }
 
 read -N 2 bin < "$image"
 if [ "$bin" = "MZ" ]; then
-    command -v objcopy > /dev/null || { echo "Need 'objcopy' to unpack an UEFI executable."; exit 1; }
+    command -v objcopy > /dev/null || {
+        echo "Need 'objcopy' to unpack an UEFI executable."
+        exit 1
+    }
     objcopy \
         --dump-section .linux="$TMPDIR/vmlinuz" \
         --dump-section .initrd="$TMPDIR/initrd.img" \
@@ -209,10 +220,10 @@ 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
+        du -h $image | while read a b || [ -n "$a" ]; do echo $a; done
         if [ -f "$TMPDIR/osrel.txt" ]; then
             name=$(sed -En '/^PRETTY_NAME/ s/^\w+=["'"'"']?([^"'"'"'$]*)["'"'"']?/\1/p' "$TMPDIR/osrel.txt")
             id=$(sed -En '/^ID/ s/^\w+=["'"'"']?([^"'"'"'$]*)["'"'"']?/\1/p' "$TMPDIR/osrel.txt")
@@ -229,7 +240,7 @@ if (( ${#filenames[@]} <= 0 )) && [[ -z "$unpack" ]] && [[ -z "$unpackearly" ]];
         fi
     else
         echo -n "Image: $image: "
-        du -h $image | while read a b || [ -n "$a" ]; do echo $a;done
+        du -h $image | while read a b || [ -n "$a" ]; do echo $a; done
     fi
 
     echo "========================================================================"
@@ -237,18 +248,18 @@ fi
 
 read -N 6 bin < "$image"
 case $bin in
-    $'\x71\xc7'*|070701)
+    $'\x71\xc7'* | 070701)
         CAT="cat --"
-        is_early=$(cpio --extract --verbose --quiet --to-stdout -- 'early_cpio' < "$image" 2>/dev/null)
+        is_early=$(cpio --extract --verbose --quiet --to-stdout -- 'early_cpio' < "$image" 2> /dev/null)
         # 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)
+        [[ "$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
                 # should use --unpackearly for early CPIO
                 :
             elif [[ -n "$unpackearly" ]]; then
                 unpack_files
-            elif (( ${#filenames[@]} > 0 )); then
+            elif ((${#filenames[@]} > 0)); then
                 extract_files
             else
                 echo "Early CPIO image"
@@ -269,8 +280,8 @@ case $bin in
         ;;
 esac
 
-if [[ $SKIP ]] ; then
-    bin="$($SKIP "$image" | { read -N 6 bin && echo "$bin" ; })"
+if [[ $SKIP ]]; then
+    bin="$($SKIP "$image" | { read -N 6 bin && echo "$bin"; })"
 else
     read -N 6 bin < "$image"
 fi
@@ -281,7 +292,7 @@ case $bin in
     BZh*)
         CAT="bzcat --"
         ;;
-    $'\x71\xc7'*|070701)
+    $'\x71\xc7'* | 070701)
         CAT="cat --"
         ;;
     $'\x02\x21'*)
@@ -294,7 +305,7 @@ case $bin in
         CAT="zstd -d -c"
         ;;
     *)
-        if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
+        if echo "test" | xz | xzcat --single-stream > /dev/null 2>&1; then
             CAT="xzcat --single-stream --"
         else
             CAT="xzcat --"
@@ -302,8 +313,7 @@ case $bin in
         ;;
 esac
 
-skipcpio()
-{
+skipcpio() {
     $SKIP "$@" | $ORIG_CAT
 }
 
@@ -312,11 +322,10 @@ if [[ $SKIP ]]; then
     CAT=skipcpio
 fi
 
-if (( ${#filenames[@]} > 1 )); then
+if ((${#filenames[@]} > 1)); then
     TMPFILE="$TMPDIR/initrd.cpio"
-    $CAT "$image" 2>/dev/null > $TMPFILE
-    pre_decompress()
-    {
+    $CAT "$image" 2> /dev/null > $TMPFILE
+    pre_decompress() {
         cat $TMPFILE
     }
     CAT=pre_decompress
@@ -326,12 +335,12 @@ ret=0
 
 if [[ -n "$unpack" ]]; then
     unpack_files
-elif (( ${#filenames[@]} > 0 )); then
+elif ((${#filenames[@]} > 0)); then
     extract_files
 else
     version=$($CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
-        $(dracutlibdirs 'dracut-*') 2>/dev/null)
-    ((ret+=$?))
+        $(dracutlibdirs 'dracut-*') 2> /dev/null)
+    ((ret += $?))
     echo "Version: $version"
     echo
     if [ "$modules" -eq 1 ]; then
@@ -340,7 +349,7 @@ else
     else
         echo -n "Arguments: "
         $CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \
-            $(dracutlibdirs build-parameter.txt) 2>/dev/null
+            $(dracutlibdirs build-parameter.txt) 2> /dev/null
         echo
         list_modules
         list_files
index 657e8b297b7d253f320760ca7d06e2261c38d7b7..0e5531738503e1dea8affd825a815439de8a3ce5 100755 (executable)
@@ -8,7 +8,7 @@ force=0
 
 error() { echo "$@" >&2; }
 
-usage () {
+usage() {
     [[ $1 = '-n' ]] && cmd=echo || cmd=error
 
     $cmd "usage: ${0##*/} [--version] [--help] [-v] [-f] [--preload <module>]"
@@ -34,16 +34,16 @@ 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
-               break
+            if [[ ${*:$i:1} = -* ]]; then
+                break
             fi
             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"
+        done
+        read "$1" <<< "$result"
         return $(($i - 3))
     fi
 }
@@ -54,35 +54,36 @@ default_kernel_images() {
     local qf='%{NAME}-%{VERSION}-%{RELEASE}\n'
 
     case "${DRACUT_ARCH:-$(uname -m)}" in
-        s390|s390x)
+        s390 | s390x)
             regex='image'
             ;;
         ppc*)
             regex='vmlinux'
             ;;
-        i?86|x86_64)
+        i?86 | x86_64)
             regex='vmlinuz'
             ;;
         arm*)
             regex='[uz]Image'
             ;;
-        aarch64|riscv64)
+        aarch64 | riscv64)
             regex='Image'
             ;;
-        *)  regex='vmlinu.'
+        *)
+            regex='vmlinu.'
             ;;
     esac
 
     # user mode linux
     if grep -q UML /proc/cpuinfo; then
-            regex='linux'
+        regex='linux'
     fi
 
     kernel_images=""
     initrd_images=""
     for kernel_image in $(ls $boot_dir \
-            | sed -ne "\|^$regex\(-[0-9.]\+-[0-9]\+-[a-z0-9]\+$\)\?|p" \
-            | grep -v kdump$ ) ; do
+        | sed -ne "\|^$regex\(-[0-9.]\+-[0-9]\+-[a-z0-9]\+$\)\?|p" \
+        | grep -v kdump$); do
 
         # Note that we cannot check the RPM database here -- this
         # script is itself called from within the binary kernel
@@ -91,20 +92,20 @@ default_kernel_images() {
         [ -L "$boot_dir/$kernel_image" ] && continue
         [ "${kernel_image%%.gz}" != "$kernel_image" ] && continue
         kernel_version=$(/usr/bin/get_kernel_version \
-                         $boot_dir/$kernel_image 2> /dev/null)
+            $boot_dir/$kernel_image 2> /dev/null)
         initrd_image=$(echo $kernel_image | sed -e "s|${regex}|initrd|")
         if [ "$kernel_image" != "$initrd_image" -a \
-             -n "$kernel_version" -a \
-             -d "/lib/modules/$kernel_version" ]; then
-                kernel_images="$kernel_images $boot_dir/$kernel_image"
-                initrd_images="$initrd_images $boot_dir/$initrd_image"
+            -n "$kernel_version" -a \
+            -d "/lib/modules/$kernel_version" ]; then
+            kernel_images="$kernel_images $boot_dir/$kernel_image"
+            initrd_images="$initrd_images $boot_dir/$initrd_image"
         fi
     done
-    for kernel_image in $kernel_images;do
-       kernels="$kernels ${kernel_image#*-}"
+    for kernel_image in $kernel_images; do
+        kernels="$kernels ${kernel_image#*-}"
     done
-    for initrd_image in $initrd_images;do
-       targets="$targets $initrd_image"
+    for initrd_image in $initrd_images; do
+        targets="$targets $initrd_image"
     done
     host_only=1
     force=1
@@ -112,25 +113,36 @@ default_kernel_images() {
 
 while (($# > 0)); do
     case ${1%%=*} in
-        --with-usb) read_arg usbmodule "$@" || shift $?
+        --with-usb)
+            read_arg usbmodule "$@" || shift $?
             basicmodules="$basicmodules ${usbmodule:-usb-storage}"
-            unset usbmodule;;
-        --with-avail) read_arg modname "$@" || shift $?
-            basicmodules="$basicmodules $modname";;
-        --with) read_arg modname "$@" || shift $?
-            basicmodules="$basicmodules $modname";;
+            unset usbmodule
+            ;;
+        --with-avail)
+            read_arg modname "$@" || shift $?
+            basicmodules="$basicmodules $modname"
+            ;;
+        --with)
+            read_arg modname "$@" || shift $?
+            basicmodules="$basicmodules $modname"
+            ;;
         --version)
             echo "mkinitrd: dracut compatibility wrapper"
-            exit 0;;
-        -v|--verbose) dracut_args="${dracut_args} -v";;
-        -f|--force) force=1;;
-        --preload) read_arg modname "$@" || shift $?
-            basicmodules="$basicmodules $modname";;
-        --image-version) img_vers=yes;;
-        --rootfs|-d) read_arg rootfs "$@" || shift $?
-            dracut_args="${dracut_args} --filesystems $rootfs";;
-        --nocompress) dracut_args="$dracut_args --no-compress";;
-        --help) usage -n;;
+            exit 0
+            ;;
+        -v | --verbose) dracut_args="${dracut_args} -v" ;;
+        -f | --force) force=1 ;;
+        --preload)
+            read_arg modname "$@" || shift $?
+            basicmodules="$basicmodules $modname"
+            ;;
+        --image-version) img_vers=yes ;;
+        --rootfs | -d)
+            read_arg rootfs "$@" || shift $?
+            dracut_args="${dracut_args} --filesystems $rootfs"
+            ;;
+        --nocompress) dracut_args="$dracut_args --no-compress" ;;
+        --help) usage -n ;;
         --builtin) ;;
         --without*) ;;
         --without-usb) ;;
@@ -153,34 +165,36 @@ while (($# > 0)); do
         --loopopts*) ;;
         --looppath*) ;;
         --dsdt*) ;;
-       -s) ;;
-       --quiet|-q) quiet=1;;
-       -b) read_arg boot_dir "$@" || shift $?
-           if [ ! -d $boot_dir ];then
-               error "Boot directory $boot_dir does not exist"
-               exit 1
-           fi
-           ;;
-       -k) # Would be nice to get a list of images here
-           read_arg kernel_images "$@" || shift $?
-           for kernel_image in $kernel_images;do
-               kernels="$kernels ${kernel_image#*-}"
-           done
-           host_only=1
-           force=1
-           ;;
-       -i) read_arg initrd_images "$@" || shift $?
-           for initrd_image in $initrd_images;do
-               targets="$targets $boot_dir/$initrd_image"
-           done
-           ;;
-        *)  if [[ ! $targets ]]; then
+        -s) ;;
+        --quiet | -q) quiet=1 ;;
+        -b)
+            read_arg boot_dir "$@" || shift $?
+            if [ ! -d $boot_dir ]; then
+                error "Boot directory $boot_dir does not exist"
+                exit 1
+            fi
+            ;;
+        -k) # Would be nice to get a list of images here
+            read_arg kernel_images "$@" || shift $?
+            for kernel_image in $kernel_images; do
+                kernels="$kernels ${kernel_image#*-}"
+            done
+            host_only=1
+            force=1
+            ;;
+        -i)
+            read_arg initrd_images "$@" || shift $?
+            for initrd_image in $initrd_images; do
+                targets="$targets $boot_dir/$initrd_image"
+            done
+            ;;
+        *) if [[ ! $targets ]]; then
             targets=$1
-            elif [[ ! $kernels ]]; then
+        elif [[ ! $kernels ]]; then
             kernels=$1
-            else
+        else
             usage
-            fi;;
+        fi ;;
     esac
     shift
 done
@@ -189,37 +203,37 @@ done
 [[ $targets && $kernels ]] || (error "No kernel found in $boot_dir" && usage)
 
 # We can have several targets/kernels, transform the list to an array
-targets=( $targets )
-[[ $kernels ]] && kernels=( $kernels )
+targets=($targets)
+[[ $kernels ]] && kernels=($kernels)
 
 [[ $host_only == 1 ]] && dracut_args="${dracut_args} -H"
-[[ $force == 1 ]]     && dracut_args="${dracut_args} -f"
+[[ $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]}"
+    if [[ $img_vers ]]; then
+        target="${targets[$i]}-${kernels[$i]}"
     else
-       target="${targets[$i]}"
+        target="${targets[$i]}"
     fi
     kernel="${kernels[$i]}"
 
     # Duplicate code: No way found how to redirect output based on $quiet
-    if [[ $quiet == 1 ]];then
-       echo "$target|$kernel|$dracut_args|$basicmodules"
-       if [[ $basicmodules ]]; then
+    if [[ $quiet == 1 ]]; then
+        echo "$target|$kernel|$dracut_args|$basicmodules"
+        if [[ $basicmodules ]]; then
             dracut $dracut_args --add-drivers "$basicmodules" "$target" \
-               "$kernel" &>/dev/null
-       else
-            dracut $dracut_args "$target" "$kernel" &>/dev/null
-       fi
+                "$kernel" &> /dev/null
+        else
+            dracut $dracut_args "$target" "$kernel" &> /dev/null
+        fi
     else
-       if [[ $basicmodules ]]; then
+        if [[ $basicmodules ]]; then
             dracut $dracut_args --add-drivers "$basicmodules" "$target" \
-               "$kernel"
-       else
+                "$kernel"
+        else
             dracut $dracut_args "$target" "$kernel"
-       fi
+        fi
     fi
 done
index e718f95e61609c4aa7baec541a9006b23baeb721..2d74975786f8d723714392052e05a46b8ceb5dec 100755 (executable)
@@ -25,7 +25,7 @@ dracut_cmd=dracut
 
 error() { echo "$@" >&2; }
 
-usage () {
+usage() {
     [[ $1 = '-n' ]] && cmd=echo || cmd=error
 
     $cmd "usage: ${0##*/} [options]"
@@ -85,16 +85,16 @@ 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
-               break
+            if [[ ${*:$i:1} = -* ]]; then
+                break
             fi
             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"
+        done
+        read "$1" <<< "$result"
         return $(($i - 3))
     fi
 }
@@ -104,12 +104,12 @@ calc_netmask() {
     local prefix=$1
 
     [ -z "$prefix" ] && return
-    mask=$(( 0xffffffff << (32 - $prefix) ))
-    byte1=$(( mask >> 24 ))
-    byte2=$(( mask >> 16 ))
-    byte3=$(( mask >> 8 ))
-    byte4=$(( mask & 0xff ))
-    netmask=$(printf "%d.%d.%d.%d" $(( byte1 & 0xff )) $(( byte2 & 0xff )) $(( byte3 & 0xff )) $byte4);
+    mask=$((0xffffffff << (32 - $prefix)))
+    byte1=$((mask >> 24))
+    byte2=$((mask >> 16))
+    byte3=$((mask >> 8))
+    byte4=$((mask & 0xff))
+    netmask=$(printf "%d.%d.%d.%d" $((byte1 & 0xff)) $((byte2 & 0xff)) $((byte3 & 0xff)) $byte4)
 
     echo $netmask
 }
@@ -135,8 +135,7 @@ is_xen_kernel() {
     local root_dir=$2
     local cfg
 
-    for cfg in ${root_dir}/boot/config-$kversion $root_dir/lib/modules/$kversion/build/.config
-    do
+    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
         return
@@ -151,12 +150,12 @@ kernel_version_from_image() {
     local kernel_image="$1" kernel_image_gz="${dir}vmlinux-${1#*-}.gz"
     echo kernel_image_gz="'$kernel_image_gz'" >&2
 
-    if get_kernel_version "$kernel_image" 2>/dev/null; then
+    if get_kernel_version "$kernel_image" 2> /dev/null; then
         return
     fi
 
     # As a last resort, try vmlinux-$version.gz, which might be around
-    get_kernel_version "$kernel_image_gz" 2>/dev/null
+    get_kernel_version "$kernel_image_gz" 2> /dev/null
 }
 
 # Taken over from SUSE mkinitrd
@@ -165,30 +164,31 @@ default_kernel_images() {
     local qf='%{NAME}-%{VERSION}-%{RELEASE}\n'
 
     case "${DRACUT_ARCH:-$(uname -m)}" in
-        s390|s390x)
+        s390 | s390x)
             regex='image'
             ;;
-        ppc|ppc64)
+        ppc | ppc64)
             regex='vmlinux'
             ;;
-        i?86|x86_64)
+        i?86 | x86_64)
             regex='vmlinuz'
             ;;
         arm*)
             regex='[uz]Image'
             ;;
-        aarch64|riscv64)
+        aarch64 | riscv64)
             regex='Image'
             ;;
-        *)  regex='vmlinu.'
+        *)
+            regex='vmlinu.'
             ;;
     esac
 
     kernel_images=""
     initrd_images=""
     for kernel_image in $(ls $boot_dir \
-            | sed -ne "\|^$regex\(-[0-9.]\+-[0-9]\+-[a-z0-9]\+$\)\?|p" \
-            | grep -v kdump$ ) ; do
+        | sed -ne "\|^$regex\(-[0-9.]\+-[0-9]\+-[a-z0-9]\+$\)\?|p" \
+        | grep -v kdump$); do
 
         # Note that we cannot check the RPM database here -- this
         # script is itself called from within the binary kernel
@@ -198,120 +198,137 @@ default_kernel_images() {
         [ "${kernel_image%%.gz}" != "$kernel_image" ] && continue
 
         kernel_version=$(kernel_version_from_image \
-                         $boot_dir/$kernel_image 2> /dev/null)
+            $boot_dir/$kernel_image 2> /dev/null)
         initrd_image=$(echo $kernel_image | sed -e "s|${regex}|initrd|")
         if [ "$kernel_image" != "$initrd_image" -a \
-             -n "$kernel_version" -a \
-             -d "/lib/modules/$kernel_version" ]; then
-                kernel_images="$kernel_images $boot_dir/$kernel_image"
-                initrd_images="$initrd_images $boot_dir/$initrd_image"
+            -n "$kernel_version" -a \
+            -d "/lib/modules/$kernel_version" ]; then
+            kernel_images="$kernel_images $boot_dir/$kernel_image"
+            initrd_images="$initrd_images $boot_dir/$initrd_image"
         fi
     done
-    for kernel_image in $kernel_images;do
-       kernels="$kernels ${kernel_image#*-}"
+    for kernel_image in $kernel_images; do
+        kernels="$kernels ${kernel_image#*-}"
     done
-    for initrd_image in $initrd_images;do
-       targets="$targets $initrd_image"
+    for initrd_image in $initrd_images; do
+        targets="$targets $initrd_image"
     done
 }
 
 while (($# > 0)); do
     case ${1%%=*} in
-       -f) read_arg feature_list "$@" || shift $?
-           # Could be several features
-           ;;
-       -k) # Would be nice to get a list of images here
-           read_arg kernel_images "$@" || shift $?
-           for kernel_image in $kernel_images;do
-               [ -L "/boot/$kernel_image" ] && kernel_image="$(readlink "/boot/$kernel_image")"
-               kernels="$kernels ${kernel_image#*-}"
-           done
-           ;;
-       -i) read_arg initrd_images "$@" || shift $?
-           for initrd_image in $initrd_images;do
-               [ -L "/boot/$initrd_image" ] && initrd_image="$(readlink "/boot/$initrd_image")"
-               # Check if the initrd_image contains a path.
-               # if not, then add the default boot_dir
-               dname=`dirname $initrd_image`
-               if [ "$dname" == "." ]; then
-                    targets="$targets $boot_dir/$initrd_image";
-               else
-                    targets="$targets $initrd_image";
-               fi
-           done
-           ;;
-       -b) read_arg boot_dir "$@" || shift $?
-           if [ ! -d $boot_dir ];then
-               error "Boot directory $boot_dir does not exist"
-               exit 1
-           fi
-           ;;
-       -t) read_arg tmp_dir "$@" || shift $?
-           dracut_args="${dracut_args} --tmpdir $tmp_dir"
-           ;;
-       -M) read_arg map_file "$@" || shift $?
-           ;;
-       -A) dracut_args="${dracut_args} --no-host-only";;
-       -B) skip_update_bootloader=1;;
-        -v|--verbose) dracut_args="${dracut_args} -v";;
-       -L) logfile=;;
-        -h|--help) usage -n;;
-       -m) read_arg module_list "$@" || shift $? ;;
-       -u) read_arg domu_module_list "$@" || shift $?
-           echo "mkinitrd: DomU modules not yet supported" ;;
-        -d) read_arg rootfs "$@" || shift $?
-            dracut_args="${dracut_args} --filesystems $rootfs" ;;
-       -D) read_arg dhcp_if "$@" || shift $?
-           dracut_cmdline="${dracut_cmdline} ip=${dhcp_if}:dhcp"
-           ;;
-       -I) read_arg static_if "$@" || shift $?
-           dracut_cmdline="${dracut_cmdline} ip=$(ipconfig $static_if)":
-           ;;
-       -a) read_arg acpi_dsdt "$@" || shift $?
-           echo "Obsolete -a param, use acpi_table_dir= and acpi_override= variables in /etc/dracut.conf.d/"
-           exit 1
-           ;;
-       -s) read_arg boot_splash "$@" || shift $?
-           echo "mkinitrd: boot splash not yet supported"
-           exit 1
-           ;;
-       -V) echo "mkinitrd: vendor scipts are no longer supported"
-           exit 1;;
-       --dracut)
-           read_arg dracut_cmd "$@" || shift $? ;;
-        --version|-R)
+        -f)
+            read_arg feature_list "$@" || shift $?
+            # Could be several features
+            ;;
+        -k) # Would be nice to get a list of images here
+            read_arg kernel_images "$@" || shift $?
+            for kernel_image in $kernel_images; do
+                [ -L "/boot/$kernel_image" ] && kernel_image="$(readlink "/boot/$kernel_image")"
+                kernels="$kernels ${kernel_image#*-}"
+            done
+            ;;
+        -i)
+            read_arg initrd_images "$@" || shift $?
+            for initrd_image in $initrd_images; do
+                [ -L "/boot/$initrd_image" ] && initrd_image="$(readlink "/boot/$initrd_image")"
+                # Check if the initrd_image contains a path.
+                # if not, then add the default boot_dir
+                dname=$(dirname $initrd_image)
+                if [ "$dname" == "." ]; then
+                    targets="$targets $boot_dir/$initrd_image"
+                else
+                    targets="$targets $initrd_image"
+                fi
+            done
+            ;;
+        -b)
+            read_arg boot_dir "$@" || shift $?
+            if [ ! -d $boot_dir ]; then
+                error "Boot directory $boot_dir does not exist"
+                exit 1
+            fi
+            ;;
+        -t)
+            read_arg tmp_dir "$@" || shift $?
+            dracut_args="${dracut_args} --tmpdir $tmp_dir"
+            ;;
+        -M)
+            read_arg map_file "$@" || shift $?
+            ;;
+        -A) dracut_args="${dracut_args} --no-host-only" ;;
+        -B) skip_update_bootloader=1 ;;
+        -v | --verbose) dracut_args="${dracut_args} -v" ;;
+        -L) logfile= ;;
+        -h | --help) usage -n ;;
+        -m) read_arg module_list "$@" || shift $? ;;
+        -u)
+            read_arg domu_module_list "$@" || shift $?
+            echo "mkinitrd: DomU modules not yet supported"
+            ;;
+        -d)
+            read_arg rootfs "$@" || shift $?
+            dracut_args="${dracut_args} --filesystems $rootfs"
+            ;;
+        -D)
+            read_arg dhcp_if "$@" || shift $?
+            dracut_cmdline="${dracut_cmdline} ip=${dhcp_if}:dhcp"
+            ;;
+        -I)
+            read_arg static_if "$@" || shift $?
+            dracut_cmdline="${dracut_cmdline} ip=$(ipconfig $static_if)":
+            ;;
+        -a)
+            read_arg acpi_dsdt "$@" || shift $?
+            echo "Obsolete -a param, use acpi_table_dir= and acpi_override= variables in /etc/dracut.conf.d/"
+            exit 1
+            ;;
+        -s)
+            read_arg boot_splash "$@" || shift $?
+            echo "mkinitrd: boot splash not yet supported"
+            exit 1
+            ;;
+        -V)
+            echo "mkinitrd: vendor scipts are no longer supported"
+            exit 1
+            ;;
+        --dracut)
+            read_arg dracut_cmd "$@" || shift $?
+            ;;
+        --version | -R)
             echo "mkinitrd: dracut compatibility wrapper"
-            exit 0;;
-       --quiet|-q) quiet=1;;
-        *)  if [[ ! $targets ]]; then
+            exit 0
+            ;;
+        --quiet | -q) quiet=1 ;;
+        *) if [[ ! $targets ]]; then
             targets=$1
-            elif [[ ! $kernels ]]; then
+        elif [[ ! $kernels ]]; then
             kernels=$1
-            else
+        else
             usage
-            fi;;
+        fi ;;
     esac
     shift
 done
 
 [[ $targets && $kernels ]] || default_kernel_images
-if [[ ! $targets || ! $kernels ]];then
+if [[ ! $targets || ! $kernels ]]; then
     error "No kernel found in $boot_dir or bad modules dir in /lib/modules"
     exit 1
 fi
 
 # We can have several targets/kernels, transform the list to an array
-targets=( $targets )
-[[ $kernels ]] && kernels=( $kernels )
+targets=($targets)
+[[ $kernels ]] && kernels=($kernels)
 
-[[ $logfile ]]        && dracut_args="${dracut_args} --logfile $logfile"
+[[ $logfile ]] && dracut_args="${dracut_args} --logfile $logfile"
 dracut_args="${dracut_args} --force"
 
 [[ $dracut_cmdline ]] && dracut_args="${dracut_args} --kernel-cmdline ${dracut_cmdline}"
 [ -z "$(type -p update-bootloader)" ] && skip_update_bootloader=1
 
 # Update defaults from /etc/sysconfig/kernel
-if [ -f /etc/sysconfig/kernel ] ; then
+if [ -f /etc/sysconfig/kernel ]; then
     . /etc/sysconfig/kernel
 fi
 [[ $module_list ]] || module_list="${INITRD_MODULES}"
@@ -320,17 +337,17 @@ 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]}"
+    if [[ $img_vers ]]; then
+        target="${targets[$i]}-${kernels[$i]}"
     else
-       target="${targets[$i]}"
+        target="${targets[$i]}"
     fi
     kernel="${kernels[$i]}"
 
-    if is_xen_kernel $kernel $rootfs ; then
-       modules_all="${module_list} ${domu_module_list}"
+    if is_xen_kernel $kernel $rootfs; then
+        modules_all="${module_list} ${domu_module_list}"
     else
         modules_all="${module_list}"
     fi
@@ -342,19 +359,19 @@ for ((i=0 ; $i<${#targets[@]} ; i++)); do
     echo "Creating initrd: $target"
 
     # Duplicate code: No way found how to redirect output based on $quiet
-    if [[ $quiet == 1 ]];then
+    if [[ $quiet == 1 ]]; then
         # Duplicate code: --force-drivers must not be called with empty string
         # -> dracut bug workarounded ugly, because of complex whitespace
         # expansion magics
-        if [ -n "${modules_all}" ];then
-            $dracut_cmd $dracut_args --force-drivers "${modules_all}" "$target" "$kernel" &>/dev/null
+        if [ -n "${modules_all}" ]; then
+            $dracut_cmd $dracut_args --force-drivers "${modules_all}" "$target" "$kernel" &> /dev/null
             [ $? -ne 0 ] && failed="$failed $target"
         else
-            $dracut_cmd $dracut_args "$target" "$kernel" &>/dev/null
+            $dracut_cmd $dracut_args "$target" "$kernel" &> /dev/null
             [ $? -ne 0 ] && failed="$failed $target"
         fi
     else
-        if [ -n "${modules_all}" ];then
+        if [ -n "${modules_all}" ]; then
             $dracut_cmd $dracut_args --force-drivers "${modules_all}" "$target" "$kernel"
             [ $? -ne 0 ] && failed="$failed $target"
         else
@@ -364,7 +381,7 @@ for ((i=0 ; $i<${#targets[@]} ; i++)); do
     fi
 done
 
-if [ "$skip_update_bootloader" ] ; then
+if [ "$skip_update_bootloader" ]; then
     echo 2>&1 "Did not refresh the bootloader. You might need to refresh it manually."
 else
     update-bootloader --refresh
index 6dc73cfd4157ed292179a81e27be2a3e659fb1a0..f72c297b05045f12d9344ffcfb1d09dfc92cab07 100755 (executable)
@@ -18,4 +18,3 @@ install() {
     # Prefer bash as /bin/sh if it is available.
     inst /bin/bash && ln -sf bash "${initdir}/bin/sh"
 }
-
index e1f6c697aad3e074d1c3540e94dbe0cee9158967..aa9632105b14146844eb438ba07173adcd0ed431 100755 (executable)
@@ -18,4 +18,3 @@ install() {
     # Prefer dash as /bin/sh if it is available.
     inst /bin/dash && ln -sf dash "${initdir}/bin/sh"
 }
-
index 6378fb2e587c7e9c70131ae0276e7f9679f3b5e5..aa129a1d13e7f6d1117d49a7947c030d91666276 100755 (executable)
@@ -18,4 +18,3 @@ install() {
     # Prefer mksh as /bin/sh if it is available.
     inst /bin/mksh && ln -sf mksh "${initdir}/bin/sh"
 }
-
index e57da5d94d53b02ed9464df8eb42e75c525bd667..53e1999287b80a0fb9c9a0a67939e42e875017a7 100755 (executable)
@@ -1,7 +1,10 @@
 #!/bin/bash
 
 getSystemdVersion() {
-    [ -z "$SYSTEMD_VERSION" ] && SYSTEMD_VERSION=$("$systemdutildir"/systemd --version | { read -r _ b _; echo "$b"; })
+    [ -z "$SYSTEMD_VERSION" ] && SYSTEMD_VERSION=$("$systemdutildir"/systemd --version | {
+        read -r _ b _
+        echo "$b"
+    })
     # Check if the systemd version is a valid number
     if ! [[ $SYSTEMD_VERSION =~ ^[0-9]+$ ]]; then
         dfatal "systemd version is not a number ($SYSTEMD_VERSION)"
@@ -16,8 +19,8 @@ check() {
     [[ $mount_needs ]] && return 1
     if require_binaries "$systemdutildir"/systemd; then
         SYSTEMD_VERSION=$(getSystemdVersion)
-        (( SYSTEMD_VERSION >= 198 )) && return 0
-       return 255
+        ((SYSTEMD_VERSION >= 198)) && return 0
+        return 255
     fi
 
     return 1
@@ -43,9 +46,9 @@ install() {
     fi
 
     if [[ $(getSystemdVersion) -ge 240 ]]; then
-    inst_multiple -o \
-        "$systemdutildir"/system-generators/systemd-debug-generator \
-        "$systemdsystemunitdir"/debug-shell.service
+        inst_multiple -o \
+            "$systemdutildir"/system-generators/systemd-debug-generator \
+            "$systemdsystemunitdir"/debug-shell.service
     fi
 
     inst_multiple -o \
@@ -170,12 +173,13 @@ install() {
             [[ -f $i ]] || continue
             while read -r _line || [ -n "$_line" ]; do
                 case $_line in
-                    \#*)
-                        ;;
-                    \;*)
-                        ;;
+                    \#*) ;;
+
+                    \;*) ;;
+
                     *)
                         echo "$_line"
+                        ;;
                 esac
             done < "$i"
         done
@@ -211,8 +215,8 @@ install() {
 
     # install adm user/group for journald
     inst_multiple nologin
-    grep '^systemd-journal:' "$dracutsysrootdir"/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
-    grep '^adm:' "$dracutsysrootdir"/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
+    grep '^systemd-journal:' "$dracutsysrootdir"/etc/passwd 2> /dev/null >> "$initdir/etc/passwd"
+    grep '^adm:' "$dracutsysrootdir"/etc/passwd 2> /dev/null >> "$initdir/etc/passwd"
     grep '^systemd-journal:' "$dracutsysrootdir"/etc/group >> "$initdir/etc/group"
     grep '^wheel:' "$dracutsysrootdir"/etc/group >> "$initdir/etc/group"
     grep '^adm:' "$dracutsysrootdir"/etc/group >> "$initdir/etc/group"
@@ -220,7 +224,7 @@ install() {
     grep '^root:' "$dracutsysrootdir"/etc/group >> "$initdir/etc/group"
 
     # we don't use systemd-networkd, but the user is in systemd.conf tmpfiles snippet
-    grep '^systemd-network:' "$dracutsysrootdir"/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
+    grep '^systemd-network:' "$dracutsysrootdir"/etc/passwd 2> /dev/null >> "$initdir/etc/passwd"
     grep '^systemd-network:' "$dracutsysrootdir"/etc/group >> "$initdir/etc/group"
 
     ln_r "$systemdutildir"/systemd "/init"
index f64818c68d902d15e1b00b99396379830d2d97f0..ca04d37c7f2041505bd70376be2ce31d64efb863 100644 (file)
@@ -1,9 +1,9 @@
 #!/bin/sh
 
-if test -e /etc/adjtime ; then
-    while read line ; do
-       if test "$line" = LOCAL ; then
-           hwclock --systz
-       fi
+if test -e /etc/adjtime; then
+    while read line; do
+        if test "$line" = LOCAL; then
+            hwclock --systz
+        fi
     done < /etc/adjtime
 fi
index 1676a6e307232eec7ba0d5ed30603b09dc406a24..3eaef6751a5d7813bb6fbe8423afe6308a97be46 100755 (executable)
@@ -1,10 +1,10 @@
 #!/bin/sh
 
 if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ]; then
-    rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
+    rm -f -- /etc/modprobe.d/fips.conf > /dev/null 2>&1
 elif [ -z "$fipsmode" ]; then
     die "FIPS mode have to be enabled by 'fips=1' not just 'fips'"
-elif getarg boot= >/dev/null; then
+elif getarg boot= > /dev/null; then
     . /sbin/fips.sh
     if mount_boot; then
         do_fips || die "FIPS integrity test failed"
index 82cbeee42c25701f930701d35f73dd0cd94f5d5e..23d48a6a35ce573758863a07c54fb36bc71a0f1a 100644 (file)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
-    rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
+    rm -f -- /etc/modprobe.d/fips.conf > /dev/null 2>&1
 else
     . /sbin/fips.sh
     fips_load_crypto || die "FIPS integrity test failed"
index 8d6037e5ca496fe156e9cb69a15b3f1ed5fc2071..1c026d9c6119560753747f5a3096afd4abb4b911 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ]; then
-    rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
+    rm -f -- /etc/modprobe.d/fips.conf > /dev/null 2>&1
 elif [ -z "$fipsmode" ]; then
     die "FIPS mode have to be enabled by 'fips=1' not just 'fips'"
 elif ! [ -f /tmp/fipsdone ]; then
index 5717e07a0920ac5b5edc86b8416a813482ab63c5..4b644dfd952b78e168a2d0022b0b5f5f2f047b5f 100755 (executable)
@@ -12,23 +12,23 @@ else
     }
 fi
 
-mount_boot()
-{
+mount_boot() {
     boot=$(getarg boot=)
 
     if [ -n "$boot" ]; then
         case "$boot" in
-        LABEL=* | UUID=* | PARTUUID=* | PARTLABEL=*)
-            boot="$(label_uuid_to_dev "$boot")"
-            ;;
-        /dev/*)
-            ;;
-        *)
-            die "You have to specify boot=<boot device> as a boot option for fips=1" ;;
+            LABEL=* | UUID=* | PARTUUID=* | PARTLABEL=*)
+                boot="$(label_uuid_to_dev "$boot")"
+                ;;
+            /dev/*) ;;
+
+            *)
+                die "You have to specify boot=<boot device> as a boot option for fips=1"
+                ;;
         esac
 
         if ! [ -e "$boot" ]; then
-            udevadm trigger --action=add >/dev/null 2>&1
+            udevadm trigger --action=add > /dev/null 2>&1
             [ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version)
             i=0
             while ! [ -e $boot ]; do
@@ -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
@@ -55,8 +55,7 @@ mount_boot()
     fi
 }
 
-do_rhevh_check()
-{
+do_rhevh_check() {
     KERNEL=$(uname -r)
     kpath=${1}
 
@@ -71,23 +70,21 @@ do_rhevh_check()
     return 0
 }
 
-nonfatal_modprobe()
-{
-    modprobe $1 2>&1 > /dev/stdout |
-        while read -r line || [ -n "$line" ]; do
+nonfatal_modprobe() {
+    modprobe $1 2>&1 > /dev/stdout \
+        | while read -r line || [ -n "$line" ]; do
             echo "${line#modprobe: FATAL: }" >&2
         done
 }
 
-fips_load_crypto()
-{
+fips_load_crypto() {
     FIPSMODULES=$(cat /etc/fipsmodules)
 
     fips_info "Loading and integrity checking all crypto modules"
     mv /etc/modprobe.d/fips.conf /etc/modprobe.d/fips.conf.bak
     for _module in $FIPSMODULES; do
         if [ "$_module" != "tcrypt" ]; then
-            if ! nonfatal_modprobe "${_module}" 2>/tmp/fips.modprobe_err; then
+            if ! nonfatal_modprobe "${_module}" 2> /tmp/fips.modprobe_err; then
                 # check if kernel provides generic algo
                 _found=0
                 while read _k _s _v || [ -n "$_k" ]; do
@@ -95,7 +92,7 @@ fips_load_crypto()
                     [ "$_v" != "$_module" ] && continue
                     _found=1
                     break
-                done </proc/crypto
+                done < /proc/crypto
                 [ "$_found" = "0" ] && cat /tmp/fips.modprobe_err >&2 && return 1
             fi
         fi
@@ -107,8 +104,7 @@ fips_load_crypto()
     rmmod tcrypt
 }
 
-do_fips()
-{
+do_fips() {
     local _v
     local _s
     local _v
@@ -159,7 +155,7 @@ do_fips()
 
     > /tmp/fipsdone
 
-    umount /boot >/dev/null 2>&1
+    umount /boot > /dev/null 2>&1
 
     return 0
 }
index 196822e9d2a6a34044bb4e31153c328c5566bc2b..2331480a77a844c85fa96e4b451696b0bb3c7daf 100755 (executable)
@@ -34,26 +34,26 @@ install() {
         $systemdsystemunitdir/sysinit.target.wants/systemd-ask-password-console.path \
         systemd-ask-password systemd-tty-ask-password-agent
 
-        # Enable the systemd type service unit for systemd-ask-password.
-        $SYSTEMCTL -q --root "$initdir" enable systemd-ask-password-console.service
-
-        # Install systemd-ask-password plymouth units if plymouth is enabled.
-        if dracut_module_included "plymouth"; then
-            inst_multiple -o \
-                $systemdsystemunitdir/systemd-ask-password-plymouth.path \
-                $systemdsystemunitdir/systemd-ask-password-plymouth.service
-
-            $SYSTEMCTL -q --root "$initdir" enable systemd-ask-password-plymouth.service
-        fi
-
-        # Uncomment this section if the usecase for wall module in the initramfs arises.
-        # Install systemd-ask-password wall units if <wall module> is enabled.
-        #if dracut_module_included "<wall module>"; then
-        #    inst_multiple -o \
-        #        $systemdsystemunitdir/systemd-ask-password-wall.path \
-        #        $systemdsystemunitdir/systemd-ask-password-wall.service \
-        #        $systemdsystemunitdir/multi-user.target.wants/systemd-ask-password-wall.path
-        #
-        #    $SYSTEMCTL -q --root "$initdir" enable systemd-ask-password-wall.service
-        #fi
+    # Enable the systemd type service unit for systemd-ask-password.
+    $SYSTEMCTL -q --root "$initdir" enable systemd-ask-password-console.service
+
+    # Install systemd-ask-password plymouth units if plymouth is enabled.
+    if dracut_module_included "plymouth"; then
+        inst_multiple -o \
+            $systemdsystemunitdir/systemd-ask-password-plymouth.path \
+            $systemdsystemunitdir/systemd-ask-password-plymouth.service
+
+        $SYSTEMCTL -q --root "$initdir" enable systemd-ask-password-plymouth.service
+    fi
+
+    # Uncomment this section if the usecase for wall module in the initramfs arises.
+    # Install systemd-ask-password wall units if <wall module> is enabled.
+    #if dracut_module_included "<wall module>"; then
+    #    inst_multiple -o \
+    #        $systemdsystemunitdir/systemd-ask-password-wall.path \
+    #        $systemdsystemunitdir/systemd-ask-password-wall.service \
+    #        $systemdsystemunitdir/multi-user.target.wants/systemd-ask-password-wall.path
+    #
+    #    $SYSTEMCTL -q --root "$initdir" enable systemd-ask-password-wall.service
+    #fi
 }
index adb69777712672355acb193ddf2a7be91eaed4d7..14cad5eff5902c3553de8a424b1be1158d474eb1 100755 (executable)
@@ -27,14 +27,13 @@ depends() {
 # Install the required file(s) and directories for the module in the initramfs.
 install() {
 
-    inst_dir   /var/lib/systemd/coredump
+    inst_dir /var/lib/systemd/coredump
     inst_multiple -o \
         $sysctld/50-coredump.conf \
         $systemdutildir/coredump.conf \
         $systemdsystemunitdir/systemd-coredump \
         $systemdsystemunitdir/systemd-coredump.socket \
-        $systemdsystemunitdir/systemd-coredump@.service\
-        $systemdsystemunitdir/sockets.target.wants/systemd-coredump.socket \
+        $systemdsystemunitdir/systemd-coredump@.service $systemdsystemunitdir/sockets.target.wants/systemd-coredump.socket \
         coredumpctl
 
     # Install the hosts local user configurations if enabled.
index e6d07265384f789003933b49c5aafc4ff1d1ebb5..c02e914fcff18ef0c73a763a5700cef03bd062c1 100644 (file)
@@ -26,24 +26,24 @@ depends() {
 # Install the required file(s) for the module in the initramfs.
 install() {
 
-        # Create systemd-modules-load related directories.
-        inst_dir    $modulesload
-        inst_dir    $modulesloadconfdir
-
-        # Install related files for systemd-modules-load
-        inst_multiple -o \
-            $systemdsystemunitdir/systemd-modules-load.service \
-            $systemdutildir/systemd-modules-load
-
-        # Install local user configurations if host only is enabled..
-        if [[ $hostonly ]]; then
-            inst_multiple -H -o \
+    # Create systemd-modules-load related directories.
+    inst_dir $modulesload
+    inst_dir $modulesloadconfdir
+
+    # Install related files for systemd-modules-load
+    inst_multiple -o \
+        $systemdsystemunitdir/systemd-modules-load.service \
+        $systemdutildir/systemd-modules-load
+
+    # Install local user configurations if host only is enabled..
+    if [[ $hostonly ]]; then
+        inst_multiple -H -o \
             $systemdsystemconfdir/systemd-modules-load.service \
             $systemdsystemconfdir/systemd-systemd-modules-load.d/*.conf \
             ${NULL}
-        fi
+    fi
 
-        # Enable the systemd type service unit for systemd-modules-load.
-        $SYSTEMCTL -q --root "$initdir" enable systemd-modules-load.service
+    # Enable the systemd type service unit for systemd-modules-load.
+    $SYSTEMCTL -q --root "$initdir" enable systemd-modules-load.service
 
 }
index 6fcc0262fb075da51be33c2dc31c793851afb4cd..4c2b73e03734ebed9c858f0c365f5f02aaaf6402 100644 (file)
@@ -37,17 +37,17 @@ install() {
         $systemdsystemunitdir/systemd-sysusers.service \
         systemd-sysusers
 
-        # Install the hosts local user configurations if enabled.
-        if [[ $hostonly ]]; then
-            inst_multiple -H -o \
+    # Install the hosts local user configurations if enabled.
+    if [[ $hostonly ]]; then
+        inst_multiple -H -o \
             $sysusersconfdir/basic.conf \
             $sysusersconfdir/systemd.conf \
             $systemdsystemconfdir/systemd-sysusers.service \
             $systemdsystemconfdir/systemd-sysusers.service.d/*.conf \
             ${NULL}
-        fi
+    fi
 
-        # Enable the systemd type service unit for sysusers.
-        $SYSTEMCTL -q --root "$initdir" enable systemd-sysusers.service
+    # Enable the systemd type service unit for sysusers.
+    $SYSTEMCTL -q --root "$initdir" enable systemd-sysusers.service
 
 }
index 54aabe47ea2ab851054a7215243761778e19fa04..6c28299a26ff2c6fdc052667419704e1b4a78147 100755 (executable)
@@ -10,7 +10,7 @@ if [ "$capsmode" = "1" ]; then
     CAPS_KEXEC_DISABLED=$(getarg rd.caps.disablekexec=)
 
     info "Loading CAPS_MODULES $CAPS_MODULES"
-    for i in $CAPS_MODULES;do modprobe "$i" 2>&1 >/dev/null | vinfo; done
+    for i in $CAPS_MODULES; do modprobe "$i" 2>&1 > /dev/null | vinfo; done
 
     if [ "$CAPS_MODULES_DISABLED" = "1" -a -e /proc/sys/kernel/modules_disabled ]; then
         info "Disabling module loading."
@@ -32,4 +32,3 @@ if [ "$capsmode" = "1" ]; then
     echo "CAPS_INIT_DROP=\"$CAPS_INIT_DROP\"" > /etc/capsdrop
     info "Will drop capabilities $CAPS_INIT_DROP from init."
 fi
-
index d1ce6cdc211a5df5a11abd2f9f2f37707804db2f..38bcb7e1a24b8d85c61b493ec66a78fe966de690 100755 (executable)
@@ -15,11 +15,10 @@ depends() {
 install() {
     if ! dracut_module_included "systemd"; then
         inst_hook pre-pivot 00 "$moddir/caps.sh"
-        inst $(find_binary capsh 2>/dev/null) /usr/sbin/capsh
+        inst $(find_binary capsh 2> /dev/null) /usr/sbin/capsh
         # capsh wants bash and we need bash also
         inst /bin/bash
     else
         dwarning "caps: does not work with systemd in the initramfs"
     fi
 }
-
index a09ad830df4930d818863c32538cd72ea4770f6a..eb711f3612f847fcce569b0aeabfb537c6c0496a 100755 (executable)
@@ -27,33 +27,32 @@ install() {
         $systemdutildir/network/99-default.link \
         networkctl ip
 
-        #hostnamectl timedatectl
-        # $systemdutildir/systemd-timesyncd \
-        # $systemdutildir/systemd-timedated \
-        # $systemdutildir/systemd-hostnamed \
-        # $systemdutildir/systemd-resolvd \
-        # $systemdutildir/systemd-resolve-host \
-        # $systemdsystemunitdir/systemd-resolved.service \
-        # $systemdsystemunitdir/systemd-hostnamed.service \
-        # $systemdsystemunitdir/systemd-timesyncd.service \
-        # $systemdsystemunitdir/systemd-timedated.service \
-        # $systemdsystemunitdir/time-sync.target \
-        # /etc/systemd/resolved.conf \
-
+    #hostnamectl timedatectl
+    # $systemdutildir/systemd-timesyncd \
+    # $systemdutildir/systemd-timedated \
+    # $systemdutildir/systemd-hostnamed \
+    # $systemdutildir/systemd-resolvd \
+    # $systemdutildir/systemd-resolve-host \
+    # $systemdsystemunitdir/systemd-resolved.service \
+    # $systemdsystemunitdir/systemd-hostnamed.service \
+    # $systemdsystemunitdir/systemd-timesyncd.service \
+    # $systemdsystemunitdir/systemd-timedated.service \
+    # $systemdsystemunitdir/time-sync.target \
+    # /etc/systemd/resolved.conf \
 
     # inst_dir /var/lib/systemd/clock
 
-    grep '^systemd-network:' "$dracutsysrootdir"/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
+    grep '^systemd-network:' "$dracutsysrootdir"/etc/passwd 2> /dev/null >> "$initdir/etc/passwd"
     grep '^systemd-network:' "$dracutsysrootdir"/etc/group >> "$initdir/etc/group"
     # grep '^systemd-timesync:' "$dracutsysrootdir"/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
     # grep '^systemd-timesync:' "$dracutsysrootdir"/etc/group >> "$initdir/etc/group"
 
     _arch=${DRACUT_ARCH:-$(uname -m)}
     inst_libdir_file \
-                     {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
-                     {"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*" \
-                     {"tls/$_arch/",tls/,"$_arch/",}"libnss_myhostname.so.*" \
-                     {"tls/$_arch/",tls/,"$_arch/",}"libnss_resolve.so.*"
+        {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
+        {"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*" \
+        {"tls/$_arch/",tls/,"$_arch/",}"libnss_myhostname.so.*" \
+        {"tls/$_arch/",tls/,"$_arch/",}"libnss_resolve.so.*"
 
     #       systemd-timesyncd.service
     for i in \
@@ -64,4 +63,3 @@ install() {
         $SYSTEMCTL -q --root "$initdir" enable "$i"
     done
 }
-
index fb5e35ca32f2e8364e4775f9b6f5428f16ee9bfe..e01d48238db781a0967dd9cc01a22a48b1dbc94d 100755 (executable)
@@ -5,7 +5,7 @@
 # Copyright 2013 Red Hat, Inc.
 # Peter Jones <pjones@redhat.com>
 
-for x in /lib/modules/keys/* ; do
+for x in /lib/modules/keys/*; do
     [ "${x}" = "/lib/modules/keys/*" ] && break
     keyctl padd asymmetric "" @s < ${x}
 done
index 9e1502cea05845b44a0eb145f265dd315966fcfa..2dec31bd7bd15343a2d0b40111c26e3f773cb5c2 100755 (executable)
@@ -31,7 +31,7 @@ install() {
 
     inst_hook pre-trigger 01 "$moddir/load-modsign-keys.sh"
 
-    for x in "$dracutsysrootdir"/lib/modules/keys/* ; do
+    for x in "$dracutsysrootdir"/lib/modules/keys/*; do
         [[ "${x}" = "$dracutsysrootdir/lib/modules/keys/*" ]] && break
         inst_simple "${x#$dracutsysrootdir}"
     done
index 926791438a0da3f472b94266b5f3653aaa14b2f2..d7e7e6fa31a4aaecd9768fec8670cd3facbac99a 100755 (executable)
@@ -17,4 +17,3 @@ install() {
         ping netstat rpcinfo vi scp ping6 ssh \
         fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.f2fs fsck.vfat e2fsck
 }
-
index fdc6298683959655fee88eb0688176c2da5e9337..e9ce8780da54dbdc8e180a003abf9f990e748195 100755 (executable)
@@ -16,17 +16,17 @@ install() {
     # Do not add watchdog hooks if systemd module is included
     # In that case, systemd will manage watchdog kick
     if ! dracut_module_included "systemd"; then
-        inst_hook cmdline   00 "$moddir/watchdog.sh"
-        inst_hook cmdline   50 "$moddir/watchdog.sh"
+        inst_hook cmdline 00 "$moddir/watchdog.sh"
+        inst_hook cmdline 50 "$moddir/watchdog.sh"
         inst_hook pre-trigger 00 "$moddir/watchdog.sh"
         inst_hook initqueue 00 "$moddir/watchdog.sh"
-        inst_hook mount     00 "$moddir/watchdog.sh"
-        inst_hook mount     50 "$moddir/watchdog.sh"
-        inst_hook mount     99 "$moddir/watchdog.sh"
+        inst_hook mount 00 "$moddir/watchdog.sh"
+        inst_hook mount 50 "$moddir/watchdog.sh"
+        inst_hook mount 99 "$moddir/watchdog.sh"
         inst_hook pre-pivot 00 "$moddir/watchdog.sh"
         inst_hook pre-pivot 99 "$moddir/watchdog.sh"
-        inst_hook cleanup   00 "$moddir/watchdog.sh"
-        inst_hook cleanup   99 "$moddir/watchdog.sh"
+        inst_hook cleanup 00 "$moddir/watchdog.sh"
+        inst_hook cleanup 99 "$moddir/watchdog.sh"
     fi
 
     inst_hook emergency 02 "$moddir/watchdog-stop.sh"
index 14c92aa55dd24bf9844f59cd79443f5340c7089e..48adb3db40c7ff72a7ffc32c0273204719b72fbd 100755 (executable)
@@ -1,12 +1,12 @@
 #!/bin/sh
 if [ -e /dev/watchdog ]; then
-       if [ ! -e /tmp/watchdog_timeout ]; then
-               wdctl -s 60 /dev/watchdog >/dev/null 2>&1
-               > /tmp/watchdog_timeout
-       fi
-       info "Triggering watchdog"
-       >/dev/watchdog
+    if [ ! -e /tmp/watchdog_timeout ]; then
+        wdctl -s 60 /dev/watchdog > /dev/null 2>&1
+        > /tmp/watchdog_timeout
+    fi
+    info "Triggering watchdog"
+    /dev/watchdog
 else
-       modprobe ib700wdt
-       modprobe i6300esb
+    modprobe ib700wdt
+    modprobe i6300esb
 fi
index 20b36c1640383df3f1379dc53c0d8a3b9078f515..f19ce0b599c579ef88bd3ce9ad8d2e0e75570836 100755 (executable)
@@ -29,4 +29,3 @@ install() {
         ln_r /usr/bin/busybox $_path
     done
 }
-
index efed8079672043e1b345a2e994869df35102bd96..db76fdf14268181f4de58d817d785ce3562435db 100755 (executable)
@@ -65,7 +65,6 @@ install() {
         /^\[Socket\]/aRemoveOnStop=yes' \
         "$initdir$systemdsystemunitdir/dbus.socket"
 
-
     # Install the hosts local user configurations if enabled.
     if [[ $hostonly ]]; then
         inst_multiple -H -o \
index e71e222468022851e1e68c7241c5b46d16551ce2..df86ffeaa3d149fa3bd70693d06a9dfea4e895cd 100755 (executable)
@@ -65,7 +65,7 @@ install() {
 
     # Adjusting dependencies for initramfs in the dbus socket unit.
     sed -i -e \
-       '/^\[Unit\]/aDefaultDependencies=no\
+        '/^\[Unit\]/aDefaultDependencies=no\
         Conflicts=shutdown.target\
         Before=shutdown.target
         /^\[Socket\]/aRemoveOnStop=yes' \
@@ -84,7 +84,7 @@ install() {
             $systemdsystemconfdir/dbus.service \
             $systemdsystemconfdir/dbus.service.d/*.conf \
             ${NULL}
-     fi
+    fi
 
     # We need to make sure that systemd-tmpfiles-setup.service->dbus.socket
     # will not wait for local-fs.target to start if swap is encrypted,
index 7f8317afa8ca80c28600c79bcab470ab86638719..b66367bd54e7848407aedaa267baef4a784cc7d0 100755 (executable)
@@ -13,13 +13,13 @@ depends() {
     local _module
     # Add a dbus meta dependency based on the module in use.
     for _module in dbus-daemon dbus-broker; do
-        if dracut_module_included "$_module" ; then
+        if dracut_module_included "$_module"; then
             echo "$_module"
             return 0
         fi
-    done;
+    done
 
-    if find_binary dbus-broker &> /dev/null ; then
+    if find_binary dbus-broker &> /dev/null; then
         echo "dbus-broker"
         return 0
     else
index a463a83de7254690ba0afeaea80f90c68e9d4f31..2cbfb60c21bc5cdafc728d796e1bea8b60720a2f 100755 (executable)
@@ -45,7 +45,9 @@ set_keymap() {
 }
 
 set_font() {
-    local dev=$1; local trans=''; local uni=''
+    local dev=$1
+    local trans=''
+    local uni=''
 
     [ -z "${FONT}" ] && FONT=${DEFAULT_FONT}
     [ -n "${FONT_MAP}" ] && trans="-m ${FONT_MAP}"
@@ -62,8 +64,8 @@ dev_close() {
 dev_open() {
     local dev=$1
 
-    exec 6<${dev} && \
-        exec 7>>${dev}
+    exec 6< ${dev} \
+        && exec 7>> ${dev}
 }
 
 dev=/dev/${1#/dev/}
@@ -90,4 +92,3 @@ set_font ${dev}
 set_keymap
 
 dev_close
-
index d6688b47b25f708b4767ec403560a3361386df17..9f4d22185b1071ecf604beb3554f5083d8ebd26f 100755 (executable)
@@ -28,19 +28,19 @@ install() {
     VCONFIG_CONF="/etc/vconsole.conf"
 
     # This is from 10redhat-i18n.
-    findkeymap () {
+    findkeymap() {
         local MAPS=$1
         local MAPNAME=${1%.map*}
         local map
-        [[ ! -f $dracutsysrootdir$MAPS ]] && \
-            MAPS=$(find $dracutsysrootdir${kbddir}/keymaps -type f -name ${MAPNAME} -o -name ${MAPNAME}.map -o -name ${MAPNAME}.map.\*)
+        [[ ! -f $dracutsysrootdir$MAPS ]] \
+            && MAPS=$(find $dracutsysrootdir${kbddir}/keymaps -type f -name ${MAPNAME} -o -name ${MAPNAME}.map -o -name ${MAPNAME}.map.\*)
 
         for map in $MAPS; do
             KEYMAPS="$KEYMAPS $map "
             case $map in
-                *.gz) cmd="zgrep";;
-                *.bz2) cmd="bzgrep";;
-                *) cmd="grep";;
+                *.gz) cmd="zgrep" ;;
+                *.bz2) cmd="bzgrep" ;;
+                *) cmd="grep" ;;
             esac
 
             for INCL in $($cmd "^include " $map | while read _ a _ || [ -n "$a" ]; do echo ${a//\"/}; done); do
@@ -52,43 +52,41 @@ install() {
         done
     }
 
-# Function gathers variables from distributed files among the tree, maps to
-# specified names and prints the result in format "new-name=value".
-#
-# $@ = list in format specified below (BNF notation)
-#
-# <list> ::= <element> | <element> " " <list>
-# <element> ::= <conf-file-name> ":" <map-list>
-# <map-list> ::= <mapping> | <mapping> "," <map-list>
-# <mapping> ::= <src-var> "-" <dst-var> | <src-var>
-#
-# We assume no whitespace are allowed between symbols.
-# <conf-file-name> is a file holding <src-var> in your system.
-# <src-var> is a variable holding value of meaning the same as <dst-var>.
-# <dst-var> is a variable which will be set up inside initramfs.
-# If <dst-var> has the same name as <src-var> we can omit <dst-var>.
-#
-# Example:
-# /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
-# <list> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
-# <element> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
-# <conf-file-name> = /etc/conf.d/keymaps
-# <map-list> = KEYMAP,extended_keymaps-EXT_KEYMAPS
-# <mapping> = KEYMAP
-# <src-var> = KEYMAP
-# <mapping> = extended_keymaps-EXT_KEYMAPS
-# <src-var> = extended_keymaps
-# <dst-var> = EXT_KEYMAPS
+    # Function gathers variables from distributed files among the tree, maps to
+    # specified names and prints the result in format "new-name=value".
+    #
+    # $@ = list in format specified below (BNF notation)
+    #
+    # <list> ::= <element> | <element> " " <list>
+    # <element> ::= <conf-file-name> ":" <map-list>
+    # <map-list> ::= <mapping> | <mapping> "," <map-list>
+    # <mapping> ::= <src-var> "-" <dst-var> | <src-var>
+    #
+    # We assume no whitespace are allowed between symbols.
+    # <conf-file-name> is a file holding <src-var> in your system.
+    # <src-var> is a variable holding value of meaning the same as <dst-var>.
+    # <dst-var> is a variable which will be set up inside initramfs.
+    # If <dst-var> has the same name as <src-var> we can omit <dst-var>.
+    #
+    # Example:
+    # /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
+    # <list> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
+    # <element> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
+    # <conf-file-name> = /etc/conf.d/keymaps
+    # <map-list> = KEYMAP,extended_keymaps-EXT_KEYMAPS
+    # <mapping> = KEYMAP
+    # <src-var> = KEYMAP
+    # <mapping> = extended_keymaps-EXT_KEYMAPS
+    # <src-var> = extended_keymaps
+    # <dst-var> = EXT_KEYMAPS
     gather_vars() {
         local item map value
 
         # FIXME: double check
         # shellcheck disable=SC2068
-        for item in $@
-        do
+        for item in $@; do
             item=(${item/:/ })
-            for map in ${item[1]//,/ }
-            do
+            for map in ${item[1]//,/ }; do
                 map=(${map//-/ })
                 if [[ -f "$dracutsysrootdir${item[0]}" ]]; then
                     value=$(grep "^${map[0]}=" "$dracutsysrootdir${item[0]}")
@@ -129,12 +127,12 @@ install() {
         find "${initdir}${kbddir}/" -name README\* -delete
         find "${initdir}${kbddir}/" -name '*.gz' -print -quit \
             | while read line || [ -n "$line" ]; do
-            inst_multiple gzip
+                inst_multiple gzip
             done
 
         find "${initdir}${kbddir}/" -name '*.bz2' -print -quit \
             | while read line || [ -n "$line" ]; do
-            inst_multiple bzip2
+                inst_multiple bzip2
             done
     }
 
@@ -146,20 +144,16 @@ install() {
         [ -f $dracutsysrootdir$VCONFIG_CONF ] && . $dracutsysrootdir$VCONFIG_CONF
 
         shopt -q -s nocasematch
-        if [[ ${UNICODE} ]]
-        then
-            if [[ ${UNICODE} = YES || ${UNICODE} = 1 ]]
-            then
+        if [[ ${UNICODE} ]]; 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=''
             fi
         fi
-        if [[ ! ${UNICODE} && ${LANG} =~ .*\.UTF-?8 ]]
-        then
+        if [[ ! ${UNICODE} && ${LANG} =~ .*\.UTF-?8 ]]; then
             UNICODE=1
         fi
         shopt -q -u nocasematch
@@ -174,10 +168,10 @@ install() {
         # determines whether non-UNICODE or UNICODE version is used
 
         if [[ ${KEYTABLE} ]]; then
-           if [[ ${UNICODE} == 1 ]]; then
-               [[ ${KEYTABLE} =~ .*\.uni.* ]] || KEYTABLE=${KEYTABLE%.map*}.uni
-           fi
-           KEYMAP=${KEYTABLE}
+            if [[ ${UNICODE} == 1 ]]; then
+                [[ ${KEYTABLE} =~ .*\.uni.* ]] || KEYTABLE=${KEYTABLE%.map*}.uni
+            fi
+            KEYMAP=${KEYTABLE}
         fi
 
         # I'm not sure of the purpose of UNIKEYMAP and GRP_TOGGLE.  They were in
@@ -191,8 +185,7 @@ install() {
 
         findkeymap ${KEYMAP}
 
-        for map in ${EXT_KEYMAPS}
-        do
+        for map in ${EXT_KEYMAPS}; do
             ddebug "Adding extra map: ${map}"
             findkeymap ${map}
         done
@@ -203,24 +196,21 @@ install() {
 
         inst_opt_decompress ${kbddir}/consolefonts/${DEFAULT_FONT}.*
 
-        if [[ ${FONT} ]] && [[ ${FONT} != ${DEFAULT_FONT} ]]
-        then
+        if [[ ${FONT} ]] && [[ ${FONT} != ${DEFAULT_FONT} ]]; then
             FONT=${FONT%.psf*}
             inst_opt_decompress ${kbddir}/consolefonts/${FONT}.*
         fi
 
-        if [[ ${FONT_MAP} ]]
-        then
+        if [[ ${FONT_MAP} ]]; then
             FONT_MAP=${FONT_MAP%.trans}
             # There are three different formats that setfont supports
             inst_simple ${kbddir}/consoletrans/${FONT_MAP} \
-            || inst_simple ${kbddir}/consoletrans/${FONT_MAP}.trans \
-            || inst_simple ${kbddir}/consoletrans/${FONT_MAP}_to_uni.trans \
-            || dwarn "Could not find FONT_MAP ${FONT_MAP}!"
+                || inst_simple ${kbddir}/consoletrans/${FONT_MAP}.trans \
+                || inst_simple ${kbddir}/consoletrans/${FONT_MAP}_to_uni.trans \
+                || dwarn "Could not find FONT_MAP ${FONT_MAP}!"
         fi
 
-        if [[ ${FONT_UNIMAP} ]]
-        then
+        if [[ ${FONT_UNIMAP} ]]; then
             FONT_UNIMAP=${FONT_UNIMAP%.uni}
             inst_simple ${kbddir}/unimaps/${FONT_UNIMAP}.uni
         fi
@@ -251,8 +241,8 @@ install() {
             kbddir=''
         done
 
-        [[ -f $dracutsysrootdir$I18N_CONF && -f $dracutsysrootdir$VCONFIG_CONF ]] || \
-            [[ ! ${hostonly} || ${i18n_vars} ]] || {
+        [[ -f $dracutsysrootdir$I18N_CONF && -f $dracutsysrootdir$VCONFIG_CONF ]] \
+            || [[ ! ${hostonly} || ${i18n_vars} ]] || {
             derror 'i18n_vars not set!  Please set up i18n_vars in ' \
                 'configuration file.'
         }
index 16c0f04e0856e1f90292b500d873dafa0f7566ce..2deb2c41af422bfa1d379bc56afe25ec8550a82f 100755 (executable)
@@ -4,9 +4,12 @@ inst_key_val() {
     local _value
     local _file
     local _default
-    _file="$1"; shift
-    _key="$1"; shift
-    _default="$1"; shift
+    _file="$1"
+    shift
+    _key="$1"
+    shift
+    _default="$1"
+    shift
     _value="$(getarg "$@")"
     [ -z "${_value}" ] && _value=$_default
     if [ -n "${_value}" ]; then
@@ -16,15 +19,15 @@ inst_key_val() {
     unset _value
 }
 
-inst_key_val /etc/vconsole.conf KEYMAP      '' rd.vconsole.keymap       KEYMAP      -d KEYTABLE
-inst_key_val /etc/vconsole.conf FONT        '' rd.vconsole.font         FONT        -d SYSFONT
-inst_key_val /etc/vconsole.conf FONT_MAP    '' rd.vconsole.font.map     FONT_MAP    -d CONTRANS
-inst_key_val /etc/vconsole.conf FONT_UNIMAP '' rd.vconsole.font.unimap  FONT_UNIMAP -d UNIMAP
-inst_key_val /etc/vconsole.conf UNICODE      1 rd.vconsole.font.unicode UNICODE vconsole.unicode
-inst_key_val /etc/vconsole.conf EXT_KEYMAP  '' rd.vconsole.keymap.ext   EXT_KEYMAP
+inst_key_val /etc/vconsole.conf KEYMAP '' rd.vconsole.keymap KEYMAP -d KEYTABLE
+inst_key_val /etc/vconsole.conf FONT '' rd.vconsole.font FONT -d SYSFONT
+inst_key_val /etc/vconsole.conf FONT_MAP '' rd.vconsole.font.map FONT_MAP -d CONTRANS
+inst_key_val /etc/vconsole.conf FONT_UNIMAP '' rd.vconsole.font.unimap FONT_UNIMAP -d UNIMAP
+inst_key_val /etc/vconsole.conf UNICODE 1 rd.vconsole.font.unicode UNICODE vconsole.unicode
+inst_key_val /etc/vconsole.conf EXT_KEYMAP '' rd.vconsole.keymap.ext EXT_KEYMAP
 
-inst_key_val /etc/locale.conf   LANG        '' rd.locale.LANG           LANG
-inst_key_val /etc/locale.conf   LC_ALL      '' rd.locale.LC_ALL         LC_ALL
+inst_key_val /etc/locale.conf LANG '' rd.locale.LANG LANG
+inst_key_val /etc/locale.conf LC_ALL '' rd.locale.LC_ALL LC_ALL
 
 if [ -f /etc/locale.conf ]; then
     . /etc/locale.conf
index 66bb4a64460ec39c1ab037c650b594d49122c0d7..6bd5df46d64d336e7b14dfa16d969aac85448aac 100755 (executable)
@@ -47,7 +47,6 @@ if ! [ -e "$ROOT/usr/bin" ]; then
     exit 1
 fi
 
-
 if ! needconvert; then
     echo "Your system is already converted."
     exit 0
@@ -82,7 +81,7 @@ find_mount() {
 
 # usage: ismounted <mountpoint>
 # usage: ismounted /dev/<device>
-if command -v findmnt >/dev/null; then
+if command -v findmnt > /dev/null; then
     ismounted() {
         findmnt "$1" > /dev/null 2>&1
     }
@@ -104,7 +103,7 @@ fi
 cleanup() {
     echo "Something failed. Move back to the original state"
     for dir in "$ROOT/bin" "$ROOT/sbin" "$ROOT/lib" "$ROOT/lib64" \
-       "$ROOT/usr/bin" "$ROOT/usr/sbin" "$ROOT/usr/lib" \
+        "$ROOT/usr/bin" "$ROOT/usr/sbin" "$ROOT/usr/lib" \
         "$ROOT/usr/lib64"; do
         [[ -d "${dir}.usrmove-new" ]] && rm -fr -- "${dir}.usrmove-new"
         if [[ -d "${dir}.usrmove-old" ]]; then
@@ -166,8 +165,8 @@ done
 echo "Clean up backup files."
 # everything seems to work; cleanup
 for dir in bin sbin lib lib64; do
-     # if we get killed in the middle of "rm -rf", ensure not to leave
-     # an incomplete directory, which is moved back by cleanup()
+    # if we get killed in the middle of "rm -rf", ensure not to leave
+    # an incomplete directory, which is moved back by cleanup()
     [[ -d "$ROOT/usr/${dir}.usrmove-old" ]] \
         && mv "$ROOT/usr/${dir}.usrmove-old" "$ROOT/usr/${dir}.usrmove-old~"
     [[ -d "$ROOT/${dir}.usrmove-old" ]] \
index a72021d2d937f8e190e39ac02cc4753853ddfebe..dfc2c64828b997ed8b9ac561bc82cec59de9c731 100755 (executable)
@@ -17,4 +17,3 @@ install() {
     inst_hook pre-pivot 99 "$moddir/do-convertfs.sh"
     inst_script "$moddir/convertfs.sh" /usr/bin/convertfs
 }
-
index fd92752b19bdd74804b92c10770cff73d6b389e8..401f3b9182f813ce78eab0876d916e5b731337fd 100755 (executable)
@@ -2,8 +2,8 @@
 
 PATH=/usr/sbin:/usr/bin:/sbin:/bin
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
-type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
+type ip_to_var > /dev/null 2>&1 || . /lib/net-lib.sh
 
 # We already need a set netif here
 netif=$interface
@@ -31,8 +31,8 @@ setup_interface() {
     # problems with UDP traffic, among other things.  As such,
     # disallow MTUs from 576 and below by default, so that broken
     # MTUs are ignored, but higher stuff is allowed (1492, 1500, etc).
-    if [ -n "$mtu" ] && [ $mtu -gt 576 ] ; then
-        if ! ip link set $netif mtu $mtu ; then
+    if [ -n "$mtu" ] && [ $mtu -gt 576 ]; then
+        if ! ip link set $netif mtu $mtu; then
             ip link set $netif down
             ip link set $netif mtu $mtu
             linkup $netif
@@ -43,8 +43,8 @@ setup_interface() {
         ${lease_time:+valid_lft $lease_time} \
         ${preferred_lft:+preferred_lft ${preferred_lft}}
 
-    if [ -n "$gw" ] ; then
-        if [ "$mask" = "255.255.255.255" ] ; then
+    if [ -n "$gw" ]; then
+        if [ "$mask" = "255.255.255.255" ]; then
             # point-to-point connection => set explicit route to gateway
             echo ip route add $gw dev $netif > /tmp/net.$netif.gw
         fi
@@ -52,7 +52,7 @@ setup_interface() {
         echo "$gw" | {
             IFS=' ' read -r main_gw other_gw
             echo ip route replace default via $main_gw dev $netif >> /tmp/net.$netif.gw
-            if [ -n "$other_gw" ] ; then
+            if [ -n "$other_gw" ]; then
                 for g in $other_gw; do
                     echo ip route add default via $g dev $netif >> /tmp/net.$netif.gw
                 done
@@ -62,7 +62,7 @@ setup_interface() {
 
     if getargbool 1 rd.peerdns; then
         [ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
-        if  [ -n "$namesrv" ] ; then
+        if [ -n "$namesrv" ]; then
             for s in $namesrv; do
                 echo nameserver $s
             done
@@ -92,7 +92,7 @@ setup_interface6() {
 
     if getargbool 1 rd.peerdns; then
         [ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
-        if  [ -n "$namesrv" ] ; then
+        if [ -n "$namesrv" ]; then
             for s in $namesrv; do
                 echo nameserver $s
             done
@@ -119,13 +119,19 @@ parse_option_121() {
         # Parse the arguments into a CIDR net/mask string
         if [ $mask -gt 24 ]; then
             destination="$1.$2.$3.$4/$mask"
-            shift; shift; shift; shift
+            shift
+            shift
+            shift
+            shift
         elif [ $mask -gt 16 ]; then
             destination="$1.$2.$3.0/$mask"
-            shift; shift; shift
+            shift
+            shift
+            shift
         elif [ $mask -gt 8 ]; then
             destination="$1.$2.0.0/$mask"
-            shift; shift
+            shift
+            shift
         elif [ $mask -gt 0 ]; then
             destination="$1.0.0.0/$mask"
             shift
@@ -135,7 +141,10 @@ parse_option_121() {
 
         # Read the gateway
         gateway="$1.$2.$3.$4"
-        shift; shift; shift; shift
+        shift
+        shift
+        shift
+        shift
 
         # Multicast routing on Linux
         #  - If you set a next-hop address for a multicast group, this breaks with Cisco switches
@@ -150,7 +159,6 @@ parse_option_121() {
     done
 }
 
-
 case $reason in
     PREINIT)
         echo "dhcp: PREINIT $netif up"
@@ -170,13 +178,13 @@ case $reason in
             read layer2 < /sys/class/net/$netif/device/layer2
         fi
         if [ "$layer2" != "0" ]; then
-            if command -v arping2 >/dev/null; then
-                if arping2 -q -C 1 -c 2 -I $netif -0 $new_ip_address ; then
+            if command -v arping2 > /dev/null; then
+                if arping2 -q -C 1 -c 2 -I $netif -0 $new_ip_address; then
                     warn "Duplicate address detected for $new_ip_address while doing dhcp. retrying"
                     exit 1
                 fi
             else
-                if ! arping -f -q -D -c 2 -I $netif $new_ip_address ; then
+                if ! arping -f -q -D -c 2 -I $netif $new_ip_address; then
                     warn "Duplicate address detected for $new_ip_address while doing dhcp. retrying"
                     exit 1
                 fi
@@ -187,7 +195,7 @@ case $reason in
         set | while read line || [ -n "$line" ]; do
             [ "${line#new_}" = "$line" ] && continue
             echo "$line"
-        done >/tmp/dhclient.$netif.dhcpopts
+        done > /tmp/dhclient.$netif.dhcpopts
 
         {
             echo '. /lib/net-lib.sh'
@@ -204,22 +212,22 @@ case $reason in
         } > $hookdir/initqueue/setup_net_$netif.sh
 
         echo "[ -f /tmp/net.$netif.did-setup ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
-        >/tmp/net.$netif.up
+        > /tmp/net.$netif.up
         if [ -e /sys/class/net/${netif}/address ]; then
             > /tmp/net.$(cat /sys/class/net/${netif}/address).up
         fi
 
         ;;
 
-    RENEW|REBIND)
+    RENEW | REBIND)
         unset lease_time
         [ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
         [ -n "$new_max_life" ] && lease_time=$new_max_life
         preferred_lft=$lease_time
         [ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life
         ip -4 addr change ${new_ip_address}/${new_subnet_mask} broadcast ${new_broadcast_address} dev ${interface} \
-           ${lease_time:+valid_lft $lease_time} ${preferred_lft:+preferred_lft ${preferred_lft}} \
-           >/dev/null 2>&1
+            ${lease_time:+valid_lft $lease_time} ${preferred_lft:+preferred_lft ${preferred_lft}} \
+            > /dev/null 2>&1
         ;;
 
     BOUND6)
@@ -229,7 +237,7 @@ case $reason in
         set | while read line || [ -n "$line" ]; do
             [ "${line#new_}" = "$line" ] && continue
             echo "$line"
-        done >/tmp/dhclient.$netif.dhcpopts
+        done > /tmp/dhclient.$netif.dhcpopts
 
         {
             echo '. /lib/net-lib.sh'
@@ -240,24 +248,24 @@ case $reason in
         } > $hookdir/initqueue/setup_net_$netif.sh
 
         echo "[ -f /tmp/net.$netif.did-setup ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
-        >/tmp/net.$netif.up
+        > /tmp/net.$netif.up
         if [ -e /sys/class/net/${netif}/address ]; then
             > /tmp/net.$(cat /sys/class/net/${netif}/address).up
         fi
         ;;
 
-    RENEW6|REBIND6)
+    RENEW6 | REBIND6)
         unset lease_time
         [ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
         [ -n "$new_max_life" ] && lease_time=$new_max_life
         preferred_lft=$lease_time
         [ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life
         ip -6 addr change ${new_ip6_address}/${new_ip6_prefixlen} dev ${interface} scope global \
-           ${lease_time:+valid_lft $lease_time} ${preferred_lft:+preferred_lft ${preferred_lft}} \
-           >/dev/null 2>&1
+            ${lease_time:+valid_lft $lease_time} ${preferred_lft:+preferred_lft ${preferred_lft}} \
+            > /dev/null 2>&1
         ;;
 
-    *) echo "dhcp: $reason";;
+    *) echo "dhcp: $reason" ;;
 esac
 
 exit 0
index 8c58a69526d77ebb8a3686c3303ac398a5364c8b..93f22241c6c7d4652aaa6aa866ff1579609efb2f 100755 (executable)
@@ -23,14 +23,14 @@ do_dhclient() {
     while [ $_COUNT -lt $_DHCPRETRY ]; do
         info "Starting dhcp for interface $netif"
         dhclient $arg \
-                 ${_timeout:+--timeout $_timeout} \
-                 -q \
-                 -1 \
-                 -cf /etc/dhclient.conf \
-                 -pf /tmp/dhclient.$netif.pid \
-                 -lf /tmp/dhclient.$netif.lease \
-                 $netif &
-        wait $! 2>/dev/null
+            ${_timeout:+--timeout $_timeout} \
+            -q \
+            -1 \
+            -cf /etc/dhclient.conf \
+            -pf /tmp/dhclient.$netif.pid \
+            -lf /tmp/dhclient.$netif.lease \
+            $netif &
+        wait $! 2> /dev/null
 
         # wait will return the return value of dhclient
         retv=$?
@@ -45,7 +45,7 @@ do_dhclient() {
         # find the process with that pid and return error code 127. In that
         # case we need to check if /tmp/dhclient.$netif.lease exists. If it
         # does, it means dhclient finished executing before wait was called,
-        # and it was successful (return 0). If /tmp/dhclient.$netif.lease 
+        # and it was successful (return 0). If /tmp/dhclient.$netif.lease
         # does not exist, then it means dhclient was killed by another thread
         # or it finished execution but failed dhcp on that interface.
 
@@ -56,14 +56,14 @@ do_dhclient() {
                 info "PID $pid not found but DHCP successful on $netif"
                 return 0
             fi
-        fi    
+        fi
 
-        _COUNT=$(($_COUNT+1))
+        _COUNT=$(($_COUNT + 1))
         [ $_COUNT -lt $_DHCPRETRY ] && sleep 1
     done
     warn "dhcp for interface $netif failed"
     # nuke those files since we failed; we might retry dhcp again if it's e.g.
-    # `ip=dhcp,dhcp6` and we check for the PID file earlier 
+    # `ip=dhcp,dhcp6` and we check for the PID file earlier
     rm -f /tmp/dhclient.$netif.{pid,lease}
     return 1
 }
@@ -85,15 +85,15 @@ if [ $ret -eq 0 ]; then
     fi
 
     # Check if DHCP also suceeded on another interface before this one.
-    # We will always use the first one on which DHCP succeeded, by using 
+    # We will always use the first one on which DHCP succeeded, by using
     # a commom file $IFNETFILE, to synchronize between threads.
-    # Consider the race condition in which multiple threads 
+    # Consider the race condition in which multiple threads
     # corresponding to different interfaces may try to read $IFNETFILE
     # and find it does not exist; they may all end up thinking they are the
     # first to succeed (hence more than one thread may end up writing to
-    # $IFNETFILE). To take care of this, instead of checking if $IFNETFILE 
+    # $IFNETFILE). To take care of this, instead of checking if $IFNETFILE
     # exists to determine if we are the first, we create a symbolic link
-    # in $IFNETFILE, pointing to the interface name ($netif), thus storing 
+    # in $IFNETFILE, pointing to the interface name ($netif), thus storing
     # the interface name in the link pointer.
     # Creating a link will fail, if the link already exists, hence kernel
     # will take care of allowing only first thread to create link, which
@@ -101,22 +101,22 @@ if [ $ret -eq 0 ]; then
     # Also, the link points to the interface name, which will tell us which
     # interface succeeded.
 
-    if ln -s $netif $IFNETFILE 2>/dev/null; then
+    if ln -s $netif $IFNETFILE 2> /dev/null; then
         intf=$(readlink $IFNETFILE)
         if [ -e /tmp/dhclient.$intf.lease ]; then
             info "DHCP successful on interface $intf"
-            # Kill all existing dhclient calls for other interfaces, since we 
+            # Kill all existing dhclient calls for other interfaces, since we
             # already got one successful interface
 
             npid=$(cat /tmp/dhclient.$netif.pid)
             pidlist=$(pgrep dhclient)
             for pid in $pidlist; do
                 [ "$pid" -eq "$npid" ] && continue
-                kill -9 $pid >/dev/null 2>&1
+                kill -9 $pid > /dev/null 2>&1
             done
         else
             echo "ERROR! $IFNETFILE exists but /tmp/dhclient.$intf.lease does not exist!!!"
-         fi
+        fi
     else
         info "DHCP success on $netif, and also on $intf"
         exit 0
index 2aaf393af4b8721b9ea60e9ac99856b9db6d6a52..46a15c5ca766dbeb879e87c5205d0fee7b2e5c44 100755 (executable)
@@ -7,8 +7,8 @@
 # or it is for manually bring up network ie. for kdump scp vmcore
 PATH=/usr/sbin:/usr/bin:/sbin:/bin
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
-type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
+type ip_to_var > /dev/null 2>&1 || . /lib/net-lib.sh
 
 # Huh? No $1?
 [ -z "$1" ] && exit 1
@@ -17,7 +17,7 @@ type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
 netif=$1
 
 # loopback is always handled the same way
-if [ "$netif" = "lo" ] ; then
+if [ "$netif" = "lo" ]; then
     ip link set lo up
     ip addr add 127.0.0.1/8 dev lo
     exit 0
@@ -36,15 +36,15 @@ do_dhcp_parallel() {
     fi
 
     bootintf=$(readlink $IFNETFILE)
-    if [ ! -z $bootintf ]  && [ -e /tmp/dhclient.$bootintf.lease ]; then
+    if [ ! -z $bootintf ] && [ -e /tmp/dhclient.$bootintf.lease ]; then
         info "DHCP already succeeded for $bootintf, exiting for $netif"
-        return 1;
+        return 1
     fi
 
     if [ ! -e /run/NetworkManager/conf.d/10-dracut-dhclient.conf ]; then
         mkdir -p /run/NetworkManager/conf.d
         echo '[main]' > /run/NetworkManager/conf.d/10-dracut-dhclient.conf
-        echo 'dhcp=dhclient' >>/run/NetworkManager/conf.d/10-dracut-dhclient.conf
+        echo 'dhcp=dhclient' >> /run/NetworkManager/conf.d/10-dracut-dhclient.conf
     fi
 
     chmod +x /sbin/dhcp-multi.sh
@@ -73,21 +73,21 @@ do_dhcp() {
     if [ ! -e /run/NetworkManager/conf.d/10-dracut-dhclient.conf ]; then
         mkdir -p /run/NetworkManager/conf.d
         echo '[main]' > /run/NetworkManager/conf.d/10-dracut-dhclient.conf
-        echo 'dhcp=dhclient' >>/run/NetworkManager/conf.d/10-dracut-dhclient.conf
+        echo 'dhcp=dhclient' >> /run/NetworkManager/conf.d/10-dracut-dhclient.conf
     fi
 
     while [ $_COUNT -lt $_DHCPRETRY ]; do
         info "Starting dhcp for interface $netif"
         dhclient "$@" \
-                 ${_timeout:+--timeout $_timeout} \
-                 -q \
-                 -1 \
-                 -cf /etc/dhclient.conf \
-                 -pf /tmp/dhclient.$netif.pid \
-                 -lf /tmp/dhclient.$netif.lease \
-                 $netif \
+            ${_timeout:+--timeout $_timeout} \
+            -q \
+            -1 \
+            -cf /etc/dhclient.conf \
+            -pf /tmp/dhclient.$netif.pid \
+            -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
@@ -148,7 +148,7 @@ do_static() {
         return 1
     fi
 
-    ip route get "$ip" 2>/dev/null | {
+    ip route get "$ip" 2> /dev/null | {
         read a rest
         if [ "$a" = "local" ]; then
             warn "Not assigning $ip to interface $netif, cause it is already assigned!"
@@ -168,13 +168,13 @@ do_static() {
         wait_for_ipv6_dad $netif
     else
         if [ -z "$srv" ]; then
-            if command -v arping2 >/dev/null; then
-                if arping2 -q -C 1 -c 2 -I $netif -0 $ip ; then
+            if command -v arping2 > /dev/null; then
+                if arping2 -q -C 1 -c 2 -I $netif -0 $ip; then
                     warn "Duplicate address detected for $ip for interface $netif."
                     return 1
                 fi
             else
-                if ! arping -f -q -D -c 2 -I $netif $ip ; then
+                if ! arping -f -q -D -c 2 -I $netif $ip; then
                     warn "Duplicate address detected for $ip for interface $netif."
                     return 1
                 fi
@@ -192,12 +192,12 @@ do_static() {
 
 get_vid() {
     case "$1" in
-    vlan*)
-        echo ${1#vlan}
-        ;;
-    *.*)
-        echo ${1##*.}
-        ;;
+        vlan*)
+            echo ${1#vlan}
+            ;;
+        *.*)
+            echo ${1##*.}
+            ;;
     esac
 }
 
@@ -230,7 +230,6 @@ if ! [ -e /tmp/vlan.${netif}.phy ]; then
     done
 fi
 
-
 # bridge this interface?
 if [ -z "$NO_BRIDGE_MASTER" ]; then
     for i in /tmp/bridge.*.info; do
@@ -238,7 +237,7 @@ if [ -z "$NO_BRIDGE_MASTER" ]; then
         unset bridgeslaves
         unset bridgename
         . "$i"
-        for ethname in $bridgeslaves ; do
+        for ethname in $bridgeslaves; do
             [ "$netif" != "$ethname" ] && continue
 
             NO_BRIDGE_MASTER=yes NO_AUTO_DHCP=yes ifup $ethname
@@ -262,40 +261,40 @@ if [ -z "$NO_BOND_MASTER" ]; then
         unset bondslaves
         unset bondname
         . "$i"
-        for slave in $bondslaves ; do
+        for slave in $bondslaves; do
             [ "$netif" != "$slave" ] && continue
 
             # already setup
             [ -e /tmp/bond.$bondname.up ] && exit 0
 
             # wait for all slaves to show up
-            for slave in $bondslaves ; do
+            for slave in $bondslaves; do
                 # try to create the slave (maybe vlan or bridge)
                 NO_BOND_MASTER=yes NO_AUTO_DHCP=yes ifup $slave
 
-                if ! ip link show dev $slave >/dev/null 2>&1; then
+                if ! ip link show dev $slave > /dev/null 2>&1; then
                     # wait for the last slave to show up
                     exit 0
                 fi
             done
 
             modprobe -q -b bonding
-            echo "+$bondname" >  /sys/class/net/bonding_masters 2>/dev/null
+            echo "+$bondname" > /sys/class/net/bonding_masters 2> /dev/null
             ip link set $bondname down
 
             # Stolen from ifup-eth
             # add the bits to setup driver parameters here
-            for arg in $bondoptions ; do
-                key=${arg%%=*};
-                value=${arg##*=};
+            for arg in $bondoptions; do
+                key=${arg%%=*}
+                value=${arg##*=}
                 # %{value:0:1} is replaced with non-bash specific construct
                 if [ "${key}" = "arp_ip_target" -a "${#value}" != "0" -a "+${value%%+*}" != "+" ]; then
-                    OLDIFS=$IFS;
-                    IFS=',';
+                    OLDIFS=$IFS
+                    IFS=','
                     for arp_ip in $value; do
                         echo +$arp_ip > /sys/class/net/${bondname}/bonding/$key
                     done
-                    IFS=$OLDIFS;
+                    IFS=$OLDIFS
                 else
                     echo $value > /sys/class/net/${bondname}/bonding/$key
                 fi
@@ -303,7 +302,7 @@ if [ -z "$NO_BOND_MASTER" ]; then
 
             linkup $bondname
 
-            for slave in $bondslaves ; do
+            for slave in $bondslaves; do
                 cat /sys/class/net/$slave/address > /tmp/net.${bondname}.${slave}.hwaddr
                 ip link set $slave down
                 echo "+$slave" > /sys/class/net/$bondname/bonding/slaves
@@ -314,9 +313,9 @@ if [ -z "$NO_BOND_MASTER" ]; then
             [ -n "$bondmtu" ] && ip link set mtu $bondmtu dev $bondname
 
             # add the bits to setup the needed post enslavement parameters
-            for arg in $bondoptions ; do
-                key=${arg%%=*};
-                value=${arg##*=};
+            for arg in $bondoptions; do
+                key=${arg%%=*}
+                value=${arg##*=}
                 if [ "${key}" = "primary" ]; then
                     echo $value > /sys/class/net/${bondname}/bonding/$key
                 fi
@@ -336,30 +335,30 @@ if [ -z "$NO_TEAM_MASTER" ]; then
         unset teammaster
         unset teamslaves
         . "$i"
-        for slave in $teamslaves ; do
+        for slave in $teamslaves; do
             [ "$netif" != "$slave" ] && continue
 
             [ -e /tmp/team.$teammaster.up ] && exit 0
 
             # wait for all slaves to show up
-            for slave in $teamslaves ; do
+            for slave in $teamslaves; do
                 # try to create the slave (maybe vlan or bridge)
                 NO_TEAM_MASTER=yes NO_AUTO_DHCP=yes ifup $slave
 
-                if ! ip link show dev $slave >/dev/null 2>&1; then
+                if ! ip link show dev $slave > /dev/null 2>&1; then
                     # wait for the last slave to show up
                     exit 0
                 fi
             done
 
-            if [ ! -e /tmp/team.$teammaster.up ] ; then
+            if [ ! -e /tmp/team.$teammaster.up ]; then
                 # We shall only bring up those _can_ come up
                 # in case of some slave is gone in active-backup mode
                 working_slaves=""
-                for slave in $teamslaves ; do
-                    teamdctl ${teammaster} port present ${slave} 2>/dev/null \
+                for slave in $teamslaves; do
+                    teamdctl ${teammaster} port present ${slave} 2> /dev/null \
                         && continue
-                    ip link set dev $slave up 2>/dev/null
+                    ip link set dev $slave up 2> /dev/null
                     if wait_for_if_up $slave; then
                         working_slaves="$working_slaves$slave "
                     fi
@@ -399,7 +398,7 @@ if [ -z "$NO_TEAM_MASTER" ]; then
 fi
 
 # all synthetic interfaces done.. now check if the interface is available
-if ! ip link show dev $netif >/dev/null 2>&1; then
+if ! ip link show dev $netif > /dev/null 2>&1; then
     exit 1
 fi
 
@@ -408,16 +407,15 @@ fi
 [ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2"
 
 if [ -n "$manualup" ]; then
-    >/tmp/net.$netif.manualup
+    > /tmp/net.$netif.manualup
     rm -f /tmp/net.${netif}.did-setup
 else
     [ -e /tmp/net.${netif}.did-setup ] && exit 0
-    [ -z "$DO_VLAN" ] && \
-    [ -e /sys/class/net/$netif/address ] && \
-        [ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && exit 0
+    [ -z "$DO_VLAN" ] \
+        && [ -e /sys/class/net/$netif/address ] \
+        && [ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && exit 0
 fi
 
-
 # Specific configuration, spin through the kernel command line
 # looking for ip= lines
 for p in $(getargs ip=); do
@@ -426,11 +424,11 @@ for p in $(getargs ip=); do
     [ "$autoconf" = "ibft" ] && continue
 
     case "$dev" in
-        ??:??:??:??:??:??)  # MAC address
+        ??:??:??:??:??:??) # MAC address
             _dev=$(iface_for_mac $dev)
             [ -n "$_dev" ] && dev="$_dev"
             ;;
-        ??-??-??-??-??-??)  # MAC address in BOOTIF form
+        ??-??-??-??-??-??) # MAC address in BOOTIF form
             _dev=$(iface_for_mac $(fix_bootif $dev))
             [ -n "$_dev" ] && dev="$_dev"
             ;;
@@ -450,22 +448,29 @@ for p in $(getargs ip=); do
 
     for autoopt in $(str_replace "$autoconf" "," " "); do
         case $autoopt in
-            dhcp|on|any)
-                do_dhcp -4 ;;
+            dhcp | on | any)
+                do_dhcp -4
+                ;;
             single-dhcp)
                 do_dhcp_parallel -4
-                exit 0 ;;
+                exit 0
+                ;;
             dhcp6)
                 load_ipv6
-                do_dhcp -6 ;;
+                do_dhcp -6
+                ;;
             auto6)
-                do_ipv6auto ;;
+                do_ipv6auto
+                ;;
             either6)
-                do_ipv6auto || do_dhcp -6 ;;
+                do_ipv6auto || do_dhcp -6
+                ;;
             link6)
-                do_ipv6link ;;
+                do_ipv6link
+                ;;
             *)
-                do_static ;;
+                do_static
+                ;;
         esac
     done
     ret=$?
@@ -479,7 +484,7 @@ for p in $(getargs ip=); do
     if [ $ret -eq 0 ]; then
         > /tmp/net.${netif}.up
 
-        if  [ -z "$DO_VLAN" ] && [ -e /sys/class/net/${netif}/address ]; then
+        if [ -z "$DO_VLAN" ] && [ -e /sys/class/net/${netif}/address ]; then
             > /tmp/net.$(cat /sys/class/net/${netif}/address).up
         fi
 
@@ -493,7 +498,7 @@ for p in $(getargs ip=); do
             fi
         fi
 
-        if command -v wicked >/dev/null && [ -z "$manualup" ]; then
+        if command -v wicked > /dev/null && [ -z "$manualup" ]; then
             /sbin/netroot $netif
         fi
 
@@ -514,12 +519,12 @@ if [ -z "$NO_AUTO_DHCP" ] && [ ! -e /tmp/net.${netif}.up ]; then
         # No ip lines, no bootdev -> default to dhcp
         ip=$(getarg ip)
 
-        if getargs 'ip=dhcp6' >/dev/null || [ -z "$ip" -a "$netroot" = "dhcp6" ]; then
+        if getargs 'ip=dhcp6' > /dev/null || [ -z "$ip" -a "$netroot" = "dhcp6" ]; then
             load_ipv6
             do_dhcp -6
             ret=$?
         fi
-        if getargs 'ip=dhcp' >/dev/null || [ -z "$ip" -a "$netroot" != "dhcp6" ]; then
+        if getargs 'ip=dhcp' > /dev/null || [ -z "$ip" -a "$netroot" != "dhcp6" ]; then
             do_dhcp -4
             ret=$?
         fi
@@ -530,11 +535,11 @@ if [ -z "$NO_AUTO_DHCP" ] && [ ! -e /tmp/net.${netif}.up ]; then
         echo nameserver $s >> /tmp/net.$netif.resolv.conf
     done
 
-    if [ "$ret" -eq 0 ] && [ -n "$(ls /tmp/leaseinfo.${netif}* 2>/dev/null)" ]; then
-         > /tmp/net.${netif}.did-setup
-         if [ -e /sys/class/net/${netif}/address ]; then
-             > /tmp/net.$(cat /sys/class/net/${netif}/address).did-setup
-         fi
+    if [ "$ret" -eq 0 ] && [ -n "$(ls /tmp/leaseinfo.${netif}* 2> /dev/null)" ]; then
+        > /tmp/net.${netif}.did-setup
+        if [ -e /sys/class/net/${netif}/address ]; then
+            > /tmp/net.$(cat /sys/class/net/${netif}/address).did-setup
+        fi
     fi
 fi
 
index 9a17495ac6385d912c21b3fd80b96ecd87aa7e10..363abf95d25cfd73566cb0bdfe1e7283cc69decc 100755 (executable)
@@ -2,14 +2,14 @@
 
 for f in /tmp/dhclient.*.pid; do
     [ -e $f ] || continue
-    read PID < $f;
-    kill $PID >/dev/null 2>&1
+    read PID < $f
+    kill $PID > /dev/null 2>&1
 done
 
 sleep 0.1
 
 for f in /tmp/dhclient.*.pid; do
     [ -e $f ] || continue
-    read PID < $f;
-    kill -9 $PID >/dev/null 2>&1
+    read PID < $f
+    kill -9 $PID > /dev/null 2>&1
 done
index 0f44be3da5de2df3f6009d5a28cb2cb2c1455985..7f31914a1aa0cf3cfec1ad00bac439ad28a685cc 100755 (executable)
@@ -62,7 +62,7 @@ install() {
         (
             . "$i"
             if ! [ "${ONBOOT}" = "no" -o "${ONBOOT}" = "NO" ] \
-                    && [ -n "${TEAM_MASTER}${TEAM_CONFIG}${TEAM_PORT_CONFIG}" ]; then
+                && [ -n "${TEAM_MASTER}${TEAM_CONFIG}${TEAM_PORT_CONFIG}" ]; then
                 if [ -n "$TEAM_CONFIG" ] && [ -n "$DEVICE" ]; then
                     mkdir -p $initdir/etc/teamd
                     printf -- "%s" "$TEAM_CONFIG" > "$initdir/etc/teamd/${DEVICE}.conf"
@@ -90,4 +90,3 @@ install() {
 
     dracut_need_initqueue
 }
-
index 41ee93fb863d616fc9e95ad08b503082995bf3fe..7252900e09cdafa6efdc9b1e4d67b138cf883ec2 100755 (executable)
@@ -7,7 +7,7 @@ if [ -z "$netroot" ] && [ ! -e "/tmp/net.ifaces" ] && [ "$NEEDNET" != "1" ]; the
     return
 fi
 
-command -v fix_bootif >/dev/null || . /lib/net-lib.sh
+command -v fix_bootif > /dev/null || . /lib/net-lib.sh
 
 # Write udev rules
 {
@@ -75,15 +75,15 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
         echo 'ACTION!="add|change|move", GOTO="net_end"'
         for iface in $IFACES $RAW_IFACES; do
             case "$iface" in
-                ??:??:??:??:??:??)  # MAC address
+                ??:??:??:??:??:??) # MAC address
                     cond="ATTR{address}==\"$iface\""
                     echo "$cond, $runcmd, GOTO=\"net_end\""
                     ;;
-                ??-??-??-??-??-??)  # MAC address in BOOTIF form
+                ??-??-??-??-??-??) # MAC address in BOOTIF form
                     cond="ATTR{address}==\"$(fix_bootif $iface)\""
                     echo "$cond, $runcmd, GOTO=\"net_end\""
                     ;;
-                *)                  # an interface name
+                *) # an interface name
                     cond="ENV{INTERFACE}==\"$iface\""
                     echo "$cond, $runcmd, GOTO=\"net_end\""
                     cond="NAME==\"$iface\""
@@ -96,11 +96,11 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
 
         for iface in $IFACES; do
             if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then
-               if [ -n "$netroot" ] && [ -n "$DRACUT_SYSTEMD" ]; then
+                if [ -n "$netroot" ] && [ -n "$DRACUT_SYSTEMD" ]; then
                     echo "systemctl is-active initrd-root-device.target || [ -f /tmp/net.${iface}.did-setup ]"
-               else
+                else
                     echo "[ -f /tmp/net.${iface}.did-setup ]"
-               fi >$hookdir/initqueue/finished/wait-$iface.sh
+                fi > $hookdir/initqueue/finished/wait-$iface.sh
             fi
         done
     # Default: We don't know the interface to use, handle all
@@ -110,9 +110,9 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
         # if you change the name of "91-default-net.rules", also change modules.d/80cms/cmssetup.sh
         echo "$cond, $runcmd" > /etc/udev/rules.d/91-default-net.rules
         if [ "$NEEDNET" = "1" ]; then
-            echo 'for i in /tmp/net.*.did-setup; do [ -f "$i" ]  && exit 0; done; exit 1' >$hookdir/initqueue/finished/wait-network.sh
+            echo 'for i in /tmp/net.*.did-setup; do [ -f "$i" ]  && exit 0; done; exit 1' > $hookdir/initqueue/finished/wait-network.sh
         fi
     fi
 
-# if you change the name of "90-net.rules", also change modules.d/80cms/cmssetup.sh
+    # if you change the name of "90-net.rules", also change modules.d/80cms/cmssetup.sh
 } > /etc/udev/rules.d/90-net.rules
index c35c81d63bf19dd51b51a6caf29f969183608cb6..becd1e263260d934794d2ed096561cba2ccb448d 100755 (executable)
@@ -23,12 +23,30 @@ parsebond() {
     done
 
     case $# in
-    0)  bondname=bond0; bondslaves="eth0 eth1" ;;
-    1)  bondname=$1; bondslaves="eth0 eth1" ;;
-    2)  bondname=$1; bondslaves=$(str_replace "$2" "," " ") ;;
-    3)  bondname=$1; bondslaves=$(str_replace "$2" "," " "); bondoptions=$(str_replace "$3" "," " ") ;;
-    4)  bondname=$1; bondslaves=$(str_replace "$2" "," " "); bondoptions=$(str_replace "$3" "," " "); bondmtu=$4;;
-    *)  die "bond= requires zero to four parameters" ;;
+        0)
+            bondname=bond0
+            bondslaves="eth0 eth1"
+            ;;
+        1)
+            bondname=$1
+            bondslaves="eth0 eth1"
+            ;;
+        2)
+            bondname=$1
+            bondslaves=$(str_replace "$2" "," " ")
+            ;;
+        3)
+            bondname=$1
+            bondslaves=$(str_replace "$2" "," " ")
+            bondoptions=$(str_replace "$3" "," " ")
+            ;;
+        4)
+            bondname=$1
+            bondslaves=$(str_replace "$2" "," " ")
+            bondoptions=$(str_replace "$3" "," " ")
+            bondmtu=$4
+            ;;
+        *) die "bond= requires zero to four parameters" ;;
     esac
 }
 
index 5c3af292920e33622bf89a97987084d2722839fe..6a5732405d016891b340f5422b05ce35239ffddf 100755 (executable)
@@ -15,10 +15,16 @@ parsebridge() {
         v=${v#*:}
     done
     case $# in
-        0)  bridgename=br0; bridgeslaves=$iface ;;
-        1)  die "bridge= requires two parameters" ;;
-        2)  bridgename=$1; bridgeslaves=$(str_replace "$2" "," " ") ;;
-        *)  die "bridge= requires two parameters" ;;
+        0)
+            bridgename=br0
+            bridgeslaves=$iface
+            ;;
+        1) die "bridge= requires two parameters" ;;
+        2)
+            bridgename=$1
+            bridgeslaves=$(str_replace "$2" "," " ")
+            ;;
+        *) die "bridge= requires two parameters" ;;
     esac
 }
 
index 8895b04e77637aebb4c3b6e639a399f5e75f4853..1937f138a8da2262a0946dd0dd1fd67eccd52cd2 100755 (executable)
@@ -1,10 +1,10 @@
 #!/bin/sh
 
-command -v getarg >/dev/null          || . /lib/dracut-lib.sh
-command -v ibft_to_cmdline >/dev/null || . /lib/net-lib.sh
+command -v getarg > /dev/null || . /lib/dracut-lib.sh
+command -v ibft_to_cmdline > /dev/null || . /lib/net-lib.sh
 
 if getargbool 0 rd.iscsi.ibft -d "ip=ibft"; then
-    modprobe -b -q iscsi_boot_sysfs 2>/dev/null
+    modprobe -b -q iscsi_boot_sysfs 2> /dev/null
     modprobe -b -q iscsi_ibft
     ibft_to_cmdline
 fi
index d5ba01f63661f0c861650b046234b768f849b0ee..d85de885b917f73568c83bfb4ca8ac9e4fcb5afc 100755 (executable)
 # an ifname= argument for each interface used in an ip= or fcoe= argument
 
 # check if there are any ifname parameters
-if ! getarg ifname= >/dev/null ; then
+if ! getarg ifname= > /dev/null; then
     return
 fi
 
-command -v parse_ifname_opts >/dev/null || . /lib/net-lib.sh
+command -v parse_ifname_opts > /dev/null || . /lib/net-lib.sh
 
 # Check ifname= lines
 for p in $(getargs ifname=); do
index a93fbd90c3cc006474be413596266eb59db5745d..69b2fa350c98a179df004e743fc9ce6e1e812f70 100755 (executable)
 # routing,dns,dhcp-options,etc.
 #
 
-command -v getarg >/dev/null          || . /lib/dracut-lib.sh
+command -v getarg > /dev/null || . /lib/dracut-lib.sh
 
 if [ -n "$netroot" ] && [ -z "$(getarg ip=)" ] && [ -z "$(getarg BOOTIF=)" ]; then
     # No ip= argument(s) for netroot provided, defaulting to DHCP
-    return;
+    return
 fi
 
 # Count ip= lines to decide whether we need bootdev= or not
-if [ -z "$NEEDBOOTDEV" ] ; then
+if [ -z "$NEEDBOOTDEV" ]; then
     count=0
     for p in $(getargs ip=); do
         case "$p" in
             ibft)
-                continue;;
+                continue
+                ;;
         esac
-        count=$(( $count + 1 ))
+        count=$(($count + 1))
     done
     [ $count -gt 1 ] && NEEDBOOTDEV=1
 fi
@@ -59,7 +60,7 @@ for p in $(getargs ip=); do
     [ "$autoconf" = "ibft" ] && continue
 
     # Empty autoconf defaults to 'dhcp'
-    if [ -z "$autoconf" ] ; then
+    if [ -z "$autoconf" ]; then
         warn "Empty autoconf values default to dhcp"
         autoconf="dhcp"
     fi
@@ -67,30 +68,30 @@ for p in $(getargs ip=); do
     # Error checking for autoconf in combination with other values
     for autoopt in $(str_replace "$autoconf" "," " "); do
         case $autoopt in
-            error) die "Error parsing option 'ip=$p'";;
-            bootp|rarp|both) die "Sorry, ip=$autoopt is currenty unsupported";;
-            none|off)
-                [ -z "$ip" ] && \
-                    die "For argument 'ip=$p'\nValue '$autoopt' without static configuration does not make sense"
-                [ -z "$mask" ] && \
-                    die "Sorry, automatic calculation of netmask is not yet supported"
+            error) die "Error parsing option 'ip=$p'" ;;
+            bootp | rarp | both) die "Sorry, ip=$autoopt is currenty unsupported" ;;
+            none | off)
+                [ -z "$ip" ] \
+                    && die "For argument 'ip=$p'\nValue '$autoopt' without static configuration does not make sense"
+                [ -z "$mask" ] \
+                    && die "Sorry, automatic calculation of netmask is not yet supported"
                 ;;
-            auto6|link6);;
-            either6);;
-            dhcp|dhcp6|on|any|single-dhcp) \
-                [ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
-                    die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
-                [ -n "$ip" ] && \
-                    die "For argument 'ip=$p'\nSorry, setting client-ip does not make sense for '$autoopt'"
+            auto6 | link6) ;;
+            either6) ;;
+            dhcp | dhcp6 | on | any | single-dhcp)
+                [ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] \
+                    && die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
+                [ -n "$ip" ] \
+                    && die "For argument 'ip=$p'\nSorry, setting client-ip does not make sense for '$autoopt'"
                 ;;
-            *) die "For argument 'ip=$p'\nSorry, unknown value '$autoopt'";;
+            *) die "For argument 'ip=$p'\nSorry, unknown value '$autoopt'" ;;
         esac
     done
 
-    if [ -n "$dev" ] ; then
+    if [ -n "$dev" ]; then
         # We don't like duplicate device configs
-        if [ -n "$IFACES" ] ; then
-            for i in $IFACES ; do
+        if [ -n "$IFACES" ]; then
+            for i in $IFACES; do
                 [ "$dev" = "$i" ] && die "For argument 'ip=$p'\nDuplication configurations for '$dev'"
             done
         fi
@@ -99,7 +100,7 @@ for p in $(getargs ip=); do
     fi
 
     # Do we need to check for specific options?
-    if [ -n "$NEEDDHCP" ] || [ -n "$DHCPORSERVER" ] ; then
+    if [ -n "$NEEDDHCP" ] || [ -n "$DHCPORSERVER" ]; then
         # Correct device? (Empty is ok as well)
         [ "$dev" = "$BOOTDEV" ] || continue
         # Server-ip is there?
@@ -113,13 +114,13 @@ for p in $(getargs ip=); do
 
     if str_starts "$dev" "enx" && [ ${#dev} -eq 15 ]; then
         printf -- "ifname=%s:%s:%s:%s:%s:%s:%s\n" \
-               "$dev" \
-               "${dev:3:2}" \
-               "${dev:5:2}" \
-               "${dev:7:2}" \
-               "${dev:9:2}" \
-               "${dev:11:2}" \
-               "${dev:13:2}" >> /etc/cmdline.d/80-enx.conf
+            "$dev" \
+            "${dev:3:2}" \
+            "${dev:5:2}" \
+            "${dev:7:2}" \
+            "${dev:9:2}" \
+            "${dev:11:2}" \
+            "${dev:13:2}" >> /etc/cmdline.d/80-enx.conf
     fi
 done
 
@@ -130,11 +131,11 @@ if getargbool 1 "rd.bootif" && BOOTIF="$(getarg BOOTIF=)"; then
 fi
 
 # This ensures that BOOTDEV is always first in IFACES
-if [ -n "$BOOTDEV" ] && [ -n "$IFACES" ] ; then
+if [ -n "$BOOTDEV" ] && [ -n "$IFACES" ]; then
     IFACES="${IFACES%$BOOTDEV*} ${IFACES#*$BOOTDEV}"
     IFACES="$BOOTDEV $IFACES"
 fi
 
 # Store BOOTDEV and IFACES for later use
 [ -n "$BOOTDEV" ] && echo $BOOTDEV > /tmp/net.bootdev
-[ -n "$IFACES" ]  && echo $IFACES > /tmp/net.ifaces
+[ -n "$IFACES" ] && echo $IFACES > /tmp/net.ifaces
index 03fbcf20d7644cae9102d2396cacf1d1e4cae052..0ae558fd7645abf68c703e387aec5d0feb004a7f 100755 (executable)
@@ -18,11 +18,27 @@ parseteam() {
     done
 
     case $# in
-    0)  teammaster=team0; teamslaves="eth0 eth1"; teamrunner="activebackup" ;;
-    1)  teammaster=$1; teamslaves="eth0 eth1"; teamrunner="activebackup" ;;
-    2)  teammaster=$1; teamslaves=$(str_replace "$2" "," " "); teamrunner="activebackup" ;;
-    3)  teammaster=$1; teamslaves=$(str_replace "$2" "," " "); teamrunner=$3 ;;
-    *)  die "team= requires zero to three parameters" ;;
+        0)
+            teammaster=team0
+            teamslaves="eth0 eth1"
+            teamrunner="activebackup"
+            ;;
+        1)
+            teammaster=$1
+            teamslaves="eth0 eth1"
+            teamrunner="activebackup"
+            ;;
+        2)
+            teammaster=$1
+            teamslaves=$(str_replace "$2" "," " ")
+            teamrunner="activebackup"
+            ;;
+        3)
+            teammaster=$1
+            teamslaves=$(str_replace "$2" "," " ")
+            teamrunner=$3
+            ;;
+        *) die "team= requires zero to three parameters" ;;
     esac
     return 0
 }
@@ -46,4 +62,3 @@ for team in $(getargs team); do
         printf -- "%s" "{\"runner\": {\"name\": \"$teamrunner\"}, \"link_watch\": {\"name\": \"ethtool\"}}" > "/tmp/${teammaster}.conf"
     fi
 done
-
index afc890a5980f5e893a631a95ac0f79ddf6605ac9..a8b4ddcbdaec588610b1f6ae3d959beae4315977 100755 (executable)
@@ -14,8 +14,11 @@ parsevlan() {
 
     unset vlanname phydevice
     case $# in
-    2)  vlanname=$1; phydevice=$2 ;;
-    *)  die "vlan= requires two parameters" ;;
+        2)
+            vlanname=$1
+            phydevice=$2
+            ;;
+        *) die "vlan= requires two parameters" ;;
     esac
 }
 
index d27bd8cd5f9dede1c1a2a2b4fdb42c431c6a61cf..63f40ed2cca09c210824ef040f196300a1fb46c1 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-type nm_generate_connections >/dev/null 2>&1 || . /lib/nm-lib.sh
+type nm_generate_connections > /dev/null 2>&1 || . /lib/nm-lib.sh
 
 if [ -n "$netroot" ] || [ -e /tmp/net.ifaces ]; then
     echo rd.neednet >> /etc/cmdline.d/35-neednet.conf
index fe053cfa0c77a11595407e2f3dbc5c4680d92c15..fbbb1d0e023545a14a8e1b978629cc5bd09edb2a 100644 (file)
@@ -1,19 +1,18 @@
 #!/bin/bash
 
-type getcmdline >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getcmdline > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
-nm_generate_connections()
-{
+nm_generate_connections() {
     rm -f /run/NetworkManager/system-connections/*
     /usr/libexec/nm-initrd-generator -- $(getcmdline)
 
     if getargbool 0 rd.neednet; then
         for i in /usr/lib/NetworkManager/system-connections/* \
-                 /run/NetworkManager/system-connections/* \
-                 /etc/NetworkManager/system-connections/* \
-                 /etc/sysconfig/network-scripts/ifcfg-*; do
+            /run/NetworkManager/system-connections/* \
+            /etc/NetworkManager/system-connections/* \
+            /etc/sysconfig/network-scripts/ifcfg-*; do
             [ -f "$i" ] || continue
-            echo '[ -f /tmp/nm.done ]' >$hookdir/initqueue/finished/nm.sh
+            echo '[ -f /tmp/nm.done ]' > $hookdir/initqueue/finished/nm.sh
             break
         done
     fi
index 15d5d16de00559173a5df4e289bebac4eed2d745..46265a2596dcf00e87ac9310153d16e9bb3ec51b 100755 (executable)
@@ -1,31 +1,30 @@
 #!/bin/sh
 
-type source_hook >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type source_hook > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 if [ -e /tmp/nm.done ]; then
     return
 fi
 
-[ -z "$DRACUT_SYSTEMD" ] && \
-for i in /usr/lib/NetworkManager/system-connections/* \
-         /run/NetworkManager/system-connections/* \
-         /etc/NetworkManager/system-connections/* \
-         /etc/sysconfig/network-scripts/ifcfg-*; do
-  [ -f "$i" ] || continue
-  /usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
-  break
-done
+[ -z "$DRACUT_SYSTEMD" ] \
+    && for i in /usr/lib/NetworkManager/system-connections/* \
+        /run/NetworkManager/system-connections/* \
+        /etc/NetworkManager/system-connections/* \
+        /etc/sysconfig/network-scripts/ifcfg-*; do
+        [ -f "$i" ] || continue
+        /usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
+        break
+    done
 
 if [ -s /run/NetworkManager/initrd/hostname ]; then
     cat /run/NetworkManager/initrd/hostname > /proc/sys/kernel/hostname
 fi
 
-for _i in /sys/class/net/*
-do
+for _i in /sys/class/net/*; do
     state=/run/NetworkManager/devices/$(cat $_i/ifindex)
-    grep -q connection-uuid= $state 2>/dev/null || continue
+    grep -q connection-uuid= $state 2> /dev/null || continue
     ifname=${_i##*/}
-    sed -n 's/root-path/new_root_path/p;s/next-server/new_next_server/p' <$state >/tmp/dhclient.$ifname.dhcpopts
+    sed -n 's/root-path/new_root_path/p;s/next-server/new_next_server/p' < $state > /tmp/dhclient.$ifname.dhcpopts
     source_hook initqueue/online $ifname
     /sbin/netroot $ifname
 done
index 8aa3c51d688bfbd43783862d6b47d4a8de9c08b5..68c43ae898f378f01cef842104ba28447b11d38b 100755 (executable)
@@ -61,6 +61,6 @@ install() {
             '/^\[Unit\]/aDefaultDependencies=no\
             Conflicts=shutdown.target\
             Before=shutdown.target' \
-                "$initdir"$unit
+            "$initdir"$unit
     done
 }
index db8fe13f273f1d92314c208246af995ed32eb041..be78c2705e5c2b23827dcb30566b8126b941c4bb 100755 (executable)
@@ -1,11 +1,11 @@
 #!/bin/sh
 
 # if there are no ifname parameters, just use NAME=KERNEL
-if ! getarg ifname= >/dev/null ; then
+if ! getarg ifname= > /dev/null; then
     return
 fi
 
-command -v parse_ifname_opts >/dev/null || . /lib/net-lib.sh
+command -v parse_ifname_opts > /dev/null || . /lib/net-lib.sh
 
 {
     for p in $(getargs ifname=); do
index d30f4965df9cc1719bfab58d1b017d38fae96953..cee31db56a9fdadc346e5956ce9efbf50d50de71 100755 (executable)
@@ -9,22 +9,22 @@ check() {
 depends() {
     is_qemu_virtualized && echo -n "qemu-net "
 
-    for module in network-wicked network-manager network-legacy ; do
-        if dracut_module_included "$module" ; then
-                network_handler="$module"
-                break
-            fi
-        done;
-
-        if [ -z "$network_handler" ]; then
-            if find_binary wicked  &>/dev/null ; then
-                network_handler="network-wicked"
-            elif [[ -x $dracutsysrootdir/usr/libexec/nm-initrd-generator ]]; then
-                network_handler="network-manager"
-            else
-                network_handler="network-legacy"
-            fi
+    for module in network-wicked network-manager network-legacy; do
+        if dracut_module_included "$module"; then
+            network_handler="$module"
+            break
         fi
+    done
+
+    if [ -z "$network_handler" ]; then
+        if find_binary wicked &> /dev/null; then
+            network_handler="network-wicked"
+        elif [[ -x $dracutsysrootdir/usr/libexec/nm-initrd-generator ]]; then
+            network_handler="network-manager"
+        else
+            network_handler="network-legacy"
+        fi
+    fi
     echo "kernel-network-modules $network_handler"
     return 0
 }
index 9a6fd7c3d928d6e8548b4ba321592acc88e2731b..b95cb8b596de3bb279f71b4be6fa0c66e92b39ca 100755 (executable)
@@ -6,10 +6,10 @@ is_ip() {
     echo "$1" | {
         IFS=. read a b c d
         test "$a" -ge 0 -a "$a" -le 255 \
-             -a "$b" -ge 0 -a "$b" -le 255 \
-             -a "$c" -ge 0 -a "$c" -le 255 \
-             -a "$d" -ge 0 -a "$d" -le 255 \
-             2> /dev/null
+            -a "$b" -ge 0 -a "$b" -le 255 \
+            -a "$c" -ge 0 -a "$c" -le 255 \
+            -a "$d" -ge 0 -a "$d" -le 255 \
+            2> /dev/null
     } && return 0
     return 1
 }
@@ -23,7 +23,7 @@ get_ip() {
 }
 
 iface_for_remote_addr() {
-    set -- $(ip route get to $1 | sed  's/.*\bdev\b//p;q')
+    set -- $(ip route get to $1 | sed 's/.*\bdev\b//p;q')
     echo $1
 }
 
@@ -44,8 +44,8 @@ iface_for_mac() {
 # get the iface name for the given identifier - either a MAC, IP, or iface name
 iface_name() {
     case $1 in
-        ??:??:??:??:??:??|??-??-??-??-??-??) iface_for_mac $1 ;;
-        *:*:*|*.*.*.*) iface_for_ip $1 ;;
+        ??:??:??:??:??:?? | ??-??-??-??-??-??) iface_for_mac $1 ;;
+        *:*:* | *.*.*.*) iface_for_ip $1 ;;
         *) echo $1 ;;
     esac
 }
@@ -87,13 +87,16 @@ get_netroot_ip() {
     local prefix="" server="" rest=""
     splitsep "$1" ":" prefix server rest
     case $server in
-        [0-9]*\.[0-9]*\.[0-9]*\.[0-9]*) echo "$server"; return 0 ;;
+        [0-9]*\.[0-9]*\.[0-9]*\.[0-9]*)
+            echo "$server"
+            return 0
+            ;;
     esac
     return 1
 }
 
 ip_is_local() {
-    strstr "$(ip route get $1 2>/dev/null)" " via "
+    strstr "$(ip route get $1 2> /dev/null)" " via "
 }
 
 ifdown() {
@@ -103,9 +106,9 @@ ifdown() {
     ip addr flush dev $netif
     echo "#empty" > /etc/resolv.conf
     rm -f -- /tmp/net.$netif.did-setup
-    [ -z "$DO_VLAN" ] && \
-       [ -e /sys/class/net/$netif/address ] && \
-        rm -f -- /tmp/net.$(cat /sys/class/net/$netif/address).did-setup
+    [ -z "$DO_VLAN" ] \
+        && [ -e /sys/class/net/$netif/address ] \
+        && rm -f -- /tmp/net.$(cat /sys/class/net/$netif/address).did-setup
     # TODO: send "offline" uevent?
 }
 
@@ -113,19 +116,19 @@ setup_net() {
     local netif="$1" f="" gw_ip="" netroot_ip="" iface="" IFACES=""
     local _p
     [ -e /tmp/net.$netif.did-setup ] && return
-    [ -z "$DO_VLAN" ] && \
-       [ -e /sys/class/net/$netif/address ] && \
-        [ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && return
+    [ -z "$DO_VLAN" ] \
+        && [ -e /sys/class/net/$netif/address ] \
+        && [ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && return
     [ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
     [ -z "$IFACES" ] && IFACES="$netif"
     # run the scripts written by ifup
-    [ -e /tmp/net.$netif.hostname ]      && . /tmp/net.$netif.hostname
-    [ -e /tmp/net.$netif.override ]      && . /tmp/net.$netif.override
+    [ -e /tmp/net.$netif.hostname ] && . /tmp/net.$netif.hostname
+    [ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
     [ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
     # set up resolv.conf
-    [ -e /tmp/net.$netif.resolv.conf ] && \
-        awk '!array[$0]++' /tmp/net.$netif.resolv.conf > /etc/resolv.conf
-    [ -e /tmp/net.$netif.gw ]            && . /tmp/net.$netif.gw
+    [ -e /tmp/net.$netif.resolv.conf ] \
+        && awk '!array[$0]++' /tmp/net.$netif.resolv.conf > /etc/resolv.conf
+    [ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw
 
     # add static route
     for _p in $(getargs rd.route); do
@@ -146,7 +149,7 @@ setup_net() {
     #     RTNETLINK answers: Network is unreachable
     # Replace the default route again after static routes to cover
     # this scenario.
-    [ -e /tmp/net.$netif.gw ]            && . /tmp/net.$netif.gw
+    [ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw
 
     # Handle STP Timeout: arping the default gateway.
     # (or the root server, if a) it's local or b) there's no gateway.)
@@ -173,7 +176,7 @@ setup_net() {
     fi
 
     if [ "$layer2" != "0" ] && [ -n "$dest" ] && ! strstr "$dest" ":"; then
-        if command -v arping2 >/dev/null; then
+        if command -v arping2 > /dev/null; then
             arping2 -q -C 1 -c 60 -I $netif $dest || info "Resolving $dest via ARP on $netif failed"
         else
             arping -q -f -w 60 -I $netif $dest || info "Resolving $dest via ARP on $netif failed"
@@ -182,9 +185,9 @@ setup_net() {
     unset layer2
 
     > /tmp/net.$netif.did-setup
-    [ -z "$DO_VLAN" ] && \
-       [ -e /sys/class/net/$netif/address ] && \
-        > /tmp/net.$(cat /sys/class/net/$netif/address).did-setup
+    [ -z "$DO_VLAN" ] \
+        && [ -e /sys/class/net/$netif/address ] \
+        && > /tmp/net.$(cat /sys/class/net/$netif/address).did-setup
 }
 
 save_netinfo() {
@@ -211,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
@@ -244,24 +247,39 @@ ibft_to_cmdline() {
             local dns1 dns2
 
             [ -e ${iface}/mac ] || continue
-            mac=$(read a < ${iface}/mac; echo $a)
+            mac=$(
+                read a < ${iface}/mac
+                echo $a
+            )
             [ -z "$mac" ] && continue
             dev=$(set_ifname ibft $mac)
 
             [ -e /tmp/net.${dev}.has_ibft_config ] && continue
 
-            [ -e ${iface}/flags ] && flags=$(read a < ${iface}/flags; echo $a)
+            [ -e ${iface}/flags ] && flags=$(
+                read a < ${iface}/flags
+                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
+            if ! getargbool 0 rd.iscsi.mp; then
+                (($flags & 2)) || continue
             fi
-            [ -e ${iface}/dhcp ] && dhcp=$(read a < ${iface}/dhcp; echo $a)
-            [ -e ${iface}/origin ] && origin=$(read a < ${iface}/origin; echo $a)
-            [ -e ${iface}/ip-addr ] && ip=$(read a < ${iface}/ip-addr; echo $a)
-
-            if [ -n "$ip" ] ; then
+            [ -e ${iface}/dhcp ] && dhcp=$(
+                read a < ${iface}/dhcp
+                echo $a
+            )
+            [ -e ${iface}/origin ] && origin=$(
+                read a < ${iface}/origin
+                echo $a
+            )
+            [ -e ${iface}/ip-addr ] && ip=$(
+                read a < ${iface}/ip-addr
+                echo $a
+            )
+
+            if [ -n "$ip" ]; then
                 case "$ip" in
                     *.*.*.*)
                         family=ipv4
@@ -272,7 +290,7 @@ ibft_to_cmdline() {
                 esac
             fi
             if [ -n "$dhcp" ] || [ "$origin" -eq 3 ]; then
-                if [ "$family" = "ipv6" ] ; then
+                if [ "$family" = "ipv6" ]; then
                     echo "ip=$dev:dhcp6"
                 else
                     echo "ip=$dev:dhcp"
@@ -280,23 +298,41 @@ ibft_to_cmdline() {
             elif [ -e ${iface}/ip-addr ]; then
                 # skip not assigned ip adresses
                 [ "$ip" = "0.0.0.0" ] && continue
-                [ -e ${iface}/gateway ] && gw=$(read a < ${iface}/gateway; echo $a)
+                [ -e ${iface}/gateway ] && gw=$(
+                    read a < ${iface}/gateway
+                    echo $a
+                )
                 [ "$gateway" = "0.0.0.0" ] && unset $gateway
-                [ -e ${iface}/subnet-mask ] && mask=$(read a < ${iface}/subnet-mask; echo $a)
-                [ -e ${iface}/prefix-len ] && prefix=$(read a < ${iface}/prefix-len; echo $a)
-                [ -e ${iface}/primary-dns ] && dns1=$(read a < ${iface}/primary-dns; echo $a)
+                [ -e ${iface}/subnet-mask ] && mask=$(
+                    read a < ${iface}/subnet-mask
+                    echo $a
+                )
+                [ -e ${iface}/prefix-len ] && prefix=$(
+                    read a < ${iface}/prefix-len
+                    echo $a
+                )
+                [ -e ${iface}/primary-dns ] && dns1=$(
+                    read a < ${iface}/primary-dns
+                    echo $a
+                )
                 [ "$dns1" = "0.0.0.0" ] && unset $dns1
-                [ -e ${iface}/secondary-dns ] && dns2=$(read a < ${iface}/secondary-dns; echo $a)
+                [ -e ${iface}/secondary-dns ] && dns2=$(
+                    read a < ${iface}/secondary-dns
+                    echo $a
+                )
                 [ "$dns2" = "0.0.0.0" ] && unset $dns2
-                [ -e ${iface}/hostname ] && hostname=$(read a < ${iface}/hostname; echo $a)
-                if [ "$family" = "ipv6" ] ; then
-                    if [ -n "$ip" ] ; then
+                [ -e ${iface}/hostname ] && hostname=$(
+                    read a < ${iface}/hostname
+                    echo $a
+                )
+                if [ "$family" = "ipv6" ]; then
+                    if [ -n "$ip" ]; then
                         ip="[$ip]"
                         [ -n "$prefix" ] || prefix=64
                         ip="[${ip}/${prefix}]"
                         mask=
                     fi
-                    if [ -n "$gw" ] ; then
+                    if [ -n "$gw" ]; then
                         gw="[${gw}]"
                     fi
                 fi
@@ -315,7 +351,10 @@ ibft_to_cmdline() {
             fi
 
             if [ -e ${iface}/vlan ]; then
-                vlan=$(read a < ${iface}/vlan; echo $a)
+                vlan=$(
+                    read a < ${iface}/vlan
+                    echo $a
+                )
                 if [ "$vlan" -ne "0" ]; then
                     case "$vlan" in
                         [0-9]*)
@@ -338,8 +377,7 @@ ibft_to_cmdline() {
     ) >> /etc/cmdline.d/40-ibft.conf
 }
 
-parse_iscsi_root()
-{
+parse_iscsi_root() {
     local v
     v=${1#iscsi:}
 
@@ -406,17 +444,22 @@ parse_iscsi_root()
     set $v
     IFS="$OLDIFS"
 
-    iscsi_protocol=$1; shift # ignored
-    iscsi_target_port=$1; shift
+    iscsi_protocol=$1
+    shift # ignored
+    iscsi_target_port=$1
+    shift
 
     if [ -n "$iscsi_target_name" ]; then
         if [ $# -eq 3 ]; then
-            iscsi_iface_name=$1; shift
+            iscsi_iface_name=$1
+            shift
         fi
         if [ $# -eq 2 ]; then
-            iscsi_netdev_name=$1; shift
+            iscsi_netdev_name=$1
+            shift
         fi
-        iscsi_lun=$1; shift
+        iscsi_lun=$1
+        shift
         if [ $# -ne 0 ]; then
             warn "Invalid parameter in iscsi: parameter!"
             return 1
@@ -424,15 +467,17 @@ parse_iscsi_root()
         return 0
     fi
 
-
     if [ $# -gt 3 ] && [ -n "$1$2" ]; then
-        if [ -z "$3" ] || [ "$3" -ge 0 ]  2>/dev/null ; then
-            iscsi_iface_name=$1; shift
-            iscsi_netdev_name=$1; shift
+        if [ -z "$3" ] || [ "$3" -ge 0 ] 2> /dev/null; then
+            iscsi_iface_name=$1
+            shift
+            iscsi_netdev_name=$1
+            shift
         fi
     fi
 
-    iscsi_lun=$1; shift
+    iscsi_lun=$1
+    shift
 
     iscsi_target_name=$(printf "%s:" "$@")
     iscsi_target_name=${iscsi_target_name%:}
@@ -482,7 +527,7 @@ ip_to_var() {
 
             # handle special values for ksdevice
             case "$dev" in
-                bootif|BOOTIF) dev=$(fix_bootif $(getarg BOOTIF=)) ;;
+                bootif | BOOTIF) dev=$(fix_bootif $(getarg BOOTIF=)) ;;
                 link) dev="" ;; # FIXME: do something useful with this
                 ibft) dev="" ;; # ignore - ibft is handled elsewhere
             esac
@@ -513,7 +558,7 @@ ip_to_var() {
     [ -n "$6" ] && dev=$6
     [ -n "$7" ] && autoconf=$7
     case "$8" in
-        [0-9a-fA-F]*:*|[0-9]*.[0-9]*.[0-9]*.[0-9]*)
+        [0-9a-fA-F]*:* | [0-9]*.[0-9]*.[0-9]*.[0-9]*)
             dns1="$8"
             [ -n "$9" ] && dns2="$9"
             ;;
@@ -531,7 +576,7 @@ ip_to_var() {
             elif [ -n "${9}" -a -n "${10}" -a -n "${11}" -a -n "${12}" -a -n "${13}" -a -n "${14}" ]; then
                 macaddr="${9}:${10}:${11}:${12}:${13}:${14}"
             fi
-           ;;
+            ;;
     esac
     return 0
 }
@@ -555,11 +600,18 @@ route_to_var() {
 
     unset route_mask route_gw route_dev
     case $# in
-        2)  [ -n "$1" ] && route_mask="$1"; [ -n "$2" ] && route_gw="$2"
-            return 0;;
-        3)  [ -n "$1" ] && route_mask="$1"; [ -n "$2" ] && route_gw="$2"; [ -n "$3" ] && route_dev="$3"
-            return 0;;
-        *)  return 1;;
+        2)
+            [ -n "$1" ] && route_mask="$1"
+            [ -n "$2" ] && route_gw="$2"
+            return 0
+            ;;
+        3)
+            [ -n "$1" ] && route_mask="$1"
+            [ -n "$2" ] && route_gw="$2"
+            [ -n "$3" ] && route_dev="$3"
+            return 0
+            ;;
+        *) return 1 ;;
     esac
 }
 
@@ -584,7 +636,7 @@ parse_ifname_opts() {
     esac
 
     case $ifname_if in
-        eth[0-9]|eth[0-9][0-9]|eth[0-9][0-9][0-9]|eth[0-9][0-9][0-9][0-9])
+        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\""
@@ -600,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)
+        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
 }
@@ -616,27 +668,30 @@ 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)
         if [ -n "$li" ]; then
             case "$li" in
                 *\<UP*)
-                    return 0;;
+                    return 0
+                    ;;
                 *\<*,UP\>*)
-                    return 0;;
+                    return 0
+                    ;;
                 *\<*,UP,*\>*)
-                    return 0;;
+                    return 0
+                    ;;
             esac
         fi
         if strstr "$li" "LOWER_UP" \
-                && strstr "$li" "state UNKNOWN" \
-                && ! strstr "$li" "DORMANT"; then
+            && strstr "$li" "state UNKNOWN" \
+            && ! strstr "$li" "DORMANT"; then
             return 0
         fi
         sleep 0.1
-        cnt=$(($cnt+1))
+        cnt=$(($cnt + 1))
     done
     return 1
 }
@@ -645,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
 }
@@ -660,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)" ] \
@@ -669,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
 }
@@ -678,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")" ] \
@@ -688,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
 }
@@ -697,28 +752,26 @@ 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
 }
 
 linkup() {
-    wait_for_if_link $1 2>/dev/null\
-     && ip link set $1 up 2>/dev/null\
-     && wait_for_if_up $1 2>/dev/null
+    wait_for_if_link $1 2> /dev/null && ip link set $1 up 2> /dev/null && wait_for_if_up $1 2> /dev/null
 }
 
-type hostname >/dev/null 2>&1 || \
-    hostname() {
-    cat /proc/sys/kernel/hostname
-}
+type hostname > /dev/null 2>&1 \
+    || hostname() {
+        cat /proc/sys/kernel/hostname
+    }
 
 iface_has_carrier() {
     local cnt=0
@@ -728,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"
 
@@ -747,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
 }
@@ -791,21 +844,22 @@ is_persistent_ethernet_name() {
 
     case "$_netif" in
         # udev persistent interface names
-        eno[0-9]|eno[0-9][0-9]|eno[0-9][0-9][0-9]*)
-            ;;
-        ens[0-9]|ens[0-9][0-9]|ens[0-9][0-9][0-9]*)
-            ;;
-        enp[0-9]s[0-9]*|enp[0-9][0-9]s[0-9]*|enp[0-9][0-9][0-9]*s[0-9]*)
-            ;;
-        enP*p[0-9]s[0-9]*|enP*p[0-9][0-9]s[0-9]*|enP*p[0-9][0-9][0-9]*s[0-9]*)
-            ;;
-        # biosdevname
-        em[0-9]|em[0-9][0-9]|em[0-9][0-9][0-9]*)
-            ;;
-        p[0-9]p[0-9]*|p[0-9][0-9]p[0-9]*|p[0-9][0-9][0-9]*p[0-9]*)
-            ;;
+        eno[0-9] | eno[0-9][0-9] | eno[0-9][0-9][0-9]*) ;;
+
+        ens[0-9] | ens[0-9][0-9] | ens[0-9][0-9][0-9]*) ;;
+
+        enp[0-9]s[0-9]* | enp[0-9][0-9]s[0-9]* | enp[0-9][0-9][0-9]*s[0-9]*) ;;
+
+        enP*p[0-9]s[0-9]* | enP*p[0-9][0-9]s[0-9]* | enP*p[0-9][0-9][0-9]*s[0-9]*) ;;
+
+            # biosdevname
+        em[0-9] | em[0-9][0-9] | em[0-9][0-9][0-9]*) ;;
+
+        p[0-9]p[0-9]* | p[0-9][0-9]p[0-9]* | p[0-9][0-9][0-9]*p[0-9]*) ;;
+
         *)
             return 1
+            ;;
     esac
     return 0
 }
@@ -818,13 +872,13 @@ is_kernel_ethernet_name() {
         _name_assign_type=$(cat "/sys/class/net/$_netif/name_assign_type")
 
         case "$_name_assign_type" in
-            2|3|4)
+            2 | 3 | 4)
                 # NET_NAME_PREDICTABLE 2
                 # NET_NAME_USER 3
                 # NET_NAME_RENAMED 4
                 return 1
                 ;;
-            1|*)
+            1 | *)
                 # NET_NAME_ENUM 1
                 return 0
                 ;;
@@ -833,11 +887,12 @@ is_kernel_ethernet_name() {
 
     # fallback to error prone manual name check
     case "$_netif" in
-        eth[0-9]|eth[0-9][0-9]|eth[0-9][0-9][0-9]*)
+        eth[0-9] | eth[0-9][0-9] | eth[0-9][0-9][0-9]*)
             return 0
             ;;
         *)
             return 1
+            ;;
     esac
 
 }
@@ -849,12 +904,12 @@ iface_get_subchannels() {
     _netif="$1"
 
     _subchannels=$({
-                      for i in /sys/class/net/$_netif/device/cdev[0-9]*; do
-                          [ -e $i ] || continue
-                          channel=$(readlink -f $i)
-                          printf -- "%s" "${channel##*/},"
-                      done
-                  })
+        for i in /sys/class/net/$_netif/device/cdev[0-9]*; do
+            [ -e $i ] || continue
+            channel=$(readlink -f $i)
+            printf -- "%s" "${channel##*/},"
+        done
+    })
     [ -n "$_subchannels" ] || return 1
 
     printf -- "%s" ${_subchannels%,}
index 6ff1821daf3c2425f31e548a8f97db51b81c070d..ab032bd9370fdc4d7455a45f0540f7e2d4a9e7e8 100755 (executable)
@@ -1,8 +1,8 @@
 #!/bin/sh
 
 PATH=/usr/sbin:/usr/bin:/sbin:/bin
-command -v getarg >/dev/null    || . /lib/dracut-lib.sh
-command -v setup_net >/dev/null || . /lib/net-lib.sh
+command -v getarg > /dev/null || . /lib/dracut-lib.sh
+command -v setup_net > /dev/null || . /lib/net-lib.sh
 
 # Huh? Empty $1?
 [ -z "$1" ] && exit 1
@@ -24,7 +24,7 @@ netif=$1
 [ -e "/tmp/net.bootdev" ] && read netif < /tmp/net.bootdev
 
 case "$netif" in
-    ??:??:??:??:??:??)  # MAC address
+    ??:??:??:??:??:??) # MAC address
         for i in /sys/class/net/*/address; do
             mac=$(cat $i)
             if [ "$mac" = "$netif" ]; then
@@ -32,7 +32,7 @@ case "$netif" in
                 netif=${i##*/}
                 break
             fi
-        done
+        done ;;
 esac
 
 # Figure out the handler for root=dhcp by recalling all netroot cmdline
@@ -44,7 +44,7 @@ if [ -z "$2" ]; then
 
         # If we have a specific bootdev with no dhcpoptions or empty root-path,
         # we die. Otherwise we just warn
-        if [ -z "$new_root_path" ] ; then
+        if [ -z "$new_root_path" ]; then
             [ -n "$BOOTDEV" ] && die "No dhcp root-path received for '$BOOTDEV'"
             warn "No dhcp root-path received for '$netif' trying other interfaces if available"
             exit 1
@@ -58,7 +58,7 @@ if [ -z "$2" ]; then
         # FIXME!
         unset rootok
         for f in $hookdir/cmdline/90*.sh; do
-            [ -f "$f" ] && . "$f";
+            [ -f "$f" ] && . "$f"
         done
     else
         rootok="1"
@@ -74,7 +74,7 @@ if [ -z "$2" ]; then
     handler=${netroot%%:*}
     handler=${handler%%4}
     handler=$(command -v ${handler}root)
-    if [ -z "$netroot" ] || [ ! -e "$handler" ] ; then
+    if [ -z "$netroot" ] || [ ! -e "$handler" ]; then
         die "No handler for netroot type '$netroot'"
     fi
 fi
index 7fe05a89933287a76e82fab890c10a6bf795131c..b0d44184c47068c14c738bf1b1e1d9d27d9e30b3 100755 (executable)
@@ -17,4 +17,3 @@ install() {
     inst_binary awk
     inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh"
 }
-
index 291a74e638614d91cc23a7783ab935094c4dab66..30c88f779880cbb3024fc89396e818e93354b08d 100755 (executable)
@@ -1,15 +1,14 @@
 #!/bin/sh
 
 # NFS root might have reached here before /tmp/net.ifaces was written
-type is_persistent_ethernet_name >/dev/null 2>&1 || . /lib/net-lib.sh
+type is_persistent_ethernet_name > /dev/null 2>&1 || . /lib/net-lib.sh
 
 udevadm settle --timeout=30
 
 mkdir -m 0755 -p /tmp/ifcfg/
 mkdir -m 0755 -p /tmp/ifcfg-leases/
 
-get_config_line_by_subchannel()
-{
+get_config_line_by_subchannel() {
     local CHANNEL
     local line
 
@@ -62,7 +61,7 @@ print_s390() {
     shift
     while [ $# -gt 0 ]; do
         case $1 in
-            *=*) OPTIONS="$OPTIONS $1";;
+            *=*) OPTIONS="$OPTIONS $1" ;;
         esac
         shift
     done
@@ -109,7 +108,7 @@ interface_bind() {
     echo "DEVICE=\"$_netif\""
 }
 
-for netup in /tmp/net.*.did-setup ; do
+for netup in /tmp/net.*.did-setup; do
     [ -f $netup ] || continue
 
     netif=${netup%%.did-setup}
@@ -211,7 +210,7 @@ for netup in /tmp/net.*.did-setup ; do
         echo "TYPE=Ethernet" >> /tmp/ifcfg/ifcfg-$netif
     fi
 
-    if [ -n "$vlan" ] ; then
+    if [ -n "$vlan" ]; then
         {
             echo "TYPE=Vlan"
             echo "DEVICE=\"$netif\""
@@ -220,7 +219,7 @@ for netup in /tmp/net.*.did-setup ; do
         } >> /tmp/ifcfg/ifcfg-$netif
     fi
 
-    if [ -n "$bond" ] ; then
+    if [ -n "$bond" ]; then
         # bond interface
         {
             # This variable is an indicator of a bond interface for initscripts
@@ -229,7 +228,7 @@ for netup in /tmp/net.*.did-setup ; do
             echo "TYPE=Bond"
         } >> /tmp/ifcfg/ifcfg-$netif
 
-        for slave in $bondslaves ; do
+        for slave in $bondslaves; do
             # write separate ifcfg file for the raw eth interface
             (
                 echo "# Generated by dracut initrd"
@@ -247,13 +246,13 @@ for netup in /tmp/net.*.did-setup ; do
         done
     fi
 
-    if [ -n "$bridge" ] ; then
+    if [ -n "$bridge" ]; then
         # bridge
         {
             echo "TYPE=Bridge"
             echo "NAME=\"$netif\""
         } >> /tmp/ifcfg/ifcfg-$netif
-        for slave in $bridgeslaves ; do
+        for slave in $bridgeslaves; do
             # write separate ifcfg file for the raw eth interface
             (
                 echo "# Generated by dracut initrd"
@@ -272,7 +271,7 @@ for netup in /tmp/net.*.did-setup ; do
     i=1
     for ns in $(getargs nameserver) $dns1 $dns2; do
         echo "DNS${i}=\"${ns}\"" >> /tmp/ifcfg/ifcfg-$netif
-        i=$((i+1))
+        i=$((i + 1))
     done
 
     [ -f /tmp/net.route6."$netif" ] && cp /tmp/net.route6."$netif" /tmp/ifcfg/route6-"$netif"
@@ -287,7 +286,7 @@ echo "files /var/lib/dhclient" >> /run/initramfs/rwtab
 {
     cp /tmp/net.* /run/initramfs/
     for i in /tmp/net.*.resolv.conf; do
-             [ -f "$i" ] && cat "$i"
+        [ -f "$i" ] && cat "$i"
     done | awk '!($0 in a) { a[$0]; print }' > /run/initramfs/state/etc/resolv.conf
     [ -s /run/initramfs/state/etc/resolv.conf ] || rm -f /run/initramfs/state/etc/resolv.conf
     copytree /tmp/ifcfg /run/initramfs/state/etc/sysconfig/network-scripts
index 258a9e1613273ccf8d80708c6ad288e12a345d0c..bd5e1c54dbd42ce2d3704ed122ff3d4e0cf28bd4 100755 (executable)
@@ -28,9 +28,9 @@ install() {
     fi
 
     for _dir in $libdirs; do
-       [[ -d $dracutsysrootdir$_dir ]] || continue
+        [[ -d $dracutsysrootdir$_dir ]] || continue
         for _lib in $dracutsysrootdir$_dir/libcurl.so.*; do
-           [[ -e $_lib ]] || continue
+            [[ -e $_lib ]] || continue
             [[ $_nssckbi ]] || _nssckbi=$(grep -F --binary-files=text -z libnssckbi $_lib)
             _crt=$(grep -F --binary-files=text -z .crt $_lib)
             [[ $_crt ]] || continue
@@ -47,15 +47,15 @@ install() {
     # If its truly NSS libnssckbi, it includes its own trust bundle,
     # but if it's really p11-kit-trust.so, we need to find the dirs
     # where it will look for a trust bundle and install them too.
-    if ! [[ $_found ]] && [[ $_nssckbi ]] ; then
+    if ! [[ $_found ]] && [[ $_nssckbi ]]; then
         _found=1
         inst_libdir_file "libnssckbi.so*" || _found=
         for _dir in $libdirs; do
             [[ -e $dracutsysrootdir$_dir/libnssckbi.so ]] || continue
             # this looks for directory-ish strings in the file
-            for _p11roots in $(grep -o --binary-files=text "/[[:alpha:]][[:print:]]*" $dracutsysrootdir$_dir/libnssckbi.so) ; do
+            for _p11roots in $(grep -o --binary-files=text "/[[:alpha:]][[:print:]]*" $dracutsysrootdir$_dir/libnssckbi.so); do
                 # the string can be a :-separated list of dirs
-                for _p11root in $(echo "$_p11roots" | tr ':' '\n') ; do
+                for _p11root in $(echo "$_p11roots" | tr ':' '\n'); do
                     # check if it's actually a directory (there are
                     # several false positives in the results)
                     [[ -d "$dracutsysrootdir$_p11root" ]] || continue
@@ -65,8 +65,8 @@ install() {
                     [[ -d "$dracutsysrootdir${_p11root}/blacklist" ]] || continue
                     # so now we know it's really a p11-kit trust dir;
                     # install everything in it
-                    for _p11item in $(find "$dracutsysrootdir$_p11root") ; do
-                        if ! inst "${_p11item#$dracutsysrootdir}" ; then
+                    for _p11item in $(find "$dracutsysrootdir$_p11root"); do
+                        if ! inst "${_p11item#$dracutsysrootdir}"; then
                             dwarn "Couldn't install '${_p11item#$dracutsysrootdir}' from p11-kit trust dir '${_p11root#$dracutsysrootdir}'; HTTPS might not work."
                             continue
                         fi
@@ -77,4 +77,3 @@ install() {
     fi
     [[ $_found ]] || dwarn "Couldn't find SSL CA cert bundle or libnssckbi.so; HTTPS won't work."
 }
-
index 8b3b91a5aa293d30050b4f0055b525427ec4c973..af9d3d8bc96cfe58eca10d9eeeafe5c29399e2fc 100755 (executable)
@@ -4,7 +4,7 @@
 # Authors:
 #   Will Woods <wwoods@redhat.com>
 
-type mkuniqdir >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type mkuniqdir > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 # fetch_url URL [OUTFILE]
 #   fetch the given URL to a locally-visible location.
@@ -39,7 +39,8 @@ get_url_handler() {
 # add_url_handler HANDLERNAME SCHEME [SCHEME...]
 #   associate the named handler with the named scheme(s).
 add_url_handler() {
-    local handler="$1"; shift
+    local handler="$1"
+    shift
     local schemes="$@" scheme=""
     set --
     for scheme in $schemes; do
@@ -67,14 +68,17 @@ curl_fetch_url() {
         curl $curl_args --output - -- "$url" > "$outloc" || return $?
     else
         local outdir="$(mkuniqdir /tmp curl_fetch_url)"
-        ( cd "$outdir"; curl $curl_args --remote-name "$url" || return $? )
+        (
+            cd "$outdir"
+            curl $curl_args --remote-name "$url" || return $?
+        )
         outloc="$outdir/$(ls -A $outdir)"
     fi
     if ! [ -f "$outloc" ]; then
-           warn "Downloading '$url' failed!"
-           return 253
+        warn "Downloading '$url' failed!"
+        return 253
     fi
-    if [ -z "$2" ]; then echo "$outloc" ; fi
+    if [ -z "$2" ]; then echo "$outloc"; fi
 }
 add_url_handler curl_fetch_url http https ftp tftp
 
@@ -95,7 +99,10 @@ ctorrent_fetch_url() {
         curl $curl_args --output - -- "$url" > "$torrent_outloc" || return $?
     else
         local outdir="$(mkuniqdir /tmp torrent_fetch_url)"
-        ( cd "$outdir"; curl $curl_args --remote-name "$url" || return $? )
+        (
+            cd "$outdir"
+            curl $curl_args --remote-name "$url" || return $?
+        )
         torrent_outloc="$outdir/$(ls -A $outdir)"
         outloc=${torrent_outloc%.*}
     fi
@@ -108,10 +115,10 @@ ctorrent_fetch_url() {
         warn "Torrent download of '$url' failed!"
         return 253
     fi
-    if [ -z "$2" ]; then echo "$outloc" ; fi
+    if [ -z "$2" ]; then echo "$outloc"; fi
 }
 
-command -v ctorrent >/dev/null \
+command -v ctorrent > /dev/null \
     && add_url_handler ctorrent_fetch_url torrent
 
 ### NFS ##############################################################
@@ -152,6 +159,6 @@ nfs_fetch_url() {
         cp -f -- "$mntdir/$filename" "$outloc" || return $?
     fi
     [ -f "$outloc" ] || return 253
-    if [ -z "$2" ]; then echo "$outloc" ; fi
+    if [ -z "$2" ]; then echo "$outloc"; fi
 }
-command -v nfs_to_var >/dev/null && add_url_handler nfs_fetch_url nfs nfs4
+command -v nfs_to_var > /dev/null && add_url_handler nfs_fetch_url nfs nfs4
index 7b5f836ea81ccf52e92567c4e4c529c5a7794b13..ebf9c5fb9c2e132320b2478c40f21f8fa203889c 100755 (executable)
@@ -33,9 +33,9 @@ installkernel() {
     if [[ $hostonly ]]; then
         for i in /sys/bus/{pci/devices,platform/devices,virtio/devices,soc/devices/soc?}/*/modalias; do
             [[ -e $i ]] || continue
-            [[ -n $(<"$i") ]] || continue
-            if hostonly="" dracut_instmods --silent -s "drm_crtc_init|drm_dev_register|drm_encoder_init" -S "iw_handler_get_spy" $(<"$i"); then
-                if strstr "$(modinfo -F filename $(<"$i") 2>/dev/null)" radeon.ko; then
+            [[ -n $(< "$i") ]] || continue
+            if hostonly="" dracut_instmods --silent -s "drm_crtc_init|drm_dev_register|drm_encoder_init" -S "iw_handler_get_spy" $(< "$i"); then
+                if strstr "$(modinfo -F filename $(< "$i") 2> /dev/null)" radeon.ko; then
                     hostonly='' instmods amdkfd
                 fi
             fi
index beed3c23e5429c9cd81bb1d5ea67b4639ab108c0..336b99419e9d0ad7de5b16b7a7d3b26f82f4a65c 100755 (executable)
@@ -32,7 +32,7 @@ install() {
                     dwarn "${line}"
                 else
                     derror "${line}"
-                    (( $_ret == 0 )) && _ret=1
+                    (($_ret == 0)) && _ret=1
                 fi
             done
         fi
@@ -40,7 +40,7 @@ install() {
         return ${_ret}
     }
 
-    find_binary splash_geninitramfs >/dev/null || return 1
+    find_binary splash_geninitramfs > /dev/null || return 1
 
     _opts=''
     if [[ ${DRACUT_GENSPLASH_THEME} ]]; then
@@ -62,7 +62,7 @@ install() {
 
     dinfo "Installing Gentoo Splash (using the ${_splash_theme} theme)"
 
-    pushd "${initdir}" >/dev/null
+    pushd "${initdir}" > /dev/null
     mv dev dev.old
     call_splash_geninitramfs "${initdir}" ${_opts} ${_splash_theme} || {
         derror "Could not build splash"
@@ -70,7 +70,7 @@ install() {
     }
     rm -rf dev
     mv dev.old dev
-    popd >/dev/null
+    popd > /dev/null
 
     inst_multiple chvt
     inst /usr/share/splashutils/initrd.splash /lib/gensplash-lib.sh
index d7eb8f94cc15904a7ad5354b07a31aa15d5f020d..1c227a9e30fa315e2414d454f2490348b2e77b91 100755 (executable)
@@ -2,7 +2,7 @@
 
 pkglib_dir() {
     local _dirs="/usr/lib/plymouth /usr/libexec/plymouth/"
-    if find_binary dpkg-architecture &>/dev/null; then
+    if find_binary dpkg-architecture &> /dev/null; then
         _dirs+=" /usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/plymouth"
     fi
     for _dir in $_dirs; do
@@ -48,4 +48,3 @@ install() {
         inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh
     fi
 }
-
index c2f1b8c87583f5c1ed869a0c7d991f002963c65b..cf220b29361e20f698828e8f2a6baeb3164584c8 100755 (executable)
@@ -1,3 +1,3 @@
 #!/bin/sh
 
-plymouth --hide-splash 2>/dev/null || :
+plymouth --hide-splash 2> /dev/null || :
index 191c0eb2deea7cf7508cc8c65a05c99c81aa5d95..3bffa4d9046f49171baecf245176abff40f5650b 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
 
-if type plymouth >/dev/null 2>&1 && [ -z "$DRACUT_SYSTEMD" ]; then
+if type plymouth > /dev/null 2>&1 && [ -z "$DRACUT_SYSTEMD" ]; then
     plymouth --newroot=$NEWROOT
 fi
index a6aabe70721c72b868916c6aaecd78ef00883f16..3eaa64498dce52e49d0c086a0ed075b47fe75b16 100755 (executable)
@@ -15,10 +15,10 @@ inst_libdir_file "plymouth/text.so" "plymouth/details.so"
 if [[ $hostonly ]]; then
     inst_multiple \
         "/usr/share/plymouth/themes/details/details.plymouth" \
-        "/usr/share/plymouth/themes/text/text.plymouth" \
+        "/usr/share/plymouth/themes/text/text.plymouth"
 
     if [[ -d $dracutsysrootdir/usr/share/plymouth/themes/${PLYMOUTH_THEME} ]]; then
-        for x in "/usr/share/plymouth/themes/${PLYMOUTH_THEME}"/* ; do
+        for x in "/usr/share/plymouth/themes/${PLYMOUTH_THEME}"/*; do
             [[ -f "$dracutsysrootdir$x" ]] || break
             inst $x
         done
@@ -27,18 +27,18 @@ if [[ $hostonly ]]; then
     if [[ -L $dracutsysrootdir/usr/share/plymouth/themes/default.plymouth ]]; then
         inst /usr/share/plymouth/themes/default.plymouth
         # Install plugin for this theme
-        PLYMOUTH_PLUGIN=$(grep "^ModuleName=" "$dracutsysrootdir"/usr/share/plymouth/themes/default.plymouth | while read a b c || [ -n "$b" ]; do echo $b; done;)
+        PLYMOUTH_PLUGIN=$(grep "^ModuleName=" "$dracutsysrootdir"/usr/share/plymouth/themes/default.plymouth | while read a b c || [ -n "$b" ]; do echo $b; done)
         inst_libdir_file "plymouth/${PLYMOUTH_PLUGIN}.so"
     fi
 else
-    for x in "$dracutsysrootdir"/usr/share/plymouth/themes/{text,details}/* ; do
+    for x in "$dracutsysrootdir"/usr/share/plymouth/themes/{text,details}/*; do
         [[ -f "$x" ]] || continue
         THEME_DIR=$(dirname "${x#$dracutsysrootdir}")
         mkdir -m 0755 -p "${initdir}/$THEME_DIR"
         inst_multiple "${x#$dracutsysrootdir}"
     done
     (
-        cd ${initdir}/usr/share/plymouth/themes;
-        ln -s text/text.plymouth default.plymouth 2>&1;
+        cd ${initdir}/usr/share/plymouth/themes
+        ln -s text/text.plymouth default.plymouth 2>&1
     )
 fi
index 6458d78d5c7d7ffc53dbfe808f5fcf5e5fae1573..59aa99159de836a25757e307afbae905f6e16395 100755 (executable)
@@ -1,16 +1,16 @@
 #!/bin/sh
 
-if type plymouthd >/dev/null 2>&1 && [ -z "$DRACUT_SYSTEMD" ]; then
+if type plymouthd > /dev/null 2>&1 && [ -z "$DRACUT_SYSTEMD" ]; then
     if getargbool 1 plymouth.enable && getargbool 1 rd.plymouth -d -n rd_NO_PLYMOUTH; then
         # first trigger graphics subsystem
-        udevadm trigger --action=add --attr-match=class=0x030000 >/dev/null 2>&1
+        udevadm trigger --action=add --attr-match=class=0x030000 > /dev/null 2>&1
         # first trigger graphics and tty subsystem
         udevadm trigger --action=add \
             --subsystem-match=graphics \
             --subsystem-match=drm \
             --subsystem-match=tty \
             --subsystem-match=acpi \
-            >/dev/null 2>&1
+            > /dev/null 2>&1
 
         udevadm settle --timeout=180 2>&1 | vinfo
 
index eb10ae2176ce76ecb3b5b012a0b394173ec45b31..1f8496b9afff5a9d034e6e7ed2c4a3315cd58f23 100755 (executable)
@@ -1,11 +1,10 @@
 #!/bin/bash
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 mkdir -m 0755 -p /run/initramfs/state/etc/sysconfig/network-scripts
 
-function cms_write_config()
-{
+function cms_write_config() {
     . /tmp/cms.conf
     SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
     OLDIFS=$IFS
@@ -14,9 +13,9 @@ function cms_write_config()
     IFS=$OLDIFS
     devbusid=${subch_array[1]}
     if [ "$NETTYPE" = "ctc" ]; then
-       driver="ctcm"
+        driver="ctcm"
     else
-       driver=$NETTYPE
+        driver=$NETTYPE
     fi
 
     DEVICE=$(cd /sys/devices/${driver}/$devbusid/net/ && set -- * && [ "$1" != "*" ] && echo $1)
@@ -27,15 +26,15 @@ function cms_write_config()
 
     strglobin "$IPADDR" '*:*:*' && ipv6=1
 
-# to please NetworkManager on startup in loader before loader reconfigures net
+    # to please NetworkManager on startup in loader before loader reconfigures net
     cat > /etc/sysconfig/network << EOF
 HOSTNAME=$HOSTNAME
 EOF
     echo "$HOSTNAME" > /etc/hostname
     if [ "$ipv6" ]; then
-       echo "NETWORKING_IPV6=yes" >> /etc/sysconfig/network
+        echo "NETWORKING_IPV6=yes" >> /etc/sysconfig/network
     else
-       echo "NETWORKING=yes" >> /etc/sysconfig/network
+        echo "NETWORKING=yes" >> /etc/sysconfig/network
     fi
 
     cat > $IFCFGFILE << EOF
@@ -47,14 +46,14 @@ MTU=$MTU
 SUBCHANNELS=$SUBCHANNELS
 EOF
     if [ "$ipv6" ]; then
-       cat >> $IFCFGFILE << EOF
+        cat >> $IFCFGFILE << EOF
 IPV6INIT=yes
 IPV6_AUTOCONF=no
 IPV6ADDR=$IPADDR/$NETMASK
 IPV6_DEFAULTGW=$GATEWAY
 EOF
     else
-       cat >> $IFCFGFILE << EOF
+        cat >> $IFCFGFILE << EOF
 IPADDR=$IPADDR
 NETMASK=$NETMASK
 BROADCAST=$BROADCAST
@@ -62,23 +61,35 @@ GATEWAY=$GATEWAY
 EOF
     fi
     if [ "$ipv6" ]; then
-       DNS1=$(set -- ${DNS/,/ }; echo $1)
-       DNS2=$(set -- ${DNS/,/ }; echo $2)
+        DNS1=$(
+            set -- ${DNS/,/ }
+            echo $1
+        )
+        DNS2=$(
+            set -- ${DNS/,/ }
+            echo $2
+        )
     else
-       DNS1=$(set -- ${DNS/:/ }; echo $1)
-       DNS2=$(set -- ${DNS/:/ }; echo $2)
+        DNS1=$(
+            set -- ${DNS/:/ }
+            echo $1
+        )
+        DNS2=$(
+            set -- ${DNS/:/ }
+            echo $2
+        )
     fi
-# real DNS config for NetworkManager to generate /etc/resolv.conf
+    # real DNS config for NetworkManager to generate /etc/resolv.conf
     [ "$DNS1" != "" ] && echo "DNS1=$DNS1" >> $IFCFGFILE
     [ "$DNS2" != "" ] && echo "DNS2=$DNS2" >> $IFCFGFILE
-# just to please loader's readNetInfo && writeEnabledNetInfo
-# which eats DNS1,DNS2,... and generates it themselves based on DNS
+    # just to please loader's readNetInfo && writeEnabledNetInfo
+    # which eats DNS1,DNS2,... and generates it themselves based on DNS
     if [ "$ipv6" ]; then
-       [ "$DNS" != "" ] && echo "DNS=\"$DNS\"" >> $IFCFGFILE
+        [ "$DNS" != "" ] && echo "DNS=\"$DNS\"" >> $IFCFGFILE
     else
-       [ "$DNS" != "" ] && echo "DNS=\"${DNS/:/,}\"" >> $IFCFGFILE
+        [ "$DNS" != "" ] && echo "DNS=\"${DNS/:/,}\"" >> $IFCFGFILE
     fi
-# colons in SEARCHDNS already replaced with spaces above for /etc/resolv.conf
+    # colons in SEARCHDNS already replaced with spaces above for /etc/resolv.conf
     [ "$SEARCHDNS" != "" ] && echo "DOMAIN=\"$SEARCHDNS\"" >> $IFCFGFILE
     [ "$NETTYPE" != "" ] && echo "NETTYPE=$NETTYPE" >> $IFCFGFILE
     [ "$PEERID" != "" ] && echo "PEERID=$PEERID" >> $IFCFGFILE
@@ -87,11 +98,11 @@ EOF
     [ "$MACADDR" != "" ] && echo "MACADDR=$MACADDR" >> $IFCFGFILE
     optstr=""
     for option in LAYER2 PORTNO; do
-       [ -z "${!option}" ] && continue
-       [ -n "$optstr" ] && optstr=${optstr}" "
-       optstr=${optstr}$(echo ${option} | sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')"="${!option}
+        [ -z "${!option}" ] && continue
+        [ -n "$optstr" ] && optstr=${optstr}" "
+        optstr=${optstr}$(echo ${option} | sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')"="${!option}
     done
-# write single quotes since network.py removes double quotes but we need quotes
+    # write single quotes since network.py removes double quotes but we need quotes
     echo "OPTIONS='$optstr'" >> $IFCFGFILE
     unset option
     unset optstr
index 77c18452df882c0c3f8026e4b2c9a563fa7cafc3..a8e686001235210deb621063824da8d97ac349fa 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 DEVICE=$1
 
@@ -17,17 +17,29 @@ if [ "$ipv6" ] && ! str_starts "$GATEWAY" "["; then
 fi
 
 if [ "$ipv6" ]; then
-    DNS1=$(set -- ${DNS/,/ }; echo $1)
-    DNS2=$(set -- ${DNS/,/ }; echo $2)
+    DNS1=$(
+        set -- ${DNS/,/ }
+        echo $1
+    )
+    DNS2=$(
+        set -- ${DNS/,/ }
+        echo $2
+    )
 else
-    DNS1=$(set -- ${DNS/:/ }; echo $1)
-    DNS2=$(set -- ${DNS/:/ }; echo $2)
+    DNS1=$(
+        set -- ${DNS/:/ }
+        echo $1
+    )
+    DNS2=$(
+        set -- ${DNS/:/ }
+        echo $2
+    )
 fi
 
 {
     echo "ip=$IPADDR::$GATEWAY:$NETMASK:$HOSTNAME:$DEVICE:none:$MTU:$MACADDR"
     for i in $DNS1 $DNS2; do
-       echo "nameserver=$i"
+        echo "nameserver=$i"
     done
 } > /etc/cmdline.d/80-cms.conf
 
@@ -36,7 +48,7 @@ IFACES="$IFACES $DEVICE"
 echo "$IFACES" >> /tmp/net.ifaces
 
 if [ -x /usr/libexec/nm-initrd-generator ]; then
-    type nm_generate_connections >/dev/null 2>&1 || . /lib/nm-lib.sh
+    type nm_generate_connections > /dev/null 2>&1 || . /lib/nm-lib.sh
     nm_generate_connections
 else
     exec ifup "$DEVICE"
index bbf49bff2dc3af503a3aa73a355e484038b4e38c..36dc5411813967f662bfc680c1361387dbada30d 100755 (executable)
@@ -1,15 +1,15 @@
 #!/bin/bash
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
-function sysecho () {
+function sysecho() {
     file="$1"
     shift
     local i=1
-    while [ $i -le 10 ] ; do
+    while [ $i -le 10 ]; do
         if [ ! -f "$file" ]; then
             sleep 1
-            i=$((i+1))
+            i=$((i + 1))
         else
             break
         fi
@@ -27,23 +27,25 @@ function dasd_settle() {
         return 1
     fi
     local i=1
-    while [ $i -le 60 ] ; do
+    while [ $i -le 60 ]; do
         local status
         read status < $dasd_status
         case $status in
-            online|unformatted)
-                return 0 ;;
+            online | unformatted)
+                return 0
+                ;;
             *)
                 sleep 0.1
-                i=$((i+1)) ;;
+                i=$((i + 1))
+                ;;
         esac
     done
     return 1
 }
 
 function dasd_settle_all() {
-    for dasdccw in $(while read line || [ -n "$line" ]; do echo "${line%%(*}"; done < /proc/dasd/devices) ; do
-        if ! dasd_settle $dasdccw ; then
+    for dasdccw in $(while read line || [ -n "$line" ]; do echo "${line%%(*}"; done < /proc/dasd/devices); do
+        if ! dasd_settle $dasdccw; then
             echo $"Could not access DASD $dasdccw in time"
             return 1
         fi
@@ -52,8 +54,7 @@ function dasd_settle_all() {
 }
 
 # prints a canonocalized device bus ID for a given devno of any format
-function canonicalize_devno()
-{
+function canonicalize_devno() {
     case ${#1} in
         3) echo "0.0.0${1}" ;;
         4) echo "0.0.${1}" ;;
@@ -63,15 +64,14 @@ function canonicalize_devno()
 }
 
 # read file from CMS and write it to /tmp
-function readcmsfile() # $1=dasdport $2=filename
-{
+function readcmsfile() { # $1=dasdport $2=filename
     local dev
     local numcpus
     local devname
     local ret=0
     if [ $# -ne 2 ]; then return; fi
     # precondition: udevd created dasda block device node
-    if ! dasd_cio_free -d $1 ; then
+    if ! dasd_cio_free -d $1; then
         echo $"DASD $1 could not be cleared from device blacklist"
         return 1
     fi
@@ -86,9 +86,9 @@ function readcmsfile() # $1=dasdport $2=filename
     numcpus=$(
         while read line || [ -n "$line" ]; do
             if strstr "$line" "# processors"; then
-                echo ${line##*:};
-                break;
-            fi;
+                echo ${line##*:}
+                break
+            fi
         done < /proc/cpuinfo
     )
 
@@ -100,7 +100,7 @@ function readcmsfile() # $1=dasdport $2=filename
             return 1
         fi
         udevadm settle
-        if ! dasd_settle $dev ; then
+        if ! dasd_settle $dev; then
             echo $"Could not access DASD $dev in time"
             return 1
         fi
@@ -108,7 +108,11 @@ function readcmsfile() # $1=dasdport $2=filename
 
     udevadm settle
 
-    devname=$(cd /sys/bus/ccw/devices/$dev/block; set -- *; [ -b /dev/$1 ] && echo $1)
+    devname=$(
+        cd /sys/bus/ccw/devices/$dev/block
+        set -- *
+        [ -b /dev/$1 ] && echo $1
+    )
     devname=${devname:-dasda}
 
     [[ -d /mnt ]] || mkdir -p /mnt
@@ -128,7 +132,10 @@ function readcmsfile() # $1=dasdport $2=filename
     udevadm settle
 
     # unbind all dasds to unload the dasd modules for a clean start
-    ( cd /sys/bus/ccw/drivers/dasd-eckd; for i in *.*; do echo $i > unbind;done)
+    (
+        cd /sys/bus/ccw/drivers/dasd-eckd
+        for i in *.*; do echo $i > unbind; done
+    )
     udevadm settle
     modprobe -r dasd_eckd_mod
     udevadm settle
@@ -139,8 +146,7 @@ function readcmsfile() # $1=dasdport $2=filename
     return $ret
 }
 
-processcmsfile()
-{
+processcmsfile() {
     source /tmp/cms.conf
     SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
 
@@ -183,8 +189,8 @@ processcmsfile()
     for i in ${!FCP_*}; do
         echo "${!i}" | while read port rest || [ -n "$port" ]; do
             case $port in
-                *.*.*)
-                    ;;
+                *.*.*) ;;
+
                 *.*)
                     port="0.$port"
                     ;;
index 429979ff14adfbc6829432c06c4e8f54ff4880a5..3eb6595c9e69c9a5a9366cbf45ac2f54cb73336a 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 do_merge() {
     sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 1/' \
@@ -11,8 +11,8 @@ do_merge() {
     umount -R /sysroot
 
     for tag in $(getargs rd.lvm.mergetags); do
-        lvm vgs --noheadings -o vg_name \
-            while read -r vg || [[ -n $vg ]]; do
+        lvm vgs --noheadings -o vg_name \
+            while read -r vg || [[ -n $vg ]]; do
                 unset LVS
                 declare -a LVS
                 lvs=$(lvm lvs --noheadings -o lv_name "$vg")
@@ -22,7 +22,7 @@ do_merge() {
                     tags=$(trim "$(lvm lvs --noheadings -o lv_tags "$vg/$lv")")
                     strstr ",${tags}," ",${tag}," || continue
 
-                    if ! lvm lvs --noheadings -o lv_name "${vg}/${lv}_dracutsnap" &>/dev/null; then
+                    if ! lvm lvs --noheadings -o lv_name "${vg}/${lv}_dracutsnap" &> /dev/null; then
                         info "Creating backup ${lv}_dracutsnap of ${vg}/${lv}"
                         lvm lvcreate -pr -s "${vg}/${lv}" --name "${lv}_dracutsnap"
                     fi
@@ -37,7 +37,7 @@ do_merge() {
                 systemctl --no-block stop sysroot.mount
                 udevadm settle
 
-                for ((i=0; i < 100; i++)); do
+                for ((i = 0; i < 100; i++)); do
                     lvm vgchange -an "$vg" && break
                     sleep 0.5
                 done
@@ -58,7 +58,7 @@ do_merge() {
     systemctl --no-block reset-failed sysroot.mount
     systemctl --no-block start sysroot.mount
 
-    for ((i=0; i < 100; i++)); do
+    for ((i = 0; i < 100; i++)); do
         [[ -d /sysroot/dev ]] && break
         sleep 0.5
         systemctl --no-block start sysroot.mount
@@ -93,4 +93,3 @@ do_merge() {
 if getarg rd.lvm.mergetags; then
     do_merge
 fi
-
index b4ab95a0835d2c5efa3285a759642a22e17b8f3d..3704ffd830d1d136e30c7d9d0cd2c2a3ba03d9da 100755 (executable)
@@ -4,7 +4,7 @@
 
 # called by dracut
 check() {
-# do not add this module by default
+    # do not add this module by default
     local arch=${DRACUT_ARCH:-$(uname -m)}
     [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
     return 0
@@ -13,24 +13,24 @@ check() {
 cmdline() {
     local cio_accept
 
-    if [ -e /boot/zipl/active_devices.txt ] ; then
-        while read dev etc ; do
-            [ "$dev" = "#" -o "$dev" = "" ] && continue;
-            if [ -z "$cio_accept" ] ; then
+    if [ -e /boot/zipl/active_devices.txt ]; then
+        while read dev etc; do
+            [ "$dev" = "#" -o "$dev" = "" ] && continue
+            if [ -z "$cio_accept" ]; then
                 cio_accept="$dev"
             else
                 cio_accept="${cio_accept},${dev}"
             fi
         done < /boot/zipl/active_devices.txt
     fi
-    if [ -n "$cio_accept" ] ; then
-       echo "rd.cio_accept=${cio_accept}"
+    if [ -n "$cio_accept" ]; then
+        echo "rd.cio_accept=${cio_accept}"
     fi
 }
 
 # called by dracut
 install() {
-    if [[ $hostonly_cmdline == "yes" ]] ; then
+    if [[ $hostonly_cmdline == "yes" ]]; then
         local _cio_accept=$(cmdline)
         [[ $_cio_accept ]] && printf "%s\n" "$_cio_accept" >> "${initdir}/etc/cmdline.d/01cio_accept.conf"
     fi
index 4f899d250d12e01be2360bdf1966c1525c5a3f2c..80dc6235f943d7dfc77475062b0293bfc4d97d09 100755 (executable)
@@ -5,15 +5,15 @@
 CIO_IGNORE=$(getarg cio_ignore)
 CIO_ACCEPT=$(getarg rd.cio_accept)
 
-if [ -z $CIO_IGNORE ] ; then
+if [ -z $CIO_IGNORE ]; then
     info "cio_ignored disabled on commandline"
     return
 fi
-if [ -n "$CIO_ACCEPT" ] ; then
+if [ -n "$CIO_ACCEPT" ]; then
     OLDIFS="$IFS"
     IFS=,
     set -- $CIO_ACCEPT
-    while (($# > 0)) ; do
+    while (($# > 0)); do
         info "Enabling device $1"
         cio_ignore --remove $1
         shift
index 4ace746fd497f577a9ae238e0ee02f6ecac47115..6d14406a691eb6d95466bd5ae64144de643bf218 100755 (executable)
@@ -1,15 +1,15 @@
 #!/bin/sh
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 btrfs_check_complete() {
     local _rootinfo _dev
     _dev="${1:-/dev/root}"
     [ -e "$_dev" ] || return 0
-    _rootinfo=$(udevadm info --query=env "--name=$_dev" 2>/dev/null)
+    _rootinfo=$(udevadm info --query=env "--name=$_dev" 2> /dev/null)
     if strstr "$_rootinfo" "ID_FS_TYPE=btrfs"; then
         info "Checking, if btrfs device complete"
-        btrfs device ready "$_dev" >/dev/null 2>&1
+        btrfs device ready "$_dev" > /dev/null 2>&1
         return $?
     fi
     return 0
index 3d1b0d8f41ec6435f2b270f251aeb37f2396cb2b..d0895bd09a4cbdab2109486202e7fe7245b8bfb6 100755 (executable)
@@ -1,18 +1,18 @@
 #!/bin/sh
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 btrfs_check_complete() {
     local _rootinfo _dev
     _dev="${1:-/dev/root}"
     [ -e "$_dev" ] || return 0
-    _rootinfo=$(udevadm info --query=env "--name=$_dev" 2>/dev/null)
+    _rootinfo=$(udevadm info --query=env "--name=$_dev" 2> /dev/null)
     if strstr "$_rootinfo" "ID_FS_TYPE=btrfs"; then
         info "Checking, if btrfs device complete"
         unset __btrfs_mount
-        mount -o ro "$_dev" /tmp >/dev/null 2>&1
+        mount -o ro "$_dev" /tmp > /dev/null 2>&1
         __btrfs_mount=$?
-        [ $__btrfs_mount -eq 0 ] && umount "$_dev" >/dev/null 2>&1
+        [ $__btrfs_mount -eq 0 ] && umount "$_dev" > /dev/null 2>&1
         return $__btrfs_mount
     fi
     return 0
index 9c98470b3c2461b7e424767dc5e11a2c566b57dd..326231b7f5dd5ab5a1bf802db69a8f1d51f141a3 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 info "Scanning for all btrfs devices"
-/sbin/btrfs device scan >/dev/null 2>&1
+/sbin/btrfs device scan > /dev/null 2>&1
index 79f89a503dc1639cde0bd7e2a9d039d7065036b3..f758bf695d5674e3de9b9e3d30b0b4ef2fb4ceab 100755 (executable)
@@ -34,9 +34,11 @@ install() {
         inst_rules "$moddir/80-btrfs.rules"
         case "$(btrfs --help)" in
             *device\ ready*)
-                inst_script "$moddir/btrfs_device_ready.sh" /sbin/btrfs_finished ;;
+                inst_script "$moddir/btrfs_device_ready.sh" /sbin/btrfs_finished
+                ;;
             *)
-                inst_script "$moddir/btrfs_finished.sh" /sbin/btrfs_finished ;;
+                inst_script "$moddir/btrfs_finished.sh" /sbin/btrfs_finished
+                ;;
         esac
     fi
 
index c8190232c025711820d51bddb79ffdb817079a77..ba74fedc1325995f9545f19ac8065c0a78460055 100755 (executable)
@@ -1,13 +1,13 @@
 #!/bin/sh
 
 # close everything which is not busy
-rm -f -- /etc/udev/rules.d/70-luks.rules >/dev/null 2>&1
+rm -f -- /etc/udev/rules.d/70-luks.rules > /dev/null 2>&1
 
-if ! getarg rd.luks.uuid -d rd_LUKS_UUID >/dev/null 2>&1 && getargbool 1 rd.luks -d -n rd_NO_LUKS >/dev/null 2>&1; then
+if ! getarg rd.luks.uuid -d rd_LUKS_UUID > /dev/null 2>&1 && getargbool 1 rd.luks -d -n rd_NO_LUKS > /dev/null 2>&1; then
     while true; do
         local do_break="y"
         for i in /dev/mapper/luks-*; do
-            cryptsetup luksClose $i >/dev/null 2>&1 && do_break=n
+            cryptsetup luksClose $i > /dev/null 2>&1 && do_break=n
         done
         [ "$do_break" = "y" ] && break
     done
index 12ee4af630b6af6e306871b1f632d413777b1e9d..07d92d41dafb9a13dfb3d8b2363d4d461a20a365 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-command -v getarg >/dev/null || . /lib/dracut-lib.sh
+command -v getarg > /dev/null || . /lib/dracut-lib.sh
 
 # check if the crypttab contains an entry for a LUKS UUID
 crypttab_contains() {
@@ -49,30 +49,67 @@ crypttab_contains() {
 #   Turn off input echo before tty command is executed and turn on after.
 #   It's useful when password is read from stdin.
 ask_for_password() {
-    local cmd; local prompt; local tries=3
-    local ply_cmd; local ply_prompt; local ply_tries=3
-    local tty_cmd; local tty_prompt; local tty_tries=3
+    local cmd
+    local prompt
+    local tries=3
+    local ply_cmd
+    local ply_prompt
+    local ply_tries=3
+    local tty_cmd
+    local tty_prompt
+    local tty_tries=3
     local ret
 
     while [ $# -gt 0 ]; do
         case "$1" in
-            --cmd) ply_cmd="$2"; tty_cmd="$2"; shift;;
-            --ply-cmd) ply_cmd="$2"; shift;;
-            --tty-cmd) tty_cmd="$2"; shift;;
-            --prompt) ply_prompt="$2"; tty_prompt="$2"; shift;;
-            --ply-prompt) ply_prompt="$2"; shift;;
-            --tty-prompt) tty_prompt="$2"; shift;;
-            --tries) ply_tries="$2"; tty_tries="$2"; shift;;
-            --ply-tries) ply_tries="$2"; shift;;
-            --tty-tries) tty_tries="$2"; shift;;
-            --tty-echo-off) tty_echo_off=yes;;
+            --cmd)
+                ply_cmd="$2"
+                tty_cmd="$2"
+                shift
+                ;;
+            --ply-cmd)
+                ply_cmd="$2"
+                shift
+                ;;
+            --tty-cmd)
+                tty_cmd="$2"
+                shift
+                ;;
+            --prompt)
+                ply_prompt="$2"
+                tty_prompt="$2"
+                shift
+                ;;
+            --ply-prompt)
+                ply_prompt="$2"
+                shift
+                ;;
+            --tty-prompt)
+                tty_prompt="$2"
+                shift
+                ;;
+            --tries)
+                ply_tries="$2"
+                tty_tries="$2"
+                shift
+                ;;
+            --ply-tries)
+                ply_tries="$2"
+                shift
+                ;;
+            --tty-tries)
+                tty_tries="$2"
+                shift
+                ;;
+            --tty-echo-off) tty_echo_off=yes ;;
         esac
         shift
     done
 
-    { flock -s 9;
+    {
+        flock -s 9
         # Prompt for password with plymouth, if installed and running.
-        if type plymouth >/dev/null 2>&1 && plymouth --ping 2>/dev/null; then
+        if type plymouth > /dev/null 2>&1 && plymouth --ping 2> /dev/null; then
             plymouth ask-for-password \
                 --prompt "$ply_prompt" --number-of-tries=$ply_tries \
                 --command="$ply_cmd"
@@ -85,17 +122,17 @@ ask_for_password() {
 
             local i=1
             while [ $i -le $tty_tries ]; do
-                [ -n "$tty_prompt" ] && \
-                    printf "$tty_prompt [$i/$tty_tries]:" >&2
+                [ -n "$tty_prompt" ] \
+                    && 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
 
             [ "$tty_echo_off" = yes ] && stty $stty_orig
         fi
-    } 9>/.console_lock
+    } 9> /.console_lock
 
     [ $ret -ne 0 ] && echo "Wrong password" >&2
     return $ret
@@ -107,14 +144,17 @@ ask_for_password() {
 # example:
 # test_dev -f LABEL="nice label" /some/file1
 test_dev() {
-    local test_op=$1; local dev="$2"; local f="$3"
-    local ret=1; local mount_point=$(mkuniqdir /mnt testdev)
+    local test_op=$1
+    local dev="$2"
+    local f="$3"
+    local ret=1
+    local mount_point=$(mkuniqdir /mnt testdev)
     local path
 
     [ -n "$dev" -a -n "$*" ] || return 1
     [ -d "$mount_point" ] || die 'Mount point does not exist!'
 
-    if mount -r "$dev" "$mount_point" >/dev/null 2>&1; then
+    if mount -r "$dev" "$mount_point" > /dev/null 2>&1; then
         test $test_op "${mount_point}/${f}"
         ret=$?
         umount "$mount_point"
@@ -139,7 +179,8 @@ test_dev() {
 # Returns true if /dev/dm-1 UUID starts with "123".
 match_dev() {
     [ -z "$1" -o "$1" = '*' ] && return 0
-    local devlist; local dev
+    local devlist
+    local dev
 
     devlist="$(devnames "$1")" || return 255
     dev="$(devnames "$2")" || return 255
@@ -162,8 +203,11 @@ $dev
 # May print:
 #   /dev/sdc1:/keys/some.key
 getkey() {
-    local keys_file="$1"; local for_dev="$2"
-    local luks_dev; local key_dev; local key_path
+    local keys_file="$1"
+    local for_dev="$2"
+    local luks_dev
+    local key_dev
+    local key_path
 
     [ -z "$keys_file" -o -z "$for_dev" ] && die 'getkey: wrong usage!'
     [ -f "$keys_file" ] || return 1
index 7a8cfdff1f7b6039d1110c4caa6cdc95aa239f26..3e78e6dedee270fb13c6bd8c5462e96ad64dc371 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 . /lib/dracut-lib.sh
-type crypttab_contains >/dev/null 2>&1 || . /lib/dracut-crypt-lib.sh
+type crypttab_contains > /dev/null 2>&1 || . /lib/dracut-crypt-lib.sh
 
 dev=$1
 luks=$2
@@ -24,7 +24,7 @@ fi
 
 echo "$luks $dev - timeout=0,$allowdiscards" >> /etc/crypttab
 
-if command -v systemctl >/dev/null; then
+if command -v systemctl > /dev/null; then
     systemctl daemon-reload
     systemctl start cryptsetup.target
 fi
index 1ea77ccc00aacfc06361c273475aec7a092df660..79d1a2584e10ff7983ca9539c5853540b4b5a1bb 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 94ad8484cda4a762c4c14feb1853df2a474f0af3..330e4b41a1bd7a47211e519af15a5bd78b111fc9 100755 (executable)
@@ -46,7 +46,7 @@ installkernel() {
                 IFS=$_OLD_IFS
                 # try to load the cipher part with "crypto-" prepended
                 # in non-hostonly mode
-                hostonly= instmods $(for k in "$@"; do echo "crypto-$k";done)
+                hostonly= instmods $(for k in "$@"; do echo "crypto-$k"; done)
             fi
         done
     }
@@ -62,10 +62,10 @@ cmdline() {
         UUID=$(
             blkid -u crypto -o export $dev \
                 | while read line || [ -n "$line" ]; do
-                [[ ${line#UUID} = $line ]] && continue
-                printf "%s" "${line#UUID=}"
-                break
-            done
+                    [[ ${line#UUID} = $line ]] && continue
+                    printf "%s" "${line#UUID=}"
+                    break
+                done
         )
         [[ ${UUID} ]] || continue
         printf "%s" " rd.luks.uuid=luks-${UUID}"
@@ -95,14 +95,14 @@ install() {
             [[ $_mapper = \#* ]] && continue
             [[ $_dev ]] || continue
 
-            [[ $_dev == PARTUUID=* ]] && \
-                _dev="/dev/disk/by-partuuid/${_dev#PARTUUID=}"
+            [[ $_dev == PARTUUID=* ]] \
+                && _dev="/dev/disk/by-partuuid/${_dev#PARTUUID=}"
 
-            [[ $_dev == UUID=* ]] && \
-                _dev="/dev/disk/by-uuid/${_dev#UUID=}"
+            [[ $_dev == UUID=* ]] \
+                && _dev="/dev/disk/by-uuid/${_dev#UUID=}"
 
-            [[ $_dev == ID=* ]] && \
-                _dev="/dev/disk/by-id/${_dev#ID=}"
+            [[ $_dev == ID=* ]] \
+                && _dev="/dev/disk/by-id/${_dev#ID=}"
 
             echo "$_dev $(blkid $_dev -s UUID -o value)" >> "${initdir}/etc/block_uuid.map"
 
@@ -147,15 +147,15 @@ install() {
         # the cryptsetup targets are already pulled in by 00systemd, but not
         # the enablement symlinks
         inst_multiple -o \
-                      $systemdutildir/system-generators/systemd-cryptsetup-generator \
-                      $systemdutildir/systemd-cryptsetup \
-                      $systemdsystemunitdir/systemd-ask-password-console.path \
-                      $systemdsystemunitdir/systemd-ask-password-console.service \
-                      $systemdsystemunitdir/cryptsetup.target \
-                      $systemdsystemunitdir/sysinit.target.wants/cryptsetup.target \
-                      $systemdsystemunitdir/remote-cryptsetup.target \
-                      $systemdsystemunitdir/initrd-root-device.target.wants/remote-cryptsetup.target \
-                      systemd-ask-password systemd-tty-ask-password-agent
+            $systemdutildir/system-generators/systemd-cryptsetup-generator \
+            $systemdutildir/systemd-cryptsetup \
+            $systemdsystemunitdir/systemd-ask-password-console.path \
+            $systemdsystemunitdir/systemd-ask-password-console.service \
+            $systemdsystemunitdir/cryptsetup.target \
+            $systemdsystemunitdir/sysinit.target.wants/cryptsetup.target \
+            $systemdsystemunitdir/remote-cryptsetup.target \
+            $systemdsystemunitdir/initrd-root-device.target.wants/remote-cryptsetup.target \
+            systemd-ask-password systemd-tty-ask-password-agent
     fi
 
     dracut_need_initqueue
index b85bbdc07edcdb1abadf3d6710d92f904b6ef053..56a19835564c842e19681bc5e9497394adf4e750 100755 (executable)
@@ -1,7 +1,6 @@
 #!/bin/sh
 
-type crypttab_contains >/dev/null 2>&1 || . /lib/dracut-crypt-lib.sh
-
+type crypttab_contains > /dev/null 2>&1 || . /lib/dracut-crypt-lib.sh
 
 _cryptgetargsname() {
     debug_off
@@ -12,15 +11,15 @@ _cryptgetargsname() {
     set --
     for _o in $(getargs rd.luks.name); do
         if [ "${_o%=*}" = "${_key%=}" ]; then
-            [ -n "${_o%=*}" ] && set -- "$@" "${_o#*=}";
-            _found=1;
+            [ -n "${_o%=*}" ] && set -- "$@" "${_o#*=}"
+            _found=1
         fi
     done
     if [ -n "$_found" ]; then
         [ $# -gt 0 ] && printf '%s' "$*"
         return 0
     fi
-    return 1;
+    return 1
 }
 
 if ! getargbool 1 rd.luks -d -n rd_NO_LUKS; then
index 04813414c991bfc368c334a3356f17cff03f9aab..add49b2aaabf9ed1ce0dc175f51bfcb76619df0f 100755 (executable)
@@ -1,8 +1,8 @@
 #!/bin/sh
 
-if getargbool 1 rd.luks -n rd_NO_LUKS && \
-        [ -n "$(getarg rd.luks.key)" ]; then
-    exec 7>/etc/udev/rules.d/65-luks-keydev.rules
+if getargbool 1 rd.luks -n rd_NO_LUKS \
+    && [ -n "$(getarg rd.luks.key)" ]; then
+    exec 7> /etc/udev/rules.d/65-luks-keydev.rules
     echo 'SUBSYSTEM!="block", GOTO="luks_keydev_end"' >&7
     echo 'ACTION!="add|change", GOTO="luks_keydev_end"' >&7
 
index 04a0e096117192362f968dd72ed9457c539a3089..e5a3f368a712ebf6ebf39aded1ad56d5c51453fd 100755 (executable)
@@ -2,8 +2,9 @@
 
 . /lib/dracut-crypt-lib.sh
 
-
-real_keydev="$1"; keypath="$2"; luksdev="$3"
+real_keydev="$1"
+keypath="$2"
+luksdev="$3"
 
 [ -z "$real_keydev" -o -z "$keypath" ] && die 'probe-keydev: wrong usage!'
 [ -z "$luksdev" ] && luksdev='*'
index 3b861119828a08c03d71512c615d1a9055b1bc0c..ba8d962c7c560ac1dae676fbb5628f13b47c1655 100755 (executable)
@@ -1,4 +1,4 @@
 #!/bin/sh
 
 strstr "$(cat /proc/misc)" device-mapper || modprobe dm_mod
-modprobe dm_mirror 2>/dev/null
+modprobe dm_mirror 2> /dev/null
index b51df2de49e31ff1b37c44442fbad97e8876b224..0a8a1030257758a13a4533c60ad81d57ad6bff9f 100755 (executable)
@@ -5,7 +5,7 @@ _remove_dm() {
     local s
     local devname
 
-    for s in /sys/block/${dev}/holders/dm-* ; do
+    for s in /sys/block/${dev}/holders/dm-*; do
         [ -e ${s} ] || continue
         _remove_dm ${s##*/}
     done
@@ -30,12 +30,12 @@ _do_dm_shutdown() {
     local dev
 
     info "Disassembling device-mapper devices"
-    for dev in /sys/block/dm-* ; do
+    for dev in /sys/block/dm-*; do
         [ -e ${dev} ] || continue
         if [ "x$final" != "x" ]; then
             _remove_dm ${dev##*/} || ret=$?
         else
-            _remove_dm ${dev##*/} >/dev/null 2>&1 || ret=$?
+            _remove_dm ${dev##*/} > /dev/null 2>&1 || ret=$?
         fi
     done
     if [ "x$final" != "x" ]; then
@@ -45,8 +45,8 @@ _do_dm_shutdown() {
     return $ret
 }
 
-if command -v dmsetup >/dev/null &&
-    [ "x$(dmsetup status)" != "xNo devices found" ]; then
+if command -v dmsetup > /dev/null \
+    && [ "x$(dmsetup status)" != "xNo devices found" ]; then
     _do_dm_shutdown $1
 else
     :
index 01482343fe58800334f8b87f9bf307493ad88e2f..59467edf79d223e191a86e483c9d2063616fc291 100755 (executable)
@@ -18,8 +18,8 @@ installkernel() {
 
 # called by dracut
 install() {
-    modinfo -k "$kernel" dm_mod >/dev/null 2>&1 && \
-        inst_hook pre-udev 30 "$moddir/dm-pre-udev.sh"
+    modinfo -k "$kernel" dm_mod > /dev/null 2>&1 \
+        && inst_hook pre-udev 30 "$moddir/dm-pre-udev.sh"
 
     inst_multiple dmsetup
     inst_multiple -o dmeventd
@@ -40,4 +40,3 @@ install() {
 
     inst_hook shutdown 25 "$moddir/dm-shutdown.sh"
 }
-
index edae978403da0564213e1c2c43414e912f977a3c..812e0362530bbebee41c465f2d4058f3652757a0 100755 (executable)
@@ -1,13 +1,13 @@
 #!/bin/sh
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 dev="$1"
 devenc=$(str_replace "$1" '/' '\2f')
 
 [ -e /tmp/dmraid.$devenc ] && exit 0
 
->/tmp/dmraid.$devenc
+> /tmp/dmraid.$devenc
 
 DM_RAIDS=$(getargs rd.dm.uuid -d rd_DM_UUID=)
 
@@ -24,10 +24,10 @@ if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then
     fi
 
     info "Found dmraid sets:"
-    echo $SETS|vinfo
+    echo $SETS | vinfo
 
     if [ -n "$DM_RAIDS" ]; then
-    # only activate specified DM RAIDS
+        # only activate specified DM RAIDS
         for r in $DM_RAIDS; do
             for s in $SETS; do
                 if [ "${s##$r}" != "$s" ]; then
@@ -37,7 +37,7 @@ if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then
             done
         done
     else
-    # scan and activate all DM RAIDS
+        # scan and activate all DM RAIDS
         for s in $SETS; do
             info "Activating $s"
             dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
index 8038899af525ca3aaa4c4f7642a52d4026c534cb..10868995afa8bab3d93aed59d4556078ca905cae 100755 (executable)
@@ -47,7 +47,7 @@ cmdline() {
         for holder in "$DEVPATH"/holders/*; do
             [[ -e "$holder" ]] || continue
             dev="/dev/${holder##*/}"
-            DM_NAME="$(dmsetup info -c --noheadings -o name "$dev" 2>/dev/null)"
+            DM_NAME="$(dmsetup info -c --noheadings -o name "$dev" 2> /dev/null)"
             [[ ${DM_NAME} ]] && break
         done
 
index 5f92b79c6c92b044564a9a69ed768e68961c6342..d7a6b69628ec971fd0515569072821dbbe88e156 100755 (executable)
@@ -6,14 +6,14 @@ if ! getargbool 1 rd.dm -d -n rd_NO_DM || getarg "rd.dm=0" -d nodmraid; then
     udevproperty rd_NO_DM=1
 fi
 
-if  ! command -v mdadm >/dev/null \
+if ! command -v mdadm > /dev/null \
     || ! getargbool 1 rd.md.imsm -d -n rd_NO_MDIMSM -n noiswmd \
     || ! getargbool 1 rd.md -d -n rd_NO_MD; then
     info "rd.md.imsm=0: no MD RAID for imsm/isw raids"
     udevproperty rd_NO_MDIMSM=1
 fi
 
-if  ! command -v mdadm >/dev/null \
+if ! command -v mdadm > /dev/null \
     || ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF -n noddfmd \
     || ! getargbool 1 rd.md -d -n rd_NO_MD; then
     info "rd.md.ddf=0: no MD RAID for SNIA ddf raids"
index 6c1d048572af3ee138052fc7f8d2906e80b93dff..a5a5a391816cc48f87315e21b8f58f08b4ea1ae3 100755 (executable)
@@ -15,8 +15,8 @@ if [ -h /dev/root ] && [ -d /run/initramfs/live/updates -o -d /updates ]; then
     umount "$NEWROOT"/run
 fi
 # release resources on iso-scan boots with rd.live.ram
-if [ -d /run/initramfs/isoscan ] &&
-   [ -f /run/initramfs/squashed.img -o -f /run/initramfs/rootfs.img ]; then
+if [ -d /run/initramfs/isoscan ] \
+    && [ -f /run/initramfs/squashed.img -o -f /run/initramfs/rootfs.img ]; then
     umount --detach-loop /run/initramfs/live
     umount /run/initramfs/isoscan
 fi
index 1a4070443c6bc47115279bb5a5034f0137139a7f..0fa3dbcc014e91825b756f0e7700e7a941415fb5 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 [ -z "$root" ] && root=$(getarg root=)
 
@@ -9,29 +9,34 @@ if getargbool 0 rd.live.image -d -y liveimg; then
     liveroot="live:$root"
 fi
 
-if [ "${root%%:*}" = "live" ] ; then
+if [ "${root%%:*}" = "live" ]; then
     liveroot=$root
 fi
 
 [ "${liveroot%%:*}" = "live" ] || exit 0
 
 case "$liveroot" in
-    live:LABEL=*|LABEL=* | live:UUID=*|UUID=* | live:PARTUUID=*|PARTUUID=* | live:PARTLABEL=*|PARTLABEL=*)
+    live:LABEL=* | LABEL=* | live:UUID=* | UUID=* | live:PARTUUID=* | PARTUUID=* | live:PARTLABEL=* | PARTLABEL=*)
         root="live:$(label_uuid_to_dev "${root#live:}")"
-        rootok=1 ;;
-    live:CDLABEL=*|CDLABEL=*)
+        rootok=1
+        ;;
+    live:CDLABEL=* | CDLABEL=*)
         root="${root#live:}"
         root="$(echo "$root" | sed 's,/,\\x2f,g;s, ,\\x20,g')"
         root="live:/dev/disk/by-label/${root#CDLABEL=}"
-        rootok=1 ;;
-    live:/*.[Ii][Ss][Oo]|/*.[Ii][Ss][Oo])
+        rootok=1
+        ;;
+    live:/*.[Ii][Ss][Oo] | /*.[Ii][Ss][Oo])
         root="${root#live:}"
         root="liveiso:${root}"
-        rootok=1 ;;
+        rootok=1
+        ;;
     live:/dev/*)
-        rootok=1 ;;
-    live:/*.[Ii][Mm][Gg]|/*.[Ii][Mm][Gg])
-        [ -f "${root#live:}" ] && rootok=1 ;;
+        rootok=1
+        ;;
+    live:/*.[Ii][Mm][Gg] | /*.[Ii][Mm][Gg])
+        [ -f "${root#live:}" ] && rootok=1
+        ;;
 esac
 
 [ "$rootok" != "1" ] && exit 0
index e0c1da3cb96182196f8f896b11ed27dbc9ed481d..8c7cad8fe86433891f2b9fcda469e825e4011135 100755 (executable)
@@ -1,18 +1,18 @@
 #!/bin/sh
 
 case "$root" in
-  live:/dev/*)
-    {
-        printf 'KERNEL=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root %s"\n' \
-            "${root#live:/dev/}" "${root#live:}"
-        printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root %s"\n' \
-            "${root#live:/dev/}" "${root#live:}"
-    } >> /etc/udev/rules.d/99-live-squash.rules
-    wait_for_dev -n "${root#live:}"
-  ;;
-  live:*)
-    if [ -f "${root#live:}" ]; then
-        /sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root "${root#live:}"
-    fi
-  ;;
+    live:/dev/*)
+        {
+            printf 'KERNEL=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root %s"\n' \
+                "${root#live:/dev/}" "${root#live:}"
+            printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root %s"\n' \
+                "${root#live:/dev/}" "${root#live:}"
+        } >> /etc/udev/rules.d/99-live-squash.rules
+        wait_for_dev -n "${root#live:}"
+        ;;
+    live:*)
+        if [ -f "${root#live:}" ]; then
+            /sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root "${root#live:}"
+        fi
+        ;;
 esac
index 0f6ceb6a2b257d5523ba96ee0d0dbf8d8d6f270e..a0d7d71125430383fed0c8621ae8b50feb337cbc 100755 (executable)
@@ -1,8 +1,8 @@
 #!/bin/sh
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
-command -v unpack_archive >/dev/null || . /lib/img-lib.sh
+command -v unpack_archive > /dev/null || . /lib/img-lib.sh
 
 PATH=/usr/sbin:/usr/bin:/sbin:/bin
 
@@ -40,7 +40,7 @@ if [ "$fs" = "iso9660" -o "$fs" = "udf" ]; then
 fi
 getarg rd.live.check -d check || check=""
 if [ -n "$check" ]; then
-    type plymouth >/dev/null 2>&1 && plymouth --hide-splash
+    type plymouth > /dev/null 2>&1 && plymouth --hide-splash
     if [ -n "$DRACUT_SYSTEMD" ]; then
         p=$(dev_unit_name "$livedev")
         systemctl start checkisomd5@${p}.service
@@ -51,7 +51,7 @@ if [ -n "$check" ]; then
         die "CD check failed!"
         exit 1
     fi
-    type plymouth >/dev/null 2>&1 && plymouth --show-splash
+    type plymouth > /dev/null 2>&1 && plymouth --show-splash
 fi
 
 ln -s $livedev /run/initramfs/livedev
@@ -77,7 +77,7 @@ if [ -f $livedev ]; then
     # check filesystem type and handle accordingly
     fstype=$(det_img_fs $livedev)
     case $fstype in
-        squashfs) SQUASHED=$livedev;;
+        squashfs) SQUASHED=$livedev ;;
         auto) die "cannot mount live image (unknown filesystem type)" ;;
         *) FSIMG=$livedev ;;
     esac
@@ -85,8 +85,8 @@ if [ -f $livedev ]; then
 else
     livedev_fstype=$(blkid -o value -s TYPE $livedev)
     if [ "$livedev_fstype" = "squashfs" ]; then
-       # no mount needed - we've already got the LiveOS image in $livedev
-       SQUASHED=$livedev
+        # no mount needed - we've already got the LiveOS image in $livedev
+        SQUASHED=$livedev
     elif [ "$livedev_fstype" != "ntfs" ]; then
         mount -n -t $fstype -o ${liverw:-ro} $livedev /run/initramfs/live
     else
@@ -94,7 +94,7 @@ else
         # at the first glance, but ends with lots and lots of squashfs
         # errors, because systemd attempts to kill the ntfs-3g process?!
         if [ -x "/usr/bin/ntfs-3g" ]; then
-            ( exec -a @ntfs-3g ntfs-3g -o ${liverw:-ro} $livedev /run/initramfs/live ) | vwarn
+            (exec -a @ntfs-3g ntfs-3g -o ${liverw:-ro} $livedev /run/initramfs/live) | vwarn
         else
             die "Failed to mount block device of live image: Missing NTFS support"
             exit 1
@@ -142,7 +142,7 @@ do_live_overlay() {
             if [ -z "$oltype" ] || [ "$oltype" = DM_snapshot_cow ]; then
                 if [ -n "$reset_overlay" ]; then
                     info "Resetting the Device-mapper overlay."
-                    dd if=/dev/zero of=$OVERLAY_LOOPDEV bs=64k count=1 conv=fsync 2>/dev/null
+                    dd if=/dev/zero of=$OVERLAY_LOOPDEV bs=64k count=1 conv=fsync 2> /dev/null
                 fi
                 if [ -n "$overlayfs" ]; then
                     unset -v overlayfs
@@ -151,8 +151,8 @@ do_live_overlay() {
                 setup="yes"
             else
                 mount -n -t $oltype $opt $OVERLAY_LOOPDEV /run/initramfs/overlayfs
-                if [ -d /run/initramfs/overlayfs/overlayfs ] &&
-                    [ -d /run/initramfs/overlayfs/ovlwork ]; then
+                if [ -d /run/initramfs/overlayfs/overlayfs ] \
+                    && [ -d /run/initramfs/overlayfs/ovlwork ]; then
                     ln -s /run/initramfs/overlayfs/overlayfs /run/overlayfs$opt
                     ln -s /run/initramfs/overlayfs/ovlwork /run/ovlwork$opt
                     if [ -z "$overlayfs" ] && [ -n "$DRACUT_SYSTEMD" ]; then
@@ -162,8 +162,8 @@ do_live_overlay() {
                     setup="yes"
                 fi
             fi
-        elif [ -d /run/initramfs/overlayfs$pathspec ] &&
-            [ -d /run/initramfs/overlayfs$pathspec/../ovlwork ]; then
+        elif [ -d /run/initramfs/overlayfs$pathspec ] \
+            && [ -d /run/initramfs/overlayfs$pathspec/../ovlwork ]; then
             ln -s /run/initramfs/overlayfs$pathspec /run/overlayfs$opt
             ln -s /run/initramfs/overlayfs$pathspec/../ovlwork /run/ovlwork$opt
             if [ -z "$overlayfs" ] && [ -n "$DRACUT_SYSTEMD" ]; then
@@ -191,14 +191,14 @@ do_live_overlay() {
         if [ -n "$setup" ]; then
             warn "Using temporary overlay."
         elif [ -n "$devspec" -a -n "$pathspec" ]; then
-            [ -z "$m" ] &&
-                m='   Unable to find a persistent overlay; using a temporary one.'
+            [ -z "$m" ] \
+                && m='   Unable to find a persistent overlay; using a temporary one.'
             m="$m"$'\n      All root filesystem changes will be lost on shutdown.'
             m="$m"$'\n         Press [Enter] to continue.'
             printf "\n\n\n\n${m}\n\n\n" > /dev/kmsg
             if [ -n "$DRACUT_SYSTEMD" ]; then
-                if type plymouth >/dev/null 2>&1 && plymouth --ping ; then
-                    if getargbool 0 rhgb || getargbool 0 splash ; then
+                if type plymouth > /dev/null 2>&1 && plymouth --ping; then
+                    if getargbool 0 rhgb || getargbool 0 splash; then
                         m='>>>'$'\n''>>>'$'\n''>>>'$'\n\n\n'"$m"
                         m="${m%n.*}"$'n.\n\n\n''<<<'$'\n''<<<'$'\n''<<<'
                         plymouth display-message --text="${m}"
@@ -210,7 +210,7 @@ do_live_overlay() {
                     systemd-ask-password --timeout=0 "${m}"
                 fi
             else
-                type plymouth >/dev/null 2>&1 && plymouth --ping && plymouth --quit
+                type plymouth > /dev/null 2>&1 && plymouth --ping && plymouth --quit
                 read -s -r -p $'\n\n'"${m}" -n 1 reply
             fi
         fi
@@ -223,7 +223,7 @@ do_live_overlay() {
                 [ -n "$DRACUT_SYSTEMD" ] && reloadsysrootmountunit="${reloadsysrootmountunit}:>/xor_readonly;"
             fi
         else
-            dd if=/dev/null of=/overlay bs=1024 count=1 seek=$((overlay_size*1024)) 2> /dev/null
+            dd if=/dev/null of=/overlay bs=1024 count=1 seek=$((overlay_size * 1024)) 2> /dev/null
             if [ -n "$setup" -a -n "$readonly_overlay" ]; then
                 RO_OVERLAY_LOOPDEV=$(losetup -f --show /overlay)
                 over=$RO_OVERLAY_LOOPDEV
@@ -249,16 +249,16 @@ 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
         dd if=/dev/null of=/run/initramfs/thin-overlay/meta bs=1b count=1 seek=$((thin_meta_sz)) 2> /dev/null
         dd if=/dev/null of=/run/initramfs/thin-overlay/data bs=1b count=1 seek=$((thin_data_sz)) 2> /dev/null
 
-        THIN_META_LOOPDEV=$( losetup --show -f /run/initramfs/thin-overlay/meta )
-        THIN_DATA_LOOPDEV=$( losetup --show -f /run/initramfs/thin-overlay/data )
+        THIN_META_LOOPDEV=$(losetup --show -f /run/initramfs/thin-overlay/meta)
+        THIN_DATA_LOOPDEV=$(losetup --show -f /run/initramfs/thin-overlay/data)
 
         echo 0 $thin_data_sz thin-pool $THIN_META_LOOPDEV $THIN_DATA_LOOPDEV 1024 1024 | dmsetup create live-overlay-pool
         dmsetup message /dev/mapper/live-overlay-pool 0 "create_thin 0"
@@ -290,7 +290,7 @@ if [ -e "$SQUASHED" ]; then
         SQUASHED="/run/initramfs/squashed.img"
     fi
 
-    SQUASHED_LOOPDEV=$( losetup -f )
+    SQUASHED_LOOPDEV=$(losetup -f)
     losetup -r $SQUASHED_LOOPDEV $SQUASHED
     mkdir -m 0755 -p /run/initramfs/squashfs
     mount -n -t squashfs -o ro $SQUASHED_LOOPDEV /run/initramfs/squashfs
@@ -340,10 +340,10 @@ if [ -n "$FSIMG" ]; then
         FSIMG=/run/initramfs/fsimg/rootfs.img
     fi
     opt=-r
-       # For writable DM images...
-    if [ -z "$SQUASHED" -a -n "$live_ram" -a -z "$overlayfs" ] ||
-       [ -n "$writable_fsimg" ] ||
-       [ "$overlay" = none -o "$overlay" = None -o "$overlay" = NONE ]; then
+    # For writable DM images...
+    if [ -z "$SQUASHED" -a -n "$live_ram" -a -z "$overlayfs" ] \
+        || [ -n "$writable_fsimg" ] \
+        || [ "$overlay" = none -o "$overlay" = None -o "$overlay" = NONE ]; then
         if [ -z "$readonly_overlay" ]; then
             opt=''
             setup=rw
@@ -377,7 +377,7 @@ if [ -n "$overlayfs" ]; then
     if [ -n "$reset_overlay" ] && [ -h /run/overlayfs ]; then
         ovlfs=$(readlink /run/overlayfs)
         info "Resetting the OverlayFS overlay directory."
-        rm -r -- ${ovlfs}/* ${ovlfs}/.* >/dev/null 2>&1
+        rm -r -- ${ovlfs}/* ${ovlfs}/.* > /dev/null 2>&1
     fi
     if [ -n "$readonly_overlay" ] && [ -h /run/overlayfs-r ]; then
         ovlfs=lowerdir=/run/overlayfs-r:/run/rootfsbase
@@ -387,8 +387,8 @@ if [ -n "$overlayfs" ]; then
     mount -r $FSIMG /run/rootfsbase
     if [ -z "$DRACUT_SYSTEMD" ]; then
         printf 'mount -t overlay LiveOS_rootfs -o%s,%s %s\n' "$ROOTFLAGS" \
-        "$ovlfs",upperdir=/run/overlayfs,workdir=/run/ovlwork \
-        "$NEWROOT" > $hookdir/mount/01-$$-live.sh
+            "$ovlfs",upperdir=/run/overlayfs,workdir=/run/ovlwork \
+            "$NEWROOT" > $hookdir/mount/01-$$-live.sh
     fi
 else
     if [ -z "$DRACUT_SYSTEMD" ]; then
@@ -403,4 +403,3 @@ ln -s null /dev/root
 need_shutdown
 
 exit 0
-
index a05629504287a30969cf9009cdb5946aacb08267..7bacca964f3d7a08613e061f1249d5113ead7fa8 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 PATH=/usr/sbin:/usr/bin:/sbin:/bin
 
index 7b6c7ce257166a4ae8b9f6622b72b9d61a3b06a5..8c4423b83ee682dd6b44f611e76bcb9efe23b20a 100755 (executable)
@@ -9,7 +9,7 @@ if getargbool 0 rd.live.image -d -y liveimg; then
     liveroot="live:$root"
 fi
 
-if [ "${root%%:*}" = "live" ] ; then
+if [ "${root%%:*}" = "live" ]; then
     liveroot=$root
 fi
 
@@ -18,22 +18,27 @@ fi
 modprobe -q loop
 
 case "$liveroot" in
-    live:LABEL=*|LABEL=* | live:UUID=*|UUID=* | live:PARTUUID=*|PARTUUID=* | live:PARTLABEL=*|PARTLABEL=*)
+    live:LABEL=* | LABEL=* | live:UUID=* | UUID=* | live:PARTUUID=* | PARTUUID=* | live:PARTLABEL=* | PARTLABEL=*)
         root="live:$(label_uuid_to_dev "${root#live:}")"
-        rootok=1 ;;
-    live:CDLABEL=*|CDLABEL=*)
+        rootok=1
+        ;;
+    live:CDLABEL=* | CDLABEL=*)
         root="${root#live:}"
         root="$(echo "$root" | sed 's,/,\\x2f,g;s, ,\\x20,g')"
         root="live:/dev/disk/by-label/${root#CDLABEL=}"
-        rootok=1 ;;
-    live:/*.[Ii][Ss][Oo]|/*.[Ii][Ss][Oo])
+        rootok=1
+        ;;
+    live:/*.[Ii][Ss][Oo] | /*.[Ii][Ss][Oo])
         root="${root#live:}"
         root="liveiso:${root}"
-        rootok=1 ;;
+        rootok=1
+        ;;
     live:/dev/*)
-        rootok=1 ;;
-    live:/*.[Ii][Mm][Gg]|/*.[Ii][Mm][Gg])
-        [ -f "${root#live:}" ] && rootok=1 ;;
+        rootok=1
+        ;;
+    live:/*.[Ii][Mm][Gg] | /*.[Ii][Mm][Gg])
+        [ -f "${root#live:}" ] && rootok=1
+        ;;
 esac
 
 [ "$rootok" = "1" ] || return 1
index 4366fb43117f7679e85b1f225ea8f56382902246..345efa92123074aad4734db189d9eb81662d803e 100755 (executable)
 #   - "depmod_configs" - array of depmod configuration paths to parse
 #                        (as supplied to depmod -C, ("/run/depmod.d/"
 #                        "/etc/depmod.d/" "/lib/depmod.d/") by default).
-installkernel()
-{
-       : "${depmod_modules_dep:=$srcmods/modules.dep}"
-       : "${depmod_module_dir:=$srcmods}"
-
-       [[ -f "${depmod_modules_dep}" ]] || return 0
-
-       # Message printers with custom prefix
-       local mod_name="kernel-modules-extra"
-       prinfo()  { dinfo  "  ${mod_name}: $*"; }
-       prdebug() { ddebug "  ${mod_name}: $*"; }
-
-       # Escape a string for usage as a part of extended regular expression.
-       # $1 - string to escape
-       re_escape() {
-               printf "%s" "$1" | sed 's/\([.+?^$\/\\|()\[]\|\]\)/\\\0/'
-       }
-
-       local OLDIFS
-       local cfg
-       local cfgs=()
-       local search_list=""
-       local overrides=()
-       local external_dirs=()
-       local e f
-
-
-       ## Gathering and sorting configuration file list
-
-       [ -n "${depmod_configs[*]-}" ] \
-               || depmod_configs=(/run/depmod.d/ /etc/depmod.d/ /lib/depmod.d/)
-
-       for cfg in "${depmod_configs[@]}"; do
-               [ -e "$cfg" ] || {
-                       prdebug "configuration source \"$cfg\" does not exist"
-                       continue
-               }
-
-               # '/' is used as a separator between configuration name and
-               # configuration path
-               if [ -d "$cfg" ]; then
-                       for f in "$cfg/"*; do
-                               [[ -e "$f" && ! -d "$f" ]] || {
-                                       prdebug "configuration source" \
-                                               "\"$cfg\" is ignored" \
-                                               "(directory or doesn't exist)"
-                                       continue
-                               }
-                               cfgs+=("$(basename "$f")/$f")
-                       done
-               else
-                       cfgs+=("$(basename "$cfg")/$cfg")
-               fi
-       done
-
-       OLDIFS="$IFS"
-       IFS=$'\n'
-       LANG=C cfgs=($(printf '%s\n' "${cfgs[@]}" \
-               | sort -u -k1,1 -t '/' | cut -f 2- -d '/'))
-       IFS="$OLDIFS"
-
-
-       ## Parse configurations
-
-       for cfg in "${cfgs[@]}"; do
-               prdebug "parsing configuration file \"$cfg\""
-
-               local k v mod kverpat path
-               while read -r k v; do
-                       case "$k" in
-                       search)
-                               search_list="$search_list $v"
-                               prdebug "$cfg: added \"$v\" to the list of" \
-                                       "search directories"
-                               ;;
-                       override) # module_name kver_pattern dir
-                               read -r mod kverpat path <<<"$v"
-
-                               if [[ ! "$mod" || ! "$kverpat" || ! "$path" ]]
-                               then
-                                       prinfo "$cfg: ignoring incorrect" \
-                                              "override option: \"$k $v\""
-                                       continue
-                               fi
-
-                               if [[ '*' = "$kverpat" ]] \
-                                     || [[ "$kernel" =~ $kverpat ]]
-                               then
-                                       overrides+=("${path}/${mod}")
-
-                                       prdebug "$cfg: added override" \
-                                               "\"${path}/${mod}\""
-                               else
-                                       prdebug "$cfg: override \"$v\" is" \
-                                               "ignored since \"$kverpat\"" \
-                                               "doesn't match \"$kernel\""
-                               fi
-                               ;;
-                       external) # kverpat dir
-                               read -r kverpat path <<<"$v"
-
-                               if [[ ! "$kverpat" || ! "$path" ]]; then
-                                       prinfo "$cfg: ignoring incorrect" \
-                                              "external option: \"$k $v\""
-                                       continue
-                               fi
-
-                               if [[ '*' = "$kverpat" \
-                                     || "$kernel" =~ $kverpat ]]
-                               then
-                                       external_dirs+=("$path")
-
-                                       prdebug "$cfg: added external" \
-                                               "directory \"$path\""
-                               else
-                                       prdebug "$cfg: external directory" \
-                                               "\"$path\" is ignored since" \
-                                               "\"$kverpat\" doesn't match " \
-                                               "\"$kernel\""
-                               fi
-                               ;;
-                       '#'*|'') # comments and empty strings
-                               ;;
-                       include|make_map_files) # ignored by depmod
-                               ;;
-                       *)
-                               prinfo "$cfg: unknown depmod configuration" \
-                                      "option \"$k $v\""
-                               ;;
-                       esac
-               done < "$cfg"
-       done
-
-       # "updates built-in" is the default search list
-       : "${search_list:=updates}"
-
-
-       ## Build a list of regular expressions for grepping modules.dep
-
-       local pathlist=()
-       for f in "${overrides[@]}"; do
-               pathlist+=("^$(re_escape "$f")")
-       done
-
-       for f in $(printf "%s" "$search_list"); do
-               # Ignoring builtin modules
-               [ "built-in" != "$f" ] || continue
-
-               if [ "external" = "$f" ]; then
-                       for e in "${external_dirs[@]}"; do
-                               pathlist+=("$(re_escape "${e%/}")/[^:]+")
-                       done
-               fi
-
-               pathlist+=("$(re_escape "${f%/}")/[^:]+")
-       done
-
-
-       ## Filter modules.dep, canonicalise the resulting filenames and supply
-       ## them to instmods.
-
-       [ 0 -lt "${#pathlist[@]}" ] || return 0
-
-       printf "^%s\.ko(\.gz|\.bz2|\.xz)?:\n" "${pathlist[@]}" \
-               | (LANG=C grep -E -o -f - -- "$depmod_modules_dep" || exit 0) \
-               | tr -d ':' \
-               | (cd "$depmod_module_dir" || exit; xargs -r realpath -se --) \
-               | instmods || return 1
-
-       return 0
+installkernel() {
+    : "${depmod_modules_dep:=$srcmods/modules.dep}"
+    : "${depmod_module_dir:=$srcmods}"
+
+    [[ -f "${depmod_modules_dep}" ]] || return 0
+
+    # Message printers with custom prefix
+    local mod_name="kernel-modules-extra"
+    prinfo() { dinfo "  ${mod_name}: $*"; }
+    prdebug() { ddebug "  ${mod_name}: $*"; }
+
+    # Escape a string for usage as a part of extended regular expression.
+    # $1 - string to escape
+    re_escape() {
+        printf "%s" "$1" | sed 's/\([.+?^$\/\\|()\[]\|\]\)/\\\0/'
+    }
+
+    local OLDIFS
+    local cfg
+    local cfgs=()
+    local search_list=""
+    local overrides=()
+    local external_dirs=()
+    local e f
+
+    ## Gathering and sorting configuration file list
+
+    [ -n "${depmod_configs[*]-}" ] \
+        || depmod_configs=(/run/depmod.d/ /etc/depmod.d/ /lib/depmod.d/)
+
+    for cfg in "${depmod_configs[@]}"; do
+        [ -e "$cfg" ] || {
+            prdebug "configuration source \"$cfg\" does not exist"
+            continue
+        }
+
+        # '/' is used as a separator between configuration name and
+        # configuration path
+        if [ -d "$cfg" ]; then
+            for f in "$cfg/"*; do
+                [[ -e "$f" && ! -d "$f" ]] || {
+                    prdebug "configuration source" \
+                        "\"$cfg\" is ignored" \
+                        "(directory or doesn't exist)"
+                    continue
+                }
+                cfgs+=("$(basename "$f")/$f")
+            done
+        else
+            cfgs+=("$(basename "$cfg")/$cfg")
+        fi
+    done
+
+    OLDIFS="$IFS"
+    IFS=$'\n'
+    LANG=C cfgs=($(printf '%s\n' "${cfgs[@]}" \
+        | sort -u -k1,1 -t '/' | cut -f 2- -d '/'))
+    IFS="$OLDIFS"
+
+    ## Parse configurations
+
+    for cfg in "${cfgs[@]}"; do
+        prdebug "parsing configuration file \"$cfg\""
+
+        local k v mod kverpat path
+        while read -r k v; do
+            case "$k" in
+                search)
+                    search_list="$search_list $v"
+                    prdebug "$cfg: added \"$v\" to the list of" \
+                        "search directories"
+                    ;;
+                override) # module_name kver_pattern dir
+                    read -r mod kverpat path <<< "$v"
+
+                    if [[ ! "$mod" || ! "$kverpat" || ! "$path" ]]; then
+                        prinfo "$cfg: ignoring incorrect" \
+                            "override option: \"$k $v\""
+                        continue
+                    fi
+
+                    if [[ '*' = "$kverpat" ]] \
+                        || [[ "$kernel" =~ $kverpat ]]; then
+                        overrides+=("${path}/${mod}")
+
+                        prdebug "$cfg: added override" \
+                            "\"${path}/${mod}\""
+                    else
+                        prdebug "$cfg: override \"$v\" is" \
+                            "ignored since \"$kverpat\"" \
+                            "doesn't match \"$kernel\""
+                    fi
+                    ;;
+                external) # kverpat dir
+                    read -r kverpat path <<< "$v"
+
+                    if [[ ! "$kverpat" || ! "$path" ]]; then
+                        prinfo "$cfg: ignoring incorrect" \
+                            "external option: \"$k $v\""
+                        continue
+                    fi
+
+                    if [[ '*' = "$kverpat" || \
+                        "$kernel" =~ $kverpat ]]; then
+                        external_dirs+=("$path")
+
+                        prdebug "$cfg: added external" \
+                            "directory \"$path\""
+                    else
+                        prdebug "$cfg: external directory" \
+                            "\"$path\" is ignored since" \
+                            "\"$kverpat\" doesn't match " \
+                            "\"$kernel\""
+                    fi
+                    ;;
+                '#'* | '') # comments and empty strings
+                    ;;
+                include | make_map_files) # ignored by depmod
+                    ;;
+                *)
+                    prinfo "$cfg: unknown depmod configuration" \
+                        "option \"$k $v\""
+                    ;;
+            esac
+        done < "$cfg"
+    done
+
+    # "updates built-in" is the default search list
+    : "${search_list:=updates}"
+
+    ## Build a list of regular expressions for grepping modules.dep
+
+    local pathlist=()
+    for f in "${overrides[@]}"; do
+        pathlist+=("^$(re_escape "$f")")
+    done
+
+    for f in $(printf "%s" "$search_list"); do
+        # Ignoring builtin modules
+        [ "built-in" != "$f" ] || continue
+
+        if [ "external" = "$f" ]; then
+            for e in "${external_dirs[@]}"; do
+                pathlist+=("$(re_escape "${e%/}")/[^:]+")
+            done
+        fi
+
+        pathlist+=("$(re_escape "${f%/}")/[^:]+")
+    done
+
+    ## Filter modules.dep, canonicalise the resulting filenames and supply
+    ## them to instmods.
+
+    [ 0 -lt "${#pathlist[@]}" ] || return 0
+
+    printf "^%s\.ko(\.gz|\.bz2|\.xz)?:\n" "${pathlist[@]}" \
+        | (LANG=C grep -E -o -f - -- "$depmod_modules_dep" || exit 0) \
+        | tr -d ':' \
+        | (
+            cd "$depmod_module_dir" || exit
+            xargs -r realpath -se --
+        ) \
+        | instmods || return 1
+
+    return 0
 }
index 7703d4632966e80448f3a46d58e12a4f13d9fece..a180a9bd4ec00fc02d6d38e869fe60d25ddf6343 100755 (executable)
@@ -5,7 +5,7 @@ installkernel() {
     local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_add_host|scsi_add_host_with_dma'
     local _hostonly_drvs
 
-    find_kernel_modules_external () {
+    find_kernel_modules_external() {
         local _OLDIFS
         local external_pattern="^/"
 
@@ -28,11 +28,11 @@ installkernel() {
         return 1
     }
 
-    install_block_modules_strict () {
+    install_block_modules_strict() {
         hostonly='' instmods $_hostonly_drvs
     }
 
-    install_block_modules () {
+    install_block_modules() {
         instmods \
             scsi_dh_rdac scsi_dh_emc scsi_dh_alua \
             =drivers/usb/storage \
@@ -104,9 +104,8 @@ installkernel() {
 
         # if not on hostonly mode, or there are hostonly block device
         # install block drivers
-        if ! [[ $hostonly ]] || \
-            for_each_host_dev_and_slaves_all record_block_dev_drv;
-        then
+        if ! [[ $hostonly ]] \
+            || 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
index cbe7c85cdfe8918789cd1efdbb2a471ec2e90a14..f1dd72f88e3581c140fa3c384662dc89aad5dcd0 100755 (executable)
@@ -1,11 +1,11 @@
 #!/bin/sh
 
 _modprobe_d=/etc/modprobe.d
-if [ -d /usr/lib/modprobe.d ] ; then
+if [ -d /usr/lib/modprobe.d ]; then
     _modprobe_d=/usr/lib/modprobe.d
-elif [ -d /lib/modprobe.d ] ; then
+elif [ -d /lib/modprobe.d ]; then
     _modprobe_d=/lib/modprobe.d
-elif [ ! -d $_modprobe_d ] ; then
+elif [ ! -d $_modprobe_d ]; then
     mkdir -p $_modprobe_d
 fi
 
@@ -18,20 +18,19 @@ for i in $(getargs rd.driver.pre -d rdloaddriver=); do
     )
 done
 
-
 [ -d /etc/modprobe.d ] || mkdir -p /etc/modprobe.d
 
 for i in $(getargs rd.driver.blacklist -d rdblacklist=); do
     (
         IFS=,
         for p in $i; do
-            echo "blacklist $p" >>  $_modprobe_d/initramfsblacklist.conf
+            echo "blacklist $p" >> $_modprobe_d/initramfsblacklist.conf
         done
     )
 done
 
 for p in $(getargs rd.driver.post -d rdinsmodpost=); do
-    echo "blacklist $p" >>  $_modprobe_d/initramfsblacklist.conf
+    echo "blacklist $p" >> $_modprobe_d/initramfsblacklist.conf
     _do_insmodpost=1
 done
 
index c6c8992b659266bcd8cab91fea2e938304a7639c..cd3b0a5801651ab4fdef653b302c3bdde235d1fb 100755 (executable)
@@ -25,7 +25,7 @@ installkernel() {
     if [[ $hostonly_mode == 'strict' ]] && [[ $hostonly_nics ]]; then
         for _nic in $hostonly_nics; do
             mapfile -t _net_drivers <<< "$(get_dev_module /sys/class/net/"$_nic")"
-            if (( ${#_net_drivers[@]} == 0 )); then
+            if ((${#_net_drivers[@]} == 0)); then
                 derror "--hostonly-nics contains invalid NIC '$_nic'"
                 continue
             fi
@@ -48,4 +48,3 @@ installkernel() {
 install() {
     return 0
 }
-
index 024feaac6d9a6db6491f4f9723882cd8f8e54596..700e38735a8f86e0b57d3fe4fcb9bc9e62b9e718 100755 (executable)
@@ -6,9 +6,9 @@
 # no updates requested? we're not needed.
 [ -e /tmp/liveupdates.info ] || return 0
 
-command -v getarg >/dev/null || . /lib/dracut-lib.sh
-command -v fetch_url >/dev/null || . /lib/url-lib.sh
-command -v unpack_img >/dev/null || . /lib/img-lib.sh
+command -v getarg > /dev/null || . /lib/dracut-lib.sh
+command -v fetch_url > /dev/null || . /lib/url-lib.sh
+command -v unpack_img > /dev/null || . /lib/img-lib.sh
 
 read url < /tmp/liveupdates.info
 
index d82515948155e0e84648948b2410093a95beb0d5..12d1597a8ab4c950ec49bfc94fb88a4a26887786 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 [ -z "$root" ] && root=$(getarg root=)
 
@@ -9,31 +9,37 @@ if getargbool 0 rd.live.image -d -y liveimg; then
     liveroot="live:$root"
 fi
 
-if [ "${root%%:*}" = "live" ] ; then
+if [ "${root%%:*}" = "live" ]; then
     liveroot=$root
 fi
 
 [ "${liveroot%%:*}" = "live" ] || exit 0
 
 case "$liveroot" in
-    live:nfs://*|nfs://*) \
+    live:nfs://* | nfs://*)
         root="${root#live:}"
-        rootok=1 ;;
-    live:http://*|http://*) \
+        rootok=1
+        ;;
+    live:http://* | http://*)
         root="${root#live:}"
-        rootok=1 ;;
-    live:https://*|https://*) \
+        rootok=1
+        ;;
+    live:https://* | https://*)
         root="${root#live:}"
-        rootok=1 ;;
-    live:ftp://*|ftp://*) \
+        rootok=1
+        ;;
+    live:ftp://* | ftp://*)
         root="${root#live:}"
-        rootok=1 ;;
-    live:torrent://*|torrent://*) \
+        rootok=1
+        ;;
+    live:torrent://* | torrent://*)
         root="${root#live:}"
-        rootok=1 ;;
-    live:tftp://*|tftp://*) \
+        rootok=1
+        ;;
+    live:tftp://* | tftp://*)
         root="${root#live:}"
-        rootok=1 ;;
+        rootok=1
+        ;;
 esac
 
 [ "$rootok" != "1" ] && exit 0
index 1f58c55ea54455a8ba0eb66ca1ab54ace353e63b..929c881285b6661de2c03fabe98604afb9f9e247 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # livenetroot - fetch a live image from the network and run it
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 . /lib/url-lib.sh
 
@@ -19,13 +19,12 @@ info "fetching $liveurl"
 imgfile=
 #retry until the imgfile is populated with data or the max retries
 i=1
-while [ "$i" -le $RETRIES ]
-do
+while [ "$i" -le $RETRIES ]; do
     imgfile=$(fetch_url "$liveurl")
 
     if [ $? != 0 ]; then
-            warn "failed to download live image: error $?"
-            imgfile=
+        warn "failed to download live image: error $?"
+        imgfile=
     fi
 
     if [ ! -z "$imgfile" -a -s "$imgfile" ]; then
index a6b28423504fba4a08a2f4beb7fb8d399c2c24d4..b3c0e1730ef30543839e33a3546f13a144df0081 100755 (executable)
@@ -10,7 +10,7 @@ updates=$(getarg live.updates=)
 if [ -n "$updates" ]; then
     # make sure network comes up even if we're doing a local live device
     if [ -z "$netroot" ]; then
-       echo > /tmp/net.ifaces
+        echo > /tmp/net.ifaces
     fi
     echo "$updates" > /tmp/liveupdates.info
     echo '[ -e /tmp/liveupdates.done ]' > \
@@ -22,7 +22,7 @@ str_starts "$liveurl" "live:" || return
 liveurl="${liveurl#live:}"
 
 # setting netroot to "livenet:..." makes "livenetroot" get run after ifup
-if get_url_handler "$liveurl" >/dev/null; then
+if get_url_handler "$liveurl" > /dev/null; then
     info "livenet: root image at $liveurl"
     netroot="livenet:$liveurl"
     root="livenet" # quiet complaints from init
index a7540a5c95c04300a99f411696159d9e02f24c93..f336366ac9935a7ebb803f6e32f6f1d49ff3028f 100755 (executable)
@@ -3,7 +3,7 @@
 # run lvm scan if udev has settled
 
 extraargs="$*"
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 VGS=$(getargs rd.lvm.vg -d rd_LVM_VG=)
 LVS=$(getargs rd.lvm.lv -d rd_LVM_LV=)
@@ -22,25 +22,25 @@ lvmdevs=$(
 
 if [ ! -e /etc/lvm/lvm.conf ]; then
     {
-        echo 'devices {';
+        echo 'devices {'
         printf '    filter = [ '
         for dev in $lvmdevs; do
-            printf '"a|^/dev/%s$|", ' "$dev";
-        done;
-        echo '"r/.*/" ]';
-        echo '}';
+            printf '"a|^/dev/%s$|", ' "$dev"
+        done
+        echo '"r/.*/" ]'
+        echo '}'
 
         # establish LVM locking
         if [ -n "$SNAPSHOT" ]; then
-            echo 'global {';
-            echo '    locking_type = 1';
-            echo '    use_lvmetad = 0';
-            echo '}';
+            echo 'global {'
+            echo '    locking_type = 1'
+            echo '    use_lvmetad = 0'
+            echo '}'
         else
-            echo 'global {';
-            echo '    locking_type = 4';
-            echo '    use_lvmetad = 0';
-            echo '}';
+            echo 'global {'
+            echo '    locking_type = 4'
+            echo '    use_lvmetad = 0'
+            echo '}'
         fi
     } > /etc/lvm/lvm.conf
     lvmwritten=1
@@ -64,18 +64,18 @@ check_lvm_ver() {
 OLDIFS=$IFS
 IFS=.
 # shellcheck disable=SC2046
-set -- $(lvm version 2>/dev/null)
+set -- $(lvm version 2> /dev/null)
 IFS=$OLDIFS
 maj=${1##*:}
 min=$2
 sub=${3%% *}
-sub=${sub%%\(*};
+sub=${sub%%\(*}
 
 lvm_ignorelockingfailure="--ignorelockingfailure"
 lvm_quirk_args="--ignorelockingfailure --ignoremonitoring"
 
-check_lvm_ver 2 2 57 "$maj" "$min" "$sub" && \
-    lvm_quirk_args="$lvm_quirk_args --poll n"
+check_lvm_ver 2 2 57 "$maj" "$min" "$sub" \
+    && lvm_quirk_args="$lvm_quirk_args --poll n"
 
 if check_lvm_ver 2 2 65 "$maj" "$min" "$sub"; then
     lvm_quirk_args=" --sysinit $extraargs"
@@ -90,7 +90,7 @@ unset extraargs
 
 export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1
 
-if [ -n "$SNAPSHOT" ] ; then
+if [ -n "$SNAPSHOT" ]; then
     # HACK - this should probably be done elsewhere or turned into a function
     # Enable read-write LVM locking
     sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type =  1/' /etc/lvm/lvm.conf
@@ -100,19 +100,19 @@ if [ -n "$SNAPSHOT" ] ; then
     SNAP_LV=${SNAPSHOT##*:}
 
     info "Removing existing LVM snapshot $SNAP_LV"
-    lvm lvremove --force "$SNAP_LV" 2>&1| vinfo
+    lvm lvremove --force "$SNAP_LV" 2>&1 | vinfo
 
     # Determine snapshot size
-    if [ -z "$SNAPSIZE" ] ; then
-        SNAPSIZE=$(lvm lvs --noheadings  --units m --options lv_size "$ORIG_LV")
+    if [ -z "$SNAPSIZE" ]; then
+        SNAPSIZE=$(lvm lvs --noheadings --units m --options lv_size "$ORIG_LV")
         info "No LVM snapshot size provided, using size of $ORIG_LV ($SNAPSIZE)"
     fi
 
     info "Creating LVM snapshot $SNAP_LV ($SNAPSIZE)"
-    lvm lvcreate -s -n "$SNAP_LV" -L "$SNAPSIZE" "$ORIG_LV" 2>&1| vinfo
+    lvm lvcreate -s -n "$SNAP_LV" -L "$SNAPSIZE" "$ORIG_LV" 2>&1 | vinfo
 fi
 
-if [ -n "$LVS" ] ; then
+if [ -n "$LVS" ]; then
     info "Scanning devices $lvmdevs for LVM logical volumes $LVS"
     lvm lvscan $lvm_ignorelockingfailure 2>&1 | vinfo
     for LV in $LVS; do
index 3f866d85520183131cc0604d2fabfd5a98bfe1be..2b25720984b1827cdb01d39364722aa7b45f6bcf 100755 (executable)
@@ -30,12 +30,12 @@ cmdline() {
     for dev in "${!host_fs_types[@]}"; do
         [ -e /sys/block/${dev#/dev/}/dm/name ] || continue
         [ -e /sys/block/${dev#/dev/}/dm/uuid ] || continue
-        uuid=$(</sys/block/${dev#/dev/}/dm/uuid)
+        uuid=$(< /sys/block/${dev#/dev/}/dm/uuid)
         [[ "${uuid#LVM-}" == "$uuid" ]] && continue
-        dev=$(</sys/block/${dev#/dev/}/dm/name)
-        eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2>/dev/null)
+        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
@@ -73,7 +73,7 @@ install() {
         if [[ -f $dracutsysrootdir/etc/lvm/lvmlocal.conf ]]; then
             inst_simple -H /etc/lvm/lvmlocal.conf
         fi
-        eval $(lvm dumpconfig global/system_id_source &>/dev/null)
+        eval $(lvm dumpconfig global/system_id_source &> /dev/null)
         if [ "$system_id_source" == "file" ]; then
             eval $(lvm dumpconfig global/system_id_file)
             if [ -f "$system_id_file" ]; then
@@ -119,26 +119,27 @@ install() {
 
     inst_libdir_file "libdevmapper-event-lvm*.so"
 
-    if [[ $hostonly ]] && find_binary lvs &>/dev/null; then
+    if [[ $hostonly ]] && find_binary lvs &> /dev/null; then
         for dev in "${!host_fs_types[@]}"; do
             [ -e /sys/block/${dev#/dev/}/dm/name ] || continue
-            dev=$(</sys/block/${dev#/dev/}/dm/name)
-            eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2>/dev/null)
+            dev=$(< /sys/block/${dev#/dev/}/dm/name)
+            eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2> /dev/null)
             [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || continue
-            case "$(lvs --noheadings -o segtype ${DM_VG_NAME} 2>/dev/null)" in
-                *thin*|*cache*|*era*)
+            case "$(lvs --noheadings -o segtype ${DM_VG_NAME} 2> /dev/null)" in
+                *thin* | *cache* | *era*)
                     inst_multiple -o thin_dump thin_restore thin_check thin_repair \
-                                  cache_dump cache_restore cache_check cache_repair \
-                                  era_check era_dump era_invalidate era_restore
-                    break;;
+                        cache_dump cache_restore cache_check cache_repair \
+                        era_check era_dump era_invalidate era_restore
+                    break
+                    ;;
             esac
         done
     fi
 
     if ! [[ $hostonly ]]; then
         inst_multiple -o thin_dump thin_restore thin_check thin_repair \
-                      cache_dump cache_restore cache_check cache_repair \
-                      era_check era_dump era_invalidate era_restore
+            cache_dump cache_restore cache_check cache_repair \
+            era_check era_dump era_invalidate era_restore
     fi
 
     dracut_need_initqueue
index 82360503b7af25b226783b4331e5d8c68900f2ab..f7febd764ae8e81fd6aa61dc0c8b5dc32ba91a83 100755 (executable)
@@ -7,7 +7,7 @@ fi
 LV_DEVS="$(getargs rd.lvm.vg -d rd_LVM_VG=) $(getargs rd.lvm.lv -d rd_LVM_LV=)"
 
 if ! getargbool 1 rd.lvm -d -n rd_NO_LVM \
-    || ( [ -z "$LV_DEVS" ] && ! getargbool 0 rd.auto ); then
+    || ([ -z "$LV_DEVS" ] && ! getargbool 0 rd.auto); then
     info "rd.lvm=0: removing LVM activation"
     rm -f -- /etc/udev/rules.d/64-lvm*.rules
 else
@@ -15,4 +15,3 @@ else
         wait_for_dev -n "/dev/$dev"
     done
 fi
-
index 40c82570a852ae688455b971244fae078d63d83c..e72be7999f425a2f6f77297da1681c6d1499de0a 100755 (executable)
@@ -4,11 +4,11 @@ _do_md_shutdown() {
     local ret
     local final=$1
     info "Waiting for mdraid devices to be clean."
-    mdadm -vv --wait-clean --scan| vinfo
+    mdadm -vv --wait-clean --scan | vinfo
     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
@@ -16,7 +16,7 @@ _do_md_shutdown() {
     return $ret
 }
 
-if command -v mdadm >/dev/null; then
+if command -v mdadm > /dev/null; then
     _do_md_shutdown $1
 else
     :
index 51e203c05c2648def6a62b3923f49aaf31996f42..83c021bd40a39155cc793d4df7fa4676ccb7d63a 100755 (executable)
@@ -8,6 +8,6 @@ _do_mdmon_takeover() {
     return $ret
 }
 
-if command -v mdmon >/dev/null; then
+if command -v mdmon > /dev/null; then
     _do_mdmon_takeover $1
 fi
index 007e581bd6d9e3ba93ea84fcbe446d0f60f978ab..4b7ae19dbf1ed7bbbb587fb9c05ce389fc3c6c9b 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 containers=""
 for md in /dev/md[0-9_]*; do
@@ -11,11 +11,11 @@ for md in /dev/md[0-9_]*; do
         containers="$containers $md"
         continue
     fi
-    mdadm -S "$md" >/dev/null 2>&1
+    mdadm -S "$md" > /dev/null 2>&1
 done
 
 for md in $containers; do
-    mdadm -S "$md" >/dev/null 2>&1
+    mdadm -S "$md" > /dev/null 2>&1
 done
 
 unset containers udevinfo
index ee9c8f805718c8d0947632edbbaccb62fe1a2a90..f248c4bb6d0bf49d3891b2dd710350ae0a4e9dcd 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 for md in /dev/md[0-9_]*; do
     [ -b "$md" ] || continue
index 0a7480f79ed94c9eb29af92c26314b20486aaad4..6f166e2aae46b6a5a45ca4ac2b5822e3b3464fdc 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 if getargbool 0 rd.md.waitclean; then
-    type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+    type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
     containers=""
     for md in /dev/md[0-9_]*; do
         [ -b "$md" ] || continue
@@ -12,12 +12,12 @@ if getargbool 0 rd.md.waitclean; then
             continue
         fi
         info "Waiting for $md to become clean"
-        mdadm -W "$md" >/dev/null 2>&1
+        mdadm -W "$md" > /dev/null 2>&1
     done
 
     for md in $containers; do
         info "Waiting for $md to become clean"
-        mdadm -W "$md" >/dev/null 2>&1
+        mdadm -W "$md" > /dev/null 2>&1
     done
 
     unset containers udevinfo
index 71ef8efdb3306010f21f136b1b48d13505ce391b..325835a93d1cb2ae74bd2774722f859104f768aa 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-type getargs >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getargs > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 _md_start() {
     local _udevinfo
@@ -43,10 +43,10 @@ _md_force_run() {
             _UUID=$(
                 /sbin/mdadm -D --export "$_md" \
                     | while read -r line || [ -n "$line" ]; do
-                    str_starts "$line" "MD_UUID=" || continue
-                    printf "%s" "${line#MD_UUID=}"
-                done
-                )
+                        str_starts "$line" "MD_UUID=" || continue
+                        printf "%s" "${line#MD_UUID=}"
+                    done
+            )
 
             [ -z "$_UUID" ] && continue
             _UUID=$(str_replace "$_UUID" ":" "")
index 4f708edffdbd708bc5d76a1dbee38fa22dc56ed7..dc0d96ce1555789fd49c3513d88a0e5e98ed0e72 100755 (executable)
@@ -47,9 +47,9 @@ cmdline() {
         UUID=$(
             /sbin/mdadm --examine --export $dev \
                 | while read line || [ -n "$line" ]; do
-                [[ ${line#MD_UUID=} = $line ]] && continue
-                printf "%s" "${line#MD_UUID=} "
-            done
+                    [[ ${line#MD_UUID=} = $line ]] && continue
+                    printf "%s" "${line#MD_UUID=} "
+                done
         )
 
         [[ -z "$UUID" ]] && continue
@@ -96,10 +96,10 @@ install() {
     prepare_udev_rules 59-persistent-storage-md.rules
 
     # guard against pre-3.0 mdadm versions, that can't handle containers
-    if ! mdadm -Q -e imsm /dev/null >/dev/null 2>&1; then
+    if ! mdadm -Q -e imsm /dev/null > /dev/null 2>&1; then
         inst_hook pre-trigger 30 "$moddir/md-noimsm.sh"
     fi
-    if ! mdadm -Q -e ddf /dev/null >/dev/null 2>&1; then
+    if ! mdadm -Q -e ddf /dev/null > /dev/null 2>&1; then
         inst_hook pre-trigger 30 "$moddir/md-noddf.sh"
     fi
 
index 2cce976963aa8df45112799fa4c54e4299cf5983..55b38f09d1a7ad0eaa9e9fb2ef13631345144a8d 100755 (executable)
@@ -5,7 +5,7 @@ MD_UUID=$(getargs rd.md.uuid -d rd_MD_UUID=)
 MD_UUID=$(str_replace "$MD_UUID" "-" "")
 MD_UUID=$(str_replace "$MD_UUID" ":" "")
 
-if ( ! [ -n "$MD_UUID" ] && ! getargbool 0 rd.auto ) || ! getargbool 1 rd.md -d -n rd_NO_MD; then
+if (! [ -n "$MD_UUID" ] && ! getargbool 0 rd.auto) || ! getargbool 1 rd.md -d -n rd_NO_MD; then
     info "rd.md=0: removing MD RAID activation"
     udevproperty rd_NO_MD=1
 else
@@ -17,11 +17,11 @@ else
                 if [ "${line%%UUID CHECK}" != "$line" ]; then
                     for uuid in $MD_UUID; do
                         printf 'ENV{ID_FS_UUID}=="%s", GOTO="md_uuid_ok"\n' "$(expr substr $uuid 1 8)-$(expr substr $uuid 9 4)-$(expr substr $uuid 13 4)-$(expr substr $uuid 17 4)-$(expr substr $uuid 21 12)"
-                    done;
+                    done
                     printf 'IMPORT{program}="/sbin/mdadm --examine --export $tempnode"\n'
                     for uuid in $MD_UUID; do
                         printf 'ENV{MD_UUID}=="%s", GOTO="md_uuid_ok"\n' "$(expr substr $uuid 1 8):$(expr substr $uuid 9 8):$(expr substr $uuid 17 8):$(expr substr $uuid 25 8)"
-                    done;
+                    done
                     printf 'GOTO="md_end"\n'
                     printf 'LABEL="md_uuid_ok"\n'
                 else
@@ -37,7 +37,6 @@ else
     fi
 fi
 
-
 if [ -e /etc/mdadm.conf ] && getargbool 1 rd.md.conf -d -n rd_NO_MDADMCONF; then
     udevproperty rd_MDADMCONF=1
     rm -f -- $hookdir/pre-pivot/*mdraid-cleanup.sh
@@ -45,7 +44,7 @@ fi
 
 if ! getargbool 1 rd.md.conf -d -n rd_NO_MDADMCONF; then
     rm -f -- /etc/mdadm/mdadm.conf /etc/mdadm.conf
-    ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
+    ln -s $(command -v mdraid-cleanup) $hookdir/pre-pivot/31-mdraid-cleanup.sh 2> /dev/null
 fi
 
 # noiswmd nodmraid for anaconda / rc.sysinit compatibility
index 8380b0a4d7967a03a7c6c56ec6da300dee9a82aa..6054f134d40304311192272447c086be84c14e9b 100755 (executable)
@@ -44,7 +44,7 @@ depends() {
 # called by dracut
 cmdline() {
     for m in scsi_dh_alua scsi_dh_emc scsi_dh_rdac dm_multipath; do
-        if grep -m 1 -q "$m" /proc/modules ; then
+        if grep -m 1 -q "$m" /proc/modules; then
             printf 'rd.driver.pre=%s ' "$m"
         fi
     done
@@ -79,13 +79,13 @@ install() {
         }
     }
 
-    inst_multiple -o  \
+    inst_multiple -o \
         dmsetup \
         kpartx \
         mpath_wait \
         mpathconf \
         mpathpersist \
-        multipath  \
+        multipath \
         multipathd \
         xdrgetprio \
         xdrgetuid \
@@ -104,7 +104,7 @@ install() {
     inst_libdir_file "libmultipath*" "multipath/*"
     inst_libdir_file 'libgcc_s.so*'
 
-    if [[ $hostonly_cmdline ]] ; then
+    if [[ $hostonly_cmdline ]]; then
         local _conf=$(cmdline)
         [[ $_conf ]] && echo "$_conf" >> "${initdir}/etc/cmdline.d/90multipath.conf"
     fi
@@ -116,15 +116,14 @@ install() {
         $SYSTEMCTL -q --root "$initdir" enable multipathd.service
     else
         inst_hook pre-trigger 02 "$moddir/multipathd.sh"
-        inst_hook cleanup   02 "$moddir/multipathd-stop.sh"
+        inst_hook cleanup 02 "$moddir/multipathd-stop.sh"
     fi
 
-    inst_hook cleanup   80 "$moddir/multipathd-needshutdown.sh"
-    inst_hook shutdown  20 "$moddir/multipath-shutdown.sh"
+    inst_hook cleanup 80 "$moddir/multipathd-needshutdown.sh"
+    inst_hook shutdown 20 "$moddir/multipath-shutdown.sh"
 
     inst_rules 40-multipath.rules 56-multipath.rules \
-       62-multipath.rules 65-multipath.rules \
-       66-kpartx.rules 67-kpartx-compat.rules \
-       11-dm-mpath.rules 11-dm-parts.rules
+        62-multipath.rules 65-multipath.rules \
+        66-kpartx.rules 67-kpartx-compat.rules \
+        11-dm-mpath.rules 11-dm-parts.rules
 }
-
index 8f9ea99cd2f08cc6c31cee1c6d819a7a571b8917..3c9e96fc8a66190bb451e87f40efd10d14d2fed1 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 for i in $(multipath -l -v1); do
-    if ! dmsetup table $i | sed -n '/.*queue_if_no_path.*/q1' ; then
+    if ! dmsetup table $i | sed -n '/.*queue_if_no_path.*/q1'; then
         dmsetup message $i 0 fail_if_no_path
     fi
 done
index ee9b69b4f3c2075250354b367ef0d40cf21e4857..4f5c76c50c064cdfedf95b173a0e644ea3cf5116 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 for i in $(multipath -l -v1); do
-    if $(dmsetup table $i | sed -n '/.*queue_if_no_path.*/q1') ; then
+    if $(dmsetup table $i | sed -n '/.*queue_if_no_path.*/q1'); then
         need_shutdown
         break
     fi
index 57a072823283c02c44e1521a94b25eeb778c42d5..31d573bf7c3652a8ccb946cb8e9b9d2ba63eb25e 100755 (executable)
@@ -2,11 +2,10 @@
 
 if [ -e /etc/multipath.conf ]; then
     HARD=""
-    while pidof multipathd >/dev/null 2>&1; do
+    while pidof multipathd > /dev/null 2>&1; do
         for pid in $(pidof multipathd); do
-            kill $HARD $pid >/dev/null 2>&1
+            kill $HARD $pid > /dev/null 2>&1
         done
         HARD="-9"
     done
 fi
-
index b0183ffeb663133c4c368ffc5bd0c70b09e9fee4..385a95fb18f6da3cbdf471f6915e135ed9173052 100755 (executable)
@@ -10,6 +10,5 @@ if getargbool 1 rd.multipath -d -n rd_NO_MULTIPATH && [ -e /etc/multipath.conf ]
     multipathd -B || multipathd
     need_shutdown
 else
-    rm -- /etc/udev/rules.d/??-multipath.rules 2>/dev/null
+    rm -- /etc/udev/rules.d/??-multipath.rules 2> /dev/null
 fi
-
index 043f5448b1805317964f694f4ba1a18c84a0d24d..b24cacc6c12d9495d23040a15f1876968d440529 100755 (executable)
@@ -5,8 +5,8 @@ check() {
     if [[ ! $hostonly ]]; then
         return 0
     fi
-    [[ $DRACUT_KERNEL_MODALIASES && -f "$DRACUT_KERNEL_MODALIASES" ]] && \
-        grep -q libnvdimm "$DRACUT_KERNEL_MODALIASES" && return 0
+    [[ $DRACUT_KERNEL_MODALIASES && -f "$DRACUT_KERNEL_MODALIASES" ]] \
+        && grep -q libnvdimm "$DRACUT_KERNEL_MODALIASES" && return 0
     return 255
 }
 
index 1e548f052bc5ff08f97b22b044d4944a06844b87..f690967d3958a67ab1b5caf3b2c16130b1de800e 100644 (file)
@@ -13,13 +13,13 @@ load_windfarm() {
     # this way if the modules are for some reason missing, it will
     # still exit successfully and not affect the boot process
     case "$pm_model" in
-        PowerMac3,6)             modprobe -b -q therm_windtunnel ;;
-        PowerMac7,2|PowerMac7,3) modprobe -b -q windfarm_pm72    ;;
-        PowerMac8,1|PowerMac8,2) modprobe -b -q windfarm_pm81    ;;
-        PowerMac9,1)             modprobe -b -q windfarm_pm91    ;;
-        PowerMac11,2)            modprobe -b -q windfarm_pm112   ;;
-        PowerMac12,1)            modprobe -b -q windfarm_pm121   ;;
-        RackMac3,1)              modprobe -b -q windfarm_rm31    ;;
+        PowerMac3,6) modprobe -b -q therm_windtunnel ;;
+        PowerMac7,2 | PowerMac7,3) modprobe -b -q windfarm_pm72 ;;
+        PowerMac8,1 | PowerMac8,2) modprobe -b -q windfarm_pm81 ;;
+        PowerMac9,1) modprobe -b -q windfarm_pm91 ;;
+        PowerMac11,2) modprobe -b -q windfarm_pm112 ;;
+        PowerMac12,1) modprobe -b -q windfarm_pm121 ;;
+        RackMac3,1) modprobe -b -q windfarm_rm31 ;;
         *) ;;
     esac
 
index d457119f2844e5472d6a91e0f97c0fc70ec3b02b..ff15b4cb20b3d20a82d218a05f87785898326f85 100644 (file)
@@ -52,12 +52,12 @@ installkernel() {
         else
             # guess model specific module, then install the rest
             case "$(pmac_model)" in
-                PowerMac7,2|PowerMac7,3) instmods windfarm_pm72  ;;
-                PowerMac8,1|PowerMac8,2) instmods windfarm_pm81  ;;
-                PowerMac9,1)             instmods windfarm_pm91  ;;
-                PowerMac11,2)            instmods windfarm_pm112 ;;
-                PowerMac12,1)            instmods windfarm_pm121 ;;
-                RackMac3,1)              instmods windfarm_rm31  ;;
+                PowerMac7,2 | PowerMac7,3) instmods windfarm_pm72 ;;
+                PowerMac8,1 | PowerMac8,2) instmods windfarm_pm81 ;;
+                PowerMac9,1) instmods windfarm_pm91 ;;
+                PowerMac11,2) instmods windfarm_pm112 ;;
+                PowerMac12,1) instmods windfarm_pm121 ;;
+                RackMac3,1) instmods windfarm_rm31 ;;
                 # no match, so skip installation of the rest
                 *) return 1 ;;
             esac
@@ -77,6 +77,6 @@ installkernel() {
 
 # called by dracut
 install() {
-    # this will attempt to load the appropriate modules 
+    # this will attempt to load the appropriate modules
     inst_hook pre-udev 99 "$moddir/load-thermal.sh"
 }
index 1a808db2255050ba5f219e719ce88acbff8ea7a2..3f14ccff2157acb0e71ad408a484f676b4d90f24 100755 (executable)
@@ -14,9 +14,9 @@ check() {
 installkernel() {
     # qemu specific modules
     hostonly='' instmods \
-            ata_piix ata_generic pata_acpi cdrom sr_mod ahci \
-            virtio_blk virtio virtio_ring virtio_pci \
-            virtio_scsi virtio_console virtio_rng \
-            spapr-vscsi \
-            qemu_fw_cfg
+        ata_piix ata_generic pata_acpi cdrom sr_mod ahci \
+        virtio_blk virtio virtio_ring virtio_pci \
+        virtio_scsi virtio_console virtio_rng \
+        spapr-vscsi \
+        qemu_fw_cfg
 }
index c051b4302a23df2792890b0caa056fe0265632ce..e66feb7d3c831cd052ff9b430d44c0e5df6cb5cb 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-command -v ask_for_password >/dev/null || . /lib/dracut-crypt-lib.sh
+command -v ask_for_password > /dev/null || . /lib/dracut-crypt-lib.sh
 
 # gpg_decrypt mnt_point keypath keydev device
 #
@@ -33,7 +33,7 @@ gpg_decrypt() {
     local gpgMinorVersion="$(gpg --version | sed -n 1p | sed -n -r -e 's|.* [0-9]*\.([0-9]*).*|\1|p')"
 
     if [ "${gpgMajorVersion}" -ge 2 ] && [ "${gpgMinorVersion}" -ge 1 ] \
-            && [ -f /root/crypt-public-key.gpg ] && getargbool 1 rd.luks.smartcard ; then
+        && [ -f /root/crypt-public-key.gpg ] && getargbool 1 rd.luks.smartcard; then
         useSmartcard="1"
         echo "allow-loopback-pinentry" >> "$gpghome/gpg-agent.conf"
         GNUPGHOME="$gpghome" gpg-agent --quiet --daemon
@@ -43,7 +43,7 @@ gpg_decrypt() {
         if [ -n "${smartcardSerialNumber}" ]; then
             inputPrompt="PIN (OpenPGP card ${smartcardSerialNumber})"
         fi
-        GNUPGHOME="$gpghome" gpg-connect-agent 1>/dev/null learn /bye
+        GNUPGHOME="$gpghome" gpg-connect-agent 1> /dev/null learn /bye
         opts="$opts --pinentry-mode=loopback"
     fi
 
@@ -54,7 +54,7 @@ gpg_decrypt() {
 
     # Clean up the smartcard gpg-agent
     if [ "${useSmartcard}" = "1" ]; then
-        GNUPGHOME="$gpghome" gpg-connect-agent 1>/dev/null killagent /bye
+        GNUPGHOME="$gpghome" gpg-connect-agent 1> /dev/null killagent /bye
     fi
 
     rm -rf -- "$gpghome"
index 794ff2380180a0a4fb89356dc5bbf9d531efa3aa..78628c394158fc24a9286ba6edf18bbbc97a335d 100755 (executable)
@@ -42,11 +42,11 @@ 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 ]] && \
-       require_binaries gpg-agent &&
-       require_binaries gpg-connect-agent &&
-       require_binaries /usr/libexec/scdaemon &&
-       ($DRACUT_LDD "$dracutsysrootdir"/usr/libexec/scdaemon | grep libusb > /dev/null); then
+    if [[ "${gpgMajor}" -gt 2 || "${gpgMajor}" -eq 2 && "${gpgMinor}" -ge 1 ]] \
+        && require_binaries gpg-agent \
+        && require_binaries gpg-connect-agent \
+        && require_binaries /usr/libexec/scdaemon \
+        && ($DRACUT_LDD "$dracutsysrootdir"/usr/libexec/scdaemon | grep libusb > /dev/null); then
         return 0
     else
         return 1
index 8bfc39e09b362279b83c0dd1eb889f30da915c3a..07258740bcdc3b7cf4750a8990995037a9c51b28 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-command -v ask_for_password >/dev/null || . /lib/dracut-crypt-lib.sh
+command -v ask_for_password > /dev/null || . /lib/dracut-crypt-lib.sh
 
 # loop_decrypt mnt_point keypath keydev device
 #
index b7546bef06ede4c722f1ede385b3b79bcd8b44a2..487cd16274d70b94cf35e57f86ffaf6a91dd1fca 100755 (executable)
@@ -3,7 +3,7 @@
 DEV="$1"
 MNT=/boot/zipl
 
-if [ -z "$DEV" ] ; then
+if [ -z "$DEV" ]; then
     echo "No IPL device given"
     > /tmp/install.zipl.cmdline-done
     exit 1
@@ -12,26 +12,26 @@ fi
 [ -d ${MNT} ] || mkdir -p ${MNT}
 
 mount -o ro ${DEV} ${MNT}
-if [ "$?" != "0" ] ; then
+if [ "$?" != "0" ]; then
     echo "Failed to mount ${MNT}"
     > /tmp/install.zipl.cmdline-done
     exit 1
 fi
 
-if [ -f ${MNT}/dracut-cmdline.conf ] ; then
+if [ -f ${MNT}/dracut-cmdline.conf ]; then
     cp ${MNT}/dracut-cmdline.conf /etc/cmdline.d/99zipl.conf
 fi
 
-if [ -f ${MNT}/active_devices.txt ] ; then
-    while read dev etc ; do
-        [ "$dev" = "#" -o "$dev" = "" ] && continue;
+if [ -f ${MNT}/active_devices.txt ]; then
+    while read dev etc; do
+        [ "$dev" = "#" -o "$dev" = "" ] && continue
         cio_ignore -r $dev
     done < ${MNT}/active_devices.txt
 fi
 
 umount ${MNT}
 
-if [ -f /etc/cmdline.d/99zipl.conf ] ; then
+if [ -f /etc/cmdline.d/99zipl.conf ]; then
     systemctl restart dracut-cmdline.service
     systemctl restart systemd-udev-trigger.service
 fi
index f8e912e5ae3d5bc7b2bbef72aac306acb7df568d..90e9aea58f4c75078a23543ab442483829ef5a12 100755 (executable)
@@ -23,9 +23,9 @@ installkernel() {
     local _boot_zipl
 
     _boot_zipl=$(sed -n -e '/^[[:space:]]*#/d' -e 's/\(.*\)\w*\/boot\/zipl.*/\1/p' /etc/fstab)
-    if [ -n "$_boot_zipl" ] ; then
+    if [ -n "$_boot_zipl" ]; then
         eval $(blkid -s TYPE -o udev ${_boot_zipl})
-        if [ -n "$ID_FS_TYPE" ] ; then
+        if [ -n "$ID_FS_TYPE" ]; then
             case "$ID_FS_TYPE" in
                 ext?)
                     ID_FS_TYPE=ext4
@@ -41,7 +41,7 @@ cmdline() {
     local _boot_zipl
 
     _boot_zipl=$(sed -n -e '/^[[:space:]]*#/d' -e 's/\(.*\)\w*\/boot\/zipl.*/\1/p' /etc/fstab)
-    if [ -n "$_boot_zipl" ] ; then
+    if [ -n "$_boot_zipl" ]; then
         echo "rd.zipl=${_boot_zipl}"
     fi
 }
@@ -52,7 +52,7 @@ install() {
 
     inst_hook cmdline 91 "$moddir/parse-zipl.sh"
     inst_script "${moddir}/install_zipl_cmdline.sh" /sbin/install_zipl_cmdline.sh
-    if [[ $hostonly_cmdline == "yes" ]] ; then
+    if [[ $hostonly_cmdline == "yes" ]]; then
         local _zipl=$(cmdline)
 
         [[ $_zipl ]] && printf "%s\n" "$_zipl" > "${initdir}/etc/cmdline.d/91zipl.conf"
index a2be9f5107ff7146ef01833a56c2ab9c35abadc9..8963a395e89e053bd01b778435e2a2fe4b54c8d4 100755 (executable)
@@ -4,46 +4,46 @@
 
 zipl_arg=$(getarg rd.zipl)
 
-if [ -n "$zipl_arg" ] ; then
+if [ -n "$zipl_arg" ]; then
     case "$zipl_arg" in
-    LABEL=*) \
-        zipl_env="ENV{ID_FS_LABEL}"
-        zipl_val=${zipl_arg#LABEL=}
-        zipl_arg="$(label_uuid_to_dev "${zipl_val}")"
-        ;;
-    UUID=*) \
-        zipl_env="ENV{ID_FS_UUID}"
-        zipl_val=${zipl_arg#UUID=}
-        zipl_arg="$(label_uuid_to_dev "${zipl_val}")"
-        ;;
-    PARTLABEL=*) \
-        zipl_env="ENV{ID_FS_PARTLABEL}"
-        zipl_val=${zipl_arg#PARTLABEL=}
-        zipl_arg="$(label_uuid_to_dev "${zipl_val}")"
-        ;;
-    PARTUUID=*) \
-        zipl_env="ENV{ID_FS_PARTUUID}"
-        zipl_val=${zipl_arg#PARTUUID=}
-        zipl_arg="$(label_uuid_to_dev "${zipl_val}")"
-        ;;
-    /dev/mapper/*) \
-        zipl_env="ENV{DM_NAME}"
-        zipl_val=${zipl_arg#/dev/mapper/}
-        ;;
-    /dev/disk/by-*) \
-        zipl_env="SYMLINK"
-        zipl_val=${zipl_arg#/dev/}
-        ;;
-    /dev/*) \
-        zipl_env="KERNEL"
-        zipl_val=${zipl_arg}
-        ;;
+        LABEL=*)
+            zipl_env="ENV{ID_FS_LABEL}"
+            zipl_val=${zipl_arg#LABEL=}
+            zipl_arg="$(label_uuid_to_dev "${zipl_val}")"
+            ;;
+        UUID=*)
+            zipl_env="ENV{ID_FS_UUID}"
+            zipl_val=${zipl_arg#UUID=}
+            zipl_arg="$(label_uuid_to_dev "${zipl_val}")"
+            ;;
+        PARTLABEL=*)
+            zipl_env="ENV{ID_FS_PARTLABEL}"
+            zipl_val=${zipl_arg#PARTLABEL=}
+            zipl_arg="$(label_uuid_to_dev "${zipl_val}")"
+            ;;
+        PARTUUID=*)
+            zipl_env="ENV{ID_FS_PARTUUID}"
+            zipl_val=${zipl_arg#PARTUUID=}
+            zipl_arg="$(label_uuid_to_dev "${zipl_val}")"
+            ;;
+        /dev/mapper/*)
+            zipl_env="ENV{DM_NAME}"
+            zipl_val=${zipl_arg#/dev/mapper/}
+            ;;
+        /dev/disk/by-*)
+            zipl_env="SYMLINK"
+            zipl_val=${zipl_arg#/dev/}
+            ;;
+        /dev/*)
+            zipl_env="KERNEL"
+            zipl_val=${zipl_arg}
+            ;;
     esac
-    if [ "$zipl_env" ] ; then
+    if [ "$zipl_env" ]; then
         {
             printf 'ACTION=="add|change", SUBSYSTEM=="block", %s=="%s", ENV{SYSTEMD_READY}!="0", RUN+="/sbin/initqueue --settled --onetime --unique --name install_zipl_cmdline /sbin/install_zipl_cmdline.sh %s"\n' \
                 ${zipl_env} ${zipl_val} ${zipl_arg}
-            echo "[ -f /tmp/install.zipl.cmdline-done ]" >$hookdir/initqueue/finished/wait-zipl-conf.sh
+            echo "[ -f /tmp/install.zipl.cmdline-done ]" > $hookdir/initqueue/finished/wait-zipl-conf.sh
         } >> /etc/udev/rules.d/99zipl-conf.rules
         cat /etc/udev/rules.d/99zipl-conf.rules
     fi
index ab51106c85d2d1f4d93bde22bf3e01a8ac27f5d3..304fb4dc1c26e5c668b5734f04a8c3f3e6b3a2fa 100755 (executable)
@@ -5,30 +5,31 @@
 # CIFSROOT is something like: cifs://[<username>[:<password>]]@<host>/<path>
 # NETIF is used to get information from DHCP options, if needed.
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 cifs_to_var() {
-    local cifsuser; local cifspass
+    local cifsuser
+    local cifspass
     # Check required arguments
     server=${1##cifs://}
     cifsuser=${server%@*}
     cifspass=${cifsuser#*:}
     if [ "$cifspass" != "$cifsuser" ]; then
-       cifsuser=${cifsuser%:*}
+        cifsuser=${cifsuser%:*}
     else
-       cifspass=$(getarg cifspass)
+        cifspass=$(getarg cifspass)
     fi
     if [ "$cifsuser" != "$server" ]; then
-       server="${server#*@}"
+        server="${server#*@}"
     else
-       cifsuser=$(getarg cifsuser)
+        cifsuser=$(getarg cifsuser)
     fi
 
     path=${server#*/}
     server=${server%/*}
 
     if [ ! "$cifsuser" -o ! "$cifspass" ]; then
-       die "For CIFS support you need to specify a cifsuser and cifspass either in the cifsuser and cifspass commandline parameters or in the root= CIFS URL."
+        die "For CIFS support you need to specify a cifsuser and cifspass either in the cifsuser and cifspass commandline parameters or in the root= CIFS URL."
     fi
     options="user=$cifsuser,pass=$cifspass,$(getarg rootflags=)"
 }
index 351f8b8dfaae65c98fada5a52958a0dbdff06feb..2fec8387d041756647939276f731fcaae726f5dd 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 . /lib/cifs-lib.sh
 
 [ "$#" = 3 ] || exit 1
@@ -14,7 +14,7 @@ NEWROOT="$3"
 cifs_to_var "$root"
 
 # shellcheck disable=SC2154
-mount.cifs "//$server/$path" "$NEWROOT" -o "$options" && { [ -e /dev/root ] || ln -s null /dev/root ; }
+mount.cifs "//$server/$path" "$NEWROOT" -o "$options" && { [ -e /dev/root ] || ln -s null /dev/root; }
 
 # inject new exit_if_exists
 # shellcheck disable=SC2016
index dbaf07703fc967f5df2c2201f8012c35b2af91d0..41273a5f01ecfce270bd39140325739bc0e2093d 100755 (executable)
@@ -41,7 +41,7 @@ install() {
     inst_libdir_file 'libcap-ng.so*'
 
     _nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' "$dracutsysrootdir"/etc/nsswitch.conf \
-        |  tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
+        | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
     _nsslibs=${_nsslibs#|}
     _nsslibs=${_nsslibs%|}
 
index 977255785efead329f04f8b2a042ed43a6d9cd48..5315e45c8a266fa4dce4f878ddd1f9ebd38d29fa 100755 (executable)
@@ -9,7 +9,7 @@
 # respectively.
 #
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 . /lib/cifs-lib.sh
 
 # This script is sourced, so root should be set. But let's be paranoid
@@ -23,8 +23,8 @@ if [ -z "$netroot" ]; then
 fi
 
 # Root takes precedence over netroot
-if [ "${root%%:*}" = "cifs" ] ; then
-    if [ -n "$netroot" ] ; then
+if [ "${root%%:*}" = "cifs" ]; then
+    if [ -n "$netroot" ]; then
         warn "root takes precedence over netroot. Ignoring netroot"
     fi
     netroot=$root
@@ -38,9 +38,9 @@ fi
 cifs_to_var $netroot
 
 # If we don't have a server, we need dhcp
-if [ -z "$server" ] ; then
+if [ -z "$server" ]; then
     DHCPORSERVER="1"
-fi;
+fi
 
 # Done, all good!
 rootok=1
index c71c8a08d96b2b082a5827fefbf7ff7e8a405e9c..180da1406c37748e45ad707b38f5b98b200a1755 100755 (executable)
@@ -19,10 +19,9 @@ install() {
     inst_hook cmdline 30 "$moddir/parse-dasd.sh"
     inst_multiple dasdinfo dasdconf.sh normalize_dasd_arg
     conf=/etc/dasd.conf
-    if [[ $hostonly && -f $conf ]] ; then
+    if [[ $hostonly && -f $conf ]]; then
         inst -H $conf
     fi
     inst_rules 56-dasd.rules
     inst_rules 59-dasd.rules
 }
-
index cf0d858ca73e727a0cba4505e49d8d5f047692f6..c59dd3acee2f231039a7000d5d1a65958a33d4ff 100755 (executable)
@@ -25,4 +25,3 @@ install() {
     inst_multiple grep sed seq
     inst_multiple -o dasd_cio_free
 }
-
index b4c01a3200ef94fc1f7d127a067d3cb9698ea267..2b86d454349cbcabf501b5f10724cdc938105574 100755 (executable)
@@ -13,6 +13,6 @@ if [ -x /sbin/dasd_cio_free -a -n "$mod_args" ]; then
 fi
 
 unset dasd_arg
-if [ -x /sbin/dasd_cio_free ] ; then
+if [ -x /sbin/dasd_cio_free ]; then
     dasd_cio_free
 fi
index a9ab7fc1486136abda1be998baf23d31dafa92c8..d599b88d4a36bc7396603ea73e1e048af49c39b0 100755 (executable)
@@ -4,7 +4,10 @@
 cmdline() {
     is_dasd() {
         local _dev=$1
-        local _devpath=$(cd -P /sys/dev/block/$_dev ; echo $PWD)
+        local _devpath=$(
+            cd -P /sys/dev/block/$_dev
+            echo $PWD
+        )
 
         [ "${_devpath#*/dasd}" == "$_devpath" ] && return 1
         _ccw="${_devpath%%/block/*}"
@@ -25,11 +28,12 @@ check() {
     require_binaries /usr/lib/udev/collect || return 1
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        for bdev in /sys/block/* ; do
+        for bdev in /sys/block/*; do
             case "${bdev##*/}" in
                 dasd*)
-                    found=$(($found+1));
-                    break;
+                    found=$(($found + 1))
+                    break
+                    ;;
             esac
         done
         [ $found -eq 0 ] && return 255
@@ -47,11 +51,11 @@ depends() {
 install() {
     inst_multiple /usr/lib/udev/collect
     inst_hook cmdline 30 "$moddir/parse-dasd.sh"
-    if [[ $hostonly_cmdline == "yes" ]] ; then
+    if [[ $hostonly_cmdline == "yes" ]]; then
         local _dasd=$(cmdline)
         [[ $_dasd ]] && printf "%s\n" "$_dasd" >> "${initdir}/etc/cmdline.d/95dasd.conf"
     fi
-    if [[ $hostonly ]] ; then
+    if [[ $hostonly ]]; then
         inst_rules_wildcard 51-dasd-*.rules
         inst_rules_wildcard 41-s390x-dasd-*.rules
         mark_hostonly /etc/udev/rules.d/51-dasd-*.rules
index 7e5e00842dede07eaab0fc616fde7023edfd6ecf..1d89942530776a86f3d7e97f86408c46021f14f3 100755 (executable)
@@ -5,45 +5,45 @@ create_udev_rule() {
     local _drv _cu_type _dev_type
     local _rule=/etc/udev/rules.d/51-dasd-${ccw}.rules
 
-    if [ -x /sbin/cio_ignore ] && cio_ignore -i $ccw > /dev/null ; then
+    if [ -x /sbin/cio_ignore ] && cio_ignore -i $ccw > /dev/null; then
         cio_ignore -r $ccw
     fi
 
-    if [ -e /sys/bus/ccw/devices/${ccw} ] ; then
+    if [ -e /sys/bus/ccw/devices/${ccw} ]; then
         read _cu_type < /sys/bus/ccw/devices/${ccw}/cutype
         read _dev_type < /sys/bus/ccw/devices/${ccw}/devtype
     fi
     case "$_cu_type" in
-    3990/*|2105/*|2107/*|1750/*|9343/*)
+        3990/* | 2105/* | 2107/* | 1750/* | 9343/*)
             _drv=dasd-eckd
             ;;
-    6310/*)
+        6310/*)
             _drv=dasd-fba
             ;;
-    3880/*)
-        case "$_dev_type" in
-            3380/*)
-                _drv=dasd_eckd
-                ;;
-            3370/*)
-                _drv=dasd-fba
-                ;;
-        esac
-        ;;
+        3880/*)
+            case "$_dev_type" in
+                3380/*)
+                    _drv=dasd_eckd
+                    ;;
+                3370/*)
+                    _drv=dasd-fba
+                    ;;
+            esac
+            ;;
     esac
     [ -z "${_drv}" ] && return 0
 
     [ -e ${_rule} ] && return 0
 
-    cat > $_rule <<EOF
+    cat > $_rule << EOF
 ACTION=="add", SUBSYSTEM=="ccw", KERNEL=="$ccw", IMPORT{program}="collect $ccw %k ${ccw} $_drv"
 ACTION=="add", SUBSYSTEM=="drivers", KERNEL=="$_drv", IMPORT{program}="collect $ccw %k ${ccw} $_drv"
 ACTION=="add", ENV{COLLECT_$ccw}=="0", ATTR{[ccw/$ccw]online}="1"
 EOF
 }
 
-if [[ -f /sys/firmware/ipl/ipl_type &&
-            $(</sys/firmware/ipl/ipl_type) = "ccw" ]] ; then
+if [[ -f /sys/firmware/ipl/ipl_type && \
+    $(< /sys/firmware/ipl/ipl_type) = "ccw" ]]; then
     (
         _ccw=$(cat /sys/firmware/ipl/device)
 
@@ -58,7 +58,7 @@ for dasd_arg in $(getargs root=) $(getargs resume=); do
                 ccw_arg=${dasd_arg##*/}
                 ;;
         esac
-        if [ -n "$ccw_arg" ] ; then
+        if [ -n "$ccw_arg" ]; then
             OLDIFS="$IFS"
             IFS="-"
             set -- $ccw_arg
@@ -76,7 +76,7 @@ for dasd_arg in $(getargs rd.dasd=); do
         IFS="$OLDIFS"
         while (($# > 0)); do
             case $1 in
-                autodetect|probeonly)
+                autodetect | probeonly)
                     shift
                     ;;
                 *-*)
@@ -90,13 +90,13 @@ for dasd_arg in $(getargs rd.dasd=); do
                     end=${1##.}
                     shift
                     IFS="$OLDIFS"
-                    for dev in $(seq $(( 16#$start )) $(( 16#$end )) ) ; do
+                    for dev in $(seq $((16#$start)) $((16#$end))); do
                         create_udev_rule "$(printf "%s.%04x" "$prefix" "$dev")"
                     done
                     ;;
                 *)
                     dev=${1%(ro)}
-                    if [ "$dev" != "$1" ] ; then
+                    if [ "$dev" != "$1" ]; then
                         ro=1
                     fi
                     OLDIFS="$IFS"
@@ -108,7 +108,7 @@ for dasd_arg in $(getargs rd.dasd=); do
                     shift
                     chan=$1
                     IFS="$OLDIFS"
-                    create_udev_rule "$(printf "%01x.%01x.%04x" $(( 16#$sid )) $(( 16#$ssid )) $(( 16#$chan )) )"
+                    create_udev_rule "$(printf "%01x.%01x.%04x" $((16#$sid)) $((16#$ssid)) $((16#$chan)))"
                     shift
                     ;;
             esac
index bbd045021922bb77521ef83d22182383e066f913..ffbb57ce502404e93bcff0e26e46b76cfd85ecf5 100755 (executable)
@@ -12,7 +12,7 @@ check() {
 # called by dracut
 installkernel() {
     if [[ $hostonly ]]; then
-        for dev in /sys/devices/dcssblk/*/block/dcssblk* ; do
+        for dev in /sys/devices/dcssblk/*/block/dcssblk*; do
             [[ -e $dev ]] || continue
             hostonly='' instmods dcssblk
             return $?
index 27ac1d8d416417afd0a52108acfc1912a1969c19..dddd2361656c664622b4d8fc42af4285cbe0d47d 100755 (executable)
@@ -2,7 +2,7 @@
 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 dcssblk_arg=$(getarg rd.dcssblk=)
-if [ $? = 0 ];then
-       info "Loading dcssblk segments=$dcssblk_arg"
-       modprobe dcssblk segments=$dcssblk_arg
+if [ $? = 0 ]; then
+    info "Loading dcssblk segments=$dcssblk_arg"
+    modprobe dcssblk segments=$dcssblk_arg
 fi
index c8487e49342ed869656d120f0515f65f3e01a204..2d6c59820a8b2ef6dda538b0a0da909dfce3f2fb 100755 (executable)
@@ -14,10 +14,9 @@ depends() {
 # called by dracut
 install() {
     inst_multiple -o ls ps grep more cat rm strace free showmount df du lsblk \
-                  ping netstat rpcinfo vi scp ping6 ssh find \
-                  tcpdump cp dd less hostname mkdir systemd-analyze \
-                  fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.f2fs fsck.vfat e2fsck
+        ping netstat rpcinfo vi scp ping6 ssh find \
+        tcpdump cp dd less hostname mkdir systemd-analyze \
+        fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.f2fs fsck.vfat e2fsck
 
-    grep '^tcpdump:' "$dracutsysrootdir"/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
+    grep '^tcpdump:' "$dracutsysrootdir"/etc/passwd 2> /dev/null >> "$initdir/etc/passwd"
 }
-
index 684f53a2063ccb760ca3b58bd6863aaee8ed1d46..942d85dd2553d6c767d7c4c1403e5bb7153108ca 100755 (executable)
@@ -1,16 +1,15 @@
 #!/bin/bash
 
-command -v getarg >/dev/null          || . /lib/dracut-lib.sh
-command -v get_fcoe_boot_mac >/dev/null || . /lib/uefi-lib.sh
-command -v set_ifname >/dev/null || . /lib/net-lib.sh
+command -v getarg > /dev/null || . /lib/dracut-lib.sh
+command -v get_fcoe_boot_mac > /dev/null || . /lib/uefi-lib.sh
+command -v set_ifname > /dev/null || . /lib/net-lib.sh
 
-print_fcoe_uefi_conf()
-{
+print_fcoe_uefi_conf() {
     local mac dev vlan
     mac=$(get_fcoe_boot_mac "$1")
     [ -z "$mac" ] && return 1
     dev=$(set_ifname fcoe $mac)
-    vlan=$(get_fcoe_boot_vlan  "$1")
+    vlan=$(get_fcoe_boot_vlan "$1")
     if [ "$vlan" -ne "0" ]; then
         case "$vlan" in
             [0-9]*)
index 1e002d357ba4bd4a7c84dac74cc206d5ba1813e1..1ede0a058b07b81506dc3713c55e25656c557627 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
@@ -25,26 +25,26 @@ check_edd || exit 1
 for disk in /sys/firmware/edd/int13_*; do
     [ -d "$disk" ] || continue
     if [ -e "${disk}/pci_dev/driver" ]; then
-           driver=$(readlink "${disk}/pci_dev/driver")
-           driver=${driver##*/}
+        driver=$(readlink "${disk}/pci_dev/driver")
+        driver=${driver##*/}
     fi
     # i40e uses dev_port 1 for a virtual fcoe function
     if [ "${driver}" = "i40e" ]; then
-           dev_port=1
+        dev_port=1
     fi
     for nic in "${disk}"/pci_dev/net/*; do
         [ -d "$nic" ] || continue
-       if [ -n "${dev_port}" -a -e "${nic}/dev_port" ]; then
-               if [ "$(cat ${nic}/dev_port)" -ne "${dev_port}" ]; then
-                       continue
-               fi
-       fi
+        if [ -n "${dev_port}" -a -e "${nic}/dev_port" ]; then
+            if [ "$(cat ${nic}/dev_port)" -ne "${dev_port}" ]; then
+                continue
+            fi
+        fi
         if [ -e ${nic}/address ]; then
-           fcoe_interface=${nic##*/}
-           if ! [ -e "/tmp/.fcoe-$fcoe_interface" ]; then
-               /sbin/fcoe-up "$fcoe_interface" "$dcb"
-               > "/tmp/.fcoe-$fcoe_interface"
-           fi
+            fcoe_interface=${nic##*/}
+            if ! [ -e "/tmp/.fcoe-$fcoe_interface" ]; then
+                /sbin/fcoe-up "$fcoe_interface" "$dcb"
+                > "/tmp/.fcoe-$fcoe_interface"
+            fi
         fi
     done
 done
index 031d2a0fab2489d14b27187320a70c1626965c36..3d9f47ae7b835a5f2e098cb579e07a12068d7f54 100755 (executable)
@@ -6,7 +6,7 @@
 
 # Write udev rules
 {
-    if [ -n "$fcoe_mac" ] ; then
+    if [ -n "$fcoe_mac" ]; then
         printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/initqueue --onetime --unique --name fcoe-up-$name /sbin/fcoe-up $name %s %s"\n' "$fcoe_mac" "$fcoe_dcb" "$fcoe_mode"
         printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/initqueue --onetime --timeout --unique --name fcoe-timeout-$name /sbin/fcoe-up $name %s %s"\n' "$fcoe_mac" "$fcoe_dcb" "$fcoe_mode"
     else
index 570cd848d2081feeff6381ee6a8f7ff6cd45c599..4b78cd2ef69fa0dcb3dd5ebddafb5271a475537c 100755 (executable)
@@ -7,8 +7,8 @@
 # future use.
 
 PATH=/usr/sbin:/usr/bin:/sbin:/bin
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
-type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
+type ip_to_var > /dev/null 2>&1 || . /lib/net-lib.sh
 
 # Huh? Missing arguments ??
 [ -z "$1" -o -z "$2" ] && exit 1
@@ -20,7 +20,7 @@ vlan="yes"
 
 iflink=$(cat /sys/class/net/$netif/iflink)
 ifindex=$(cat /sys/class/net/$netif/ifindex)
-if [ "$iflink" != "$ifindex" ] ; then
+if [ "$iflink" != "$ifindex" ]; then
     # Skip VLAN devices
     exit 0
 fi
@@ -30,11 +30,10 @@ linkup "$netif"
 
 # Some fcoemon implementations expect --syslog=true
 syslogopt="--syslog"
-if fcoemon -h|grep syslog|grep -q yes; then
+if fcoemon -h | grep syslog | grep -q yes; then
     fcoemonyes="$syslogopt=yes"
 fi
 
-
 netdriver=$(readlink -f /sys/class/net/$netif/device/driver)
 netdriver=${netdriver##*/}
 
@@ -47,11 +46,11 @@ write_fcoemon_cfg() {
         echo DCB_REQUIRED=\"no\" >> /etc/fcoe/cfg-$netif
     fi
     if [ "$vlan" = "yes" ]; then
-           echo AUTO_VLAN=\"yes\" >> /etc/fcoe/cfg-$netif
+        echo AUTO_VLAN=\"yes\" >> /etc/fcoe/cfg-$netif
     else
-           echo AUTO_VLAN=\"no\" >> /etc/fcoe/cfg-$netif
+        echo AUTO_VLAN=\"no\" >> /etc/fcoe/cfg-$netif
     fi
-    if [ "$mode" = "vn2vn" ] ; then
+    if [ "$mode" = "vn2vn" ]; then
         echo MODE=\"vn2vn\" >> /etc/fcoe/cfg-$netif
     else
         echo MODE=\"fabric\" >> /etc/fcoe/cfg-$netif
@@ -75,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 c860035fe6cdcad035e6de3cbfb05e0639100cdf..0b8d01d05179892545855ec814bbfba9892f21bf 100755 (executable)
@@ -1,8 +1,8 @@
 #!/bin/bash
 
-if ! getargbool 1 rd.fcoe -d -n rd.nofcoe ; then
-       info "rd.fcoe=0: skipping lldpad activation"
-       return 0
+if ! getargbool 1 rd.fcoe -d -n rd.nofcoe; then
+    info "rd.fcoe=0: skipping lldpad activation"
+    return 0
 fi
 
 # Note lldpad will stay running after switchroot, the system initscripts
@@ -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 2729ec61f6628bab4f138632fed255f96b63c0a5..b52e8fcc6301f77b2e243d4f4b3232beb0991db0 100755 (executable)
@@ -30,43 +30,46 @@ get_vlan_parent() {
 
     [ -d $link ] || return
     read iflink < $link/iflink
-    for if in /sys/class/net/* ; do
-       read idx < $if/ifindex
-       if [ $idx -eq $iflink ] ; then
-           echo ${if##*/}
-       fi
+    for if in /sys/class/net/*; do
+        read idx < $if/ifindex
+        if [ $idx -eq $iflink ]; then
+            echo ${if##*/}
+        fi
     done
 }
 
 # called by dracut
 cmdline() {
     {
-        for c in /sys/bus/fcoe/devices/ctlr_* ; do
+        for c in /sys/bus/fcoe/devices/ctlr_*; do
             [ -L $c ] || continue
             read enabled < $c/enabled
             read mode < $c/mode
             [ $enabled -eq 0 ] && continue
-            if [ $mode = "VN2VN" ] ; then
+            if [ $mode = "VN2VN" ]; then
                 mode="vn2vn"
             else
                 mode="fabric"
             fi
-            d=$(cd -P $c; echo $PWD)
+            d=$(
+                cd -P $c
+                echo $PWD
+            )
             i=${d%/*}
             ifname=${i##*/}
             read mac < ${i}/address
-            s=$(dcbtool gc ${i##*/} dcb 2>/dev/null | sed -n 's/^DCB State:\t*\(.*\)/\1/p')
-            if [ -z "$s" ] ; then
-               p=$(get_vlan_parent ${i})
-               if [ "$p" ] ; then
-                   s=$(dcbtool gc ${p} dcb 2>/dev/null | sed -n 's/^DCB State:\t*\(.*\)/\1/p')
+            s=$(dcbtool gc ${i##*/} dcb 2> /dev/null | sed -n 's/^DCB State:\t*\(.*\)/\1/p')
+            if [ -z "$s" ]; then
+                p=$(get_vlan_parent ${i})
+                if [ "$p" ]; then
+                    s=$(dcbtool gc ${p} dcb 2> /dev/null | sed -n 's/^DCB State:\t*\(.*\)/\1/p')
                     ifname=${p##*/}
-               fi
+                fi
             fi
-            if [ "$s" = "on" ] ; then
-               dcb="dcb"
+            if [ "$s" = "on" ]; then
+                dcb="dcb"
             else
-               dcb="nodcb"
+                dcb="nodcb"
             fi
 
             # Some Combined Network Adapters(CNAs) implement DCB in firmware.
@@ -75,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
+            if [ "$p" ]; then
+                grep -q "^[[:blank:]]*DCB_REQUIRED=\"no\"" /etc/fcoe/cfg-${p} &> /dev/null
                 [ $? -eq 0 ] && dcb="nodcb"
             fi
 
@@ -99,7 +102,7 @@ install() {
     mkdir -m 0755 -p "$initdir/var/lib/lldpad"
     mkdir -m 0755 -p "$initdir/etc/fcoe"
 
-    if [[ $hostonly_cmdline == "yes" ]] ; then
+    if [[ $hostonly_cmdline == "yes" ]]; then
         local _fcoeconf=$(cmdline)
         [[ $_fcoeconf ]] && printf "%s\n" "$_fcoeconf" >> "${initdir}/etc/cmdline.d/95fcoe.conf"
     fi
@@ -114,4 +117,3 @@ install() {
     inst_hook shutdown 40 "$moddir/stop-fcoe.sh"
     dracut_need_initqueue
 }
-
index 0a8067f5e2c902a2d37a866590530d3f8f55a8cf..c165cefcfa24f3c7b9cc09af962602ff37ae264c 100755 (executable)
@@ -13,9 +13,9 @@
 # fcoe=eth0:nodcb:vn2vn
 # fcoe=4a:3f:4c:04:f8:d7:nodcb:fabric
 
-if ! getargbool 1 rd.fcoe -d -n rd.nofcoe ; then
-       info "rd.fcoe=0: skipping fcoe"
-       return 0
+if ! getargbool 1 rd.fcoe -d -n rd.nofcoe; then
+    info "rd.fcoe=0: skipping fcoe"
+    return 0
 fi
 
 [ -z "$fcoe" ] && fcoe=$(getarg fcoe=)
@@ -68,7 +68,7 @@ parse_fcoe_opts() {
 parse_fcoe_opts
 
 if [ "$fcoe_interface" = "edd" ]; then
-    if [ "$fcoe_dcb" != "nodcb" -a "$fcoe_dcb" != "dcb" ] ; then
+    if [ "$fcoe_dcb" != "nodcb" -a "$fcoe_dcb" != "dcb" ]; then
         warn "Invalid FCoE DCB option: $fcoe_dcb"
     fi
     /sbin/initqueue --settled --unique /sbin/fcoe-edd $fcoe_dcb
@@ -77,7 +77,7 @@ else
         unset fcoe_mac
         unset fcoe_interface
         parse_fcoe_opts
-        if [ "$fcoe_dcb" != "nodcb" -a "$fcoe_dcb" != "dcb" ] ; then
+        if [ "$fcoe_dcb" != "nodcb" -a "$fcoe_dcb" != "dcb" ]; then
             warn "Invalid FCoE DCB option: $fcoe_dcb"
         fi
         . $(command -v fcoe-genrules.sh)
index d2462b345bcc9f72393cc0265aff991a72c5c5cb..bd523c9d71824509bba0cc8d3fb3f1d72ac1daf7 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-for f in /sys/bus/fcoe/devices/ctlr_* ; do
+for f in /sys/bus/fcoe/devices/ctlr_*; do
     [ -e $f ] || continue
     echo 0 > $f/enabled
 done
index cbde94ce5c37ec2b5c5d26cead1f3e4e456b39e2..e58f0d87fa2ae051f8cfeb38d6649e6ff07fd266 100755 (executable)
@@ -2,7 +2,7 @@
 
 # called by dracut
 check() {
-    [[ -f $dracutsysrootdir/etc/fstab.sys ]] || [[ -n $add_fstab  ||  -n $fstab_lines ]]
+    [[ -f $dracutsysrootdir/etc/fstab.sys ]] || [[ -n $add_fstab || -n $fstab_lines ]]
 }
 
 # called by dracut
index 9ec100f0f6be570056955aa6db20d689b24155be..0ae10166380c3dd5f24be0fec2a5b4a3989ca734 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
-type det_fs >/dev/null 2>&1 || . /lib/fs-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
+type det_fs > /dev/null 2>&1 || . /lib/fs-lib.sh
 
 fstab_mount() {
     local _dev _mp _fs _opts _dump _pass _rest
@@ -9,7 +9,7 @@ fstab_mount() {
     info "Mounting from $1"
     while read _dev _mp _fs _opts _dump _pass _rest || [ -n "$_dev" ]; do
         [ -z "${_dev%%#*}" ] && continue # Skip comment lines
-        ismounted $_mp && continue # Skip mounted filesystem
+        ismounted $_mp && continue       # Skip mounted filesystem
         if [ "$_pass" -gt 0 ] && ! strstr "$_opts" _netdev; then
             fsck_single "$_dev" "$_fs" "$_opts"
         fi
index 60147452b4c31d9ba5fb7ae85ad903ea13ef597a..8338503ccdbecee2256ef64b7e4e37e6d87805f6 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
 
-if [ -z "${DRACUT_SYSTEMD}" ] && { [ -e /sys/module/bnx2i ] || [ -e /sys/module/qedi ]; } ; then
-      killproc iscsiuio
+if [ -z "${DRACUT_SYSTEMD}" ] && { [ -e /sys/module/bnx2i ] || [ -e /sys/module/qedi ]; }; then
+    killproc iscsiuio
 fi
index ac43b4871a5e99ed694beb32d8c7b2786b6f2eae..a3ca812b540f4f3d53068081fbfbeddbc8ed352a 100755 (executable)
@@ -6,9 +6,9 @@
 # iscsistart needs this.
 #
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
-type parse_iscsi_root >/dev/null 2>&1 || . /lib/net-lib.sh
-type write_fs_tab >/dev/null 2>&1 || . /lib/fs-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
+type parse_iscsi_root > /dev/null 2>&1 || . /lib/net-lib.sh
+type write_fs_tab > /dev/null 2>&1 || . /lib/fs-lib.sh
 
 PATH=/usr/sbin:/usr/bin:/sbin:/bin
 
@@ -34,19 +34,17 @@ iroot=${iroot#:}
 
 # XXX modprobe crc32c should go in the cmdline parser, but I haven't yet
 # figured out a way how to check whether this is built-in or not
-modprobe crc32c 2>/dev/null
+modprobe crc32c 2> /dev/null
 
 # start iscsiuio if needed
-if [ -z "${DRACUT_SYSTEMD}" ] && \
-      ( [ -e /sys/module/bnx2i ] || [ -e /sys/module/qedi ] ) && \
-       ! [ -e /tmp/iscsiuio-started ]; then
-      iscsiuio
-      > /tmp/iscsiuio-started
+if [ -z "${DRACUT_SYSTEMD}" ] \
+    && ([ -e /sys/module/bnx2i ] || [ -e /sys/module/qedi ]) \
+    && ! [ -e /tmp/iscsiuio-started ]; then
+    iscsiuio
+    > /tmp/iscsiuio-started
 fi
 
-
-handle_firmware()
-{
+handle_firmware() {
     local ifaces retry
 
     # Depending on the 'ql4xdisablesysfsboot' qla4xxx
@@ -57,11 +55,14 @@ handle_firmware()
     if ! iscsiadm -m fw; then
         warn "iscsiadm: Could not get list of targets from firmware."
     else
-        ifaces=$(set -- /sys/firmware/ibft/ethernet*; echo $#)
+        ifaces=$(
+            set -- /sys/firmware/ibft/ethernet*
+            echo $#
+        )
         retry=$(cat /tmp/session-retry)
 
         if [ $retry -lt $ifaces ]; then
-            retry=$((retry+1))
+            retry=$((retry + 1))
             echo $retry > /tmp/session-retry
             return 1
         else
@@ -81,9 +82,7 @@ handle_firmware()
     return 0
 }
 
-
-handle_netroot()
-{
+handle_netroot() {
     local iscsi_initiator iscsi_target_name iscsi_target_ip iscsi_target_port
     local iscsi_target_group iscsi_protocol iscsirw iscsi_lun
     local iscsi_username iscsi_password
@@ -107,9 +106,9 @@ handle_netroot()
     arg=$(getarg rd.iscsi.in.password -d iscsi_in_password=)
     [ -n "$arg" ] && iscsi_in_password=$arg
     for p in $(getargs rd.iscsi.param -d iscsi_param); do
-        [ "${p%=*}" = node.session.initial_login_retry_max ] && \
-            login_retry_max_seen=yes
-            iscsi_param="$iscsi_param $p"
+        [ "${p%=*}" = node.session.initial_login_retry_max ] \
+            && login_retry_max_seen=yes
+        iscsi_param="$iscsi_param $p"
     done
 
     # this sets iscsi_target_name and possibly overwrites most
@@ -118,7 +117,7 @@ handle_netroot()
 
     # Bail out early, if there is no route to the destination
     if is_ip "$iscsi_target_ip" && [ "$netif" != "timeout" ] && ! all_ifaces_setup && getargbool 1 rd.iscsi.testroute; then
-        ip route get "$iscsi_target_ip" >/dev/null 2>&1 || return 0
+        ip route get "$iscsi_target_ip" > /dev/null 2>&1 || return 0
     fi
 
     #limit iscsistart login retries
@@ -129,23 +128,23 @@ handle_netroot()
         fi
     fi
 
-# XXX is this needed?
+    # XXX is this needed?
     getarg ro && iscsirw=ro
     getarg rw && iscsirw=rw
     fsopts=${fsopts:+$fsopts,}${iscsirw}
 
     if [ -z "$iscsi_initiator" ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] && ! [ -f /tmp/iscsi_set_initiator ]; then
-           iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name)
-           echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
-           rm -f /etc/iscsi/initiatorname.iscsi
-           mkdir -p /etc/iscsi
-           ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
-           > /tmp/iscsi_set_initiator
-           if [ -n "$DRACUT_SYSTEMD" ]; then
-               systemctl try-restart iscsid
-               # FIXME: iscsid is not yet ready, when the service is :-/
-               sleep 1
-           fi
+        iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line; done < /sys/firmware/ibft/initiator/initiator-name)
+        echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
+        rm -f /etc/iscsi/initiatorname.iscsi
+        mkdir -p /etc/iscsi
+        ln -fs /run/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi
+        > /tmp/iscsi_set_initiator
+        if [ -n "$DRACUT_SYSTEMD" ]; then
+            systemctl try-restart iscsid
+            # FIXME: iscsid is not yet ready, when the service is :-/
+            sleep 1
+        fi
     fi
 
     if [ -z "$iscsi_initiator" ]; then
@@ -169,7 +168,6 @@ handle_netroot()
         fi
     fi
 
-
     if [ -z "$iscsi_target_port" ]; then
         iscsi_target_port=3260
     fi
@@ -194,12 +192,12 @@ handle_netroot()
         fi
     fi
 
-   if [ -z "$DRACUT_SYSTEMD" ]; then
-       iscsid
-       sleep 2
-   fi
+    if [ -z "$DRACUT_SYSTEMD" ]; then
+        iscsid
+        sleep 2
+    fi
 
-# FIXME $iscsi_protocol??
+    # FIXME $iscsi_protocol??
 
     if [ "$root" = "dhcp" ] || [ "$netroot" = "dhcp" ]; then
         # if root is not specified try to mount the whole iSCSI LUN
@@ -209,8 +207,8 @@ handle_netroot()
         wait_for_dev -n /dev/root
 
         # install mount script
-        [ -z "$DRACUT_SYSTEMD" ] && \
-            echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh
+        [ -z "$DRACUT_SYSTEMD" ] \
+            && echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh
     fi
 
     if strglobin $iscsi_target_ip '*:*:*' && ! strglobin $iscsi_target_ip '['; then
@@ -276,7 +274,7 @@ if [ "$netif" = "timeout" ] && all_ifaces_setup; then
     sleep 2
 fi
 
-if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
+if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware; then
     if [ "$netif" = "timeout" ] || [ "$netif" = "online" ] || [ "$netif" = "dummy" ]; then
         [ -f /tmp/session-retry ] || echo 1 > /tmp/session-retry
         handle_firmware
index 43a1dd9d67bd3534821bd5870182fa16222837c9..bd8c92b6d91d774c11d7f61044e7d73bfbdf14a8 100755 (executable)
@@ -10,10 +10,10 @@ check() {
     # booting from root.
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        pushd . >/dev/null
+        pushd . > /dev/null
         for_each_host_dev_and_slaves block_is_iscsi
         local _is_iscsi=$?
-        popd >/dev/null
+        popd > /dev/null
         [[ $_is_iscsi == 0 ]] || return 255
     }
     return 0
@@ -27,7 +27,7 @@ get_ibft_mod() {
         iface_mod=${iface_desc%%,*}
         iface_mac=${iface_desc#*,}
         iface_mac=${iface_mac%%,*}
-        if [ "$ibft_mac" = "$iface_mac" ] ; then
+        if [ "$ibft_mac" = "$iface_mac" ]; then
             echo $iface_mod
             return 0
         fi
@@ -41,17 +41,17 @@ install_ibft() {
     #         so the 'ip=ibft' parameter must not be set
     # - specify firmware booting cmdline parameter
 
-    for d in /sys/firmware/* ; do
-        if [ -d ${d}/ethernet0 ] ; then
+    for d in /sys/firmware/*; do
+        if [ -d ${d}/ethernet0 ]; then
             read ibft_mac < ${d}/ethernet0/mac
             ibft_mod=$(get_ibft_mod $ibft_mac)
         fi
-        if [ -z "$ibft_mod" ] && [ -d ${d}/ethernet1 ] ; then
+        if [ -z "$ibft_mod" ] && [ -d ${d}/ethernet1 ]; then
             read ibft_mac < ${d}/ethernet1/mac
             ibft_mod=$(get_ibft_mod $ibft_mac)
         fi
-        if [ -d ${d}/initiator ] ; then
-            if [ ${d##*/} = "ibft" ] && [ "$ibft_mod" != "bnx2i" ] ; then
+        if [ -d ${d}/initiator ]; then
+            if [ ${d##*/} = "ibft" ] && [ "$ibft_mod" != "bnx2i" ]; then
                 echo -n "rd.iscsi.ibft=1 "
             fi
             echo -n "rd.iscsi.firmware=1 "
@@ -77,45 +77,45 @@ install_iscsiroot() {
     [ "$host" = "$session" ] && return 1
     iscsi_host=${host##*/}
 
-    for flash in ${host}/flashnode_sess-* ; do
+    for flash in ${host}/flashnode_sess-*; do
         [ -f "$flash" ] || continue
         [ ! -e "$flash/is_boot_target" ] && continue
         is_boot=$(cat $flash/is_boot_target)
-        if [ $is_boot -eq 1 ] ; then
+        if [ $is_boot -eq 1 ]; then
             # qla4xxx flashnode session; skip iBFT discovery
             iscsi_initiator=$(cat /sys/class/iscsi_host/${iscsi_host}/initiatorname)
             echo "rd.iscsi.initiator=${iscsi_initiator}"
-            return;
+            return
         fi
     done
 
-    for d in ${session}/* ; do
+    for d in ${session}/*; do
         case $d in
-           *connection*)
-               c=${d##*/}
-               conn=${d}/iscsi_connection/${c}
-               if [ -d ${conn} ] ; then
-                   iscsi_address=$(cat ${conn}/persistent_address)
-                   iscsi_port=$(cat ${conn}/persistent_port)
-               fi
-               ;;
-           *session)
-               if [ -d ${d}/${iscsi_session} ] ; then
+            *connection*)
+                c=${d##*/}
+                conn=${d}/iscsi_connection/${c}
+                if [ -d ${conn} ]; then
+                    iscsi_address=$(cat ${conn}/persistent_address)
+                    iscsi_port=$(cat ${conn}/persistent_port)
+                fi
+                ;;
+            *session)
+                if [ -d ${d}/${iscsi_session} ]; then
                     iscsi_initiator=$(cat ${d}/${iscsi_session}/initiatorname)
-                   iscsi_targetname=$(cat ${d}/${iscsi_session}/targetname)
-               fi
-               ;;
+                    iscsi_targetname=$(cat ${d}/${iscsi_session}/targetname)
+                fi
+                ;;
         esac
     done
 
     [ -z "$iscsi_address" ] && return
     ip_params_for_remote_addr "$iscsi_address"
 
-    if [ -n "$iscsi_address" -a -n "$iscsi_targetname" ] ; then
-        if [ -n "$iscsi_port" -a "$iscsi_port" -eq 3260 ] ; then
+    if [ -n "$iscsi_address" -a -n "$iscsi_targetname" ]; then
+        if [ -n "$iscsi_port" -a "$iscsi_port" -eq 3260 ]; then
             iscsi_port=
         fi
-        if [ -n "$iscsi_lun" -a "$iscsi_lun" -eq 0 ] ; then
+        if [ -n "$iscsi_lun" -a "$iscsi_lun" -eq 0 ]; then
             iscsi_lun=
         fi
         # In IPv6 case rd.iscsi.initatior= must pass address in [] brackets
@@ -133,7 +133,6 @@ install_iscsiroot() {
     return 0
 }
 
-
 install_softiscsi() {
     [ -d /sys/firmware/ibft ] && return 0
 
@@ -142,7 +141,10 @@ install_softiscsi() {
         local iscsi_dev
 
         [[ -L "/sys/dev/block/$_dev" ]] || return
-        iscsi_dev=$(cd -P /sys/dev/block/$_dev; echo $PWD)
+        iscsi_dev=$(
+            cd -P /sys/dev/block/$_dev
+            echo $PWD
+        )
         install_iscsiroot $iscsi_dev
     }
 
@@ -174,7 +176,7 @@ installkernel() {
 cmdline() {
     local _iscsiconf=$(install_ibft)
     {
-        if [ "$_iscsiconf" ] ; then
+        if [ "$_iscsiconf" ]; then
             echo ${_iscsiconf}
         else
             install_softiscsi
@@ -204,7 +206,7 @@ install() {
     fi
 
     # Detect iBFT and perform mandatory steps
-    if [[ $hostonly_cmdline == "yes" ]] ; then
+    if [[ $hostonly_cmdline == "yes" ]]; then
         local _iscsiconf=$(cmdline)
         [[ $_iscsiconf ]] && printf "%s\n" "$_iscsiconf" >> "${initdir}/etc/cmdline.d/95iscsi.conf"
     fi
@@ -217,12 +219,12 @@ install() {
         inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh"
     else
         inst_multiple -o \
-                      $systemdsystemunitdir/iscsi.service \
-                      $systemdsystemunitdir/iscsid.service \
-                      $systemdsystemunitdir/iscsid.socket \
-                      $systemdsystemunitdir/iscsiuio.service \
-                      $systemdsystemunitdir/iscsiuio.socket \
-                      iscsiadm iscsid
+            $systemdsystemunitdir/iscsi.service \
+            $systemdsystemunitdir/iscsid.service \
+            $systemdsystemunitdir/iscsid.socket \
+            $systemdsystemunitdir/iscsiuio.service \
+            $systemdsystemunitdir/iscsiuio.socket \
+            iscsiadm iscsid
 
         for i in \
             iscsid.socket \
index 8d6e3e8cd2dc2f3b3bd4c889ff13aba5ee10b8a1..9303c9ee597b75361bfcafd4c26bec860a971fd3 100755 (executable)
@@ -31,11 +31,11 @@ fi
 
 [ -n "$iscsiroot" ] && [ -n "$iscsi_firmware" ] && die "Mixing iscsiroot and iscsi_firmware is dangerous"
 
-type write_fs_tab >/dev/null 2>&1 || . /lib/fs-lib.sh
+type write_fs_tab > /dev/null 2>&1 || . /lib/fs-lib.sh
 
 # Root takes precedence over netroot
-if [ "${root%%:*}" = "iscsi" ] ; then
-    if [ -n "$netroot" ] ; then
+if [ "${root%%:*}" = "iscsi" ]; then
+    if [ -n "$netroot" ]; then
         echo "Warning: root takes precedence over netroot. Ignoring netroot"
     fi
     netroot=$root
@@ -55,22 +55,22 @@ for nroot in $(getargs netroot); do
 done
 
 # Root takes precedence over netroot
-if [ "${root}" = "/dev/root" ] && getarg "netroot=dhcp" ; then
+if [ "${root}" = "/dev/root" ] && getarg "netroot=dhcp"; then
     # if root is not specified try to mount the whole iSCSI LUN
     printf 'ENV{DEVTYPE}!="partition", SYMLINK=="disk/by-path/*-iscsi-*-*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-iscsi-root.rules
     [ -n "$DRACUT_SYSTEMD" ] && systemctl is-active systemd-udevd && udevadm control --reload-rules
 fi
 
-if [ -n "$iscsiroot" ] ; then
-    [ -z "$netroot" ]  && netroot=$root
+if [ -n "$iscsiroot" ]; then
+    [ -z "$netroot" ] && netroot=$root
 
     # @deprecated
     echo "Warning: Argument iscsiroot is deprecated and might be removed in a future"
     echo "release. See 'man dracut.kernel' for more information."
 
     # Accept iscsiroot argument?
-    [ -z "$netroot" ] || [ "$netroot" = "iscsi" ] || \
-        die "Argument iscsiroot only accepted for empty root= or [net]root=iscsi"
+    [ -z "$netroot" ] || [ "$netroot" = "iscsi" ] \
+        || die "Argument iscsiroot only accepted for empty root= or [net]root=iscsi"
 
     # Override root with iscsiroot content?
     [ -z "$netroot" ] || [ "$netroot" = "iscsi" ] && netroot=iscsi:$iscsiroot
@@ -81,7 +81,7 @@ if [ -n "$iscsi_firmware" ]; then
     if [ "$root" != "dhcp" ] && [ "$netroot" != "dhcp" ]; then
         [ -z "$netroot" ] && netroot=iscsi:
     fi
-    modprobe -b -q iscsi_boot_sysfs 2>/dev/null
+    modprobe -b -q iscsi_boot_sysfs 2> /dev/null
     modprobe -b -q iscsi_ibft
     # if no ip= is given, but firmware
     echo "${DRACUT_SYSTEMD+systemctl is-active initrd-root-device.target || }[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh
@@ -98,12 +98,12 @@ fi
 modprobe --all -b -q qla4xxx cxgb3i cxgb4i bnx2i be2iscsi
 
 if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; then
-    if ! getargbool 1 rd.neednet >/dev/null || ! getarg "ip="; then
+    if ! getargbool 1 rd.neednet > /dev/null || ! getarg "ip="; then
         initqueue --unique --onetime --settled /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'"
     fi
 fi
 
-if arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) && [ -n "$arg" ] && ! [ -f /run/initiatorname.iscsi ] ; then
+if arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) && [ -n "$arg" ] && ! [ -f /run/initiatorname.iscsi ]; then
     iscsi_initiator=$arg
     echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
     ln -fs /run/initiatorname.iscsi /dev/.initiatorname.iscsi
@@ -119,7 +119,7 @@ fi
 
 # If not given on the cmdline and initiator-name available via iBFT
 if [ -z $iscsi_initiator ] && [ -f /sys/firmware/ibft/initiator/initiator-name ] && ! [ -f /tmp/iscsi_set_initiator ]; then
-    iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line;done < /sys/firmware/ibft/initiator/initiator-name)
+    iscsi_initiator=$(while read line || [ -n "$line" ]; do echo $line; done < /sys/firmware/ibft/initiator/initiator-name)
     if [ -n "$iscsi_initiator" ]; then
         echo "InitiatorName=$iscsi_initiator" > /run/initiatorname.iscsi
         rm -f /etc/iscsi/initiatorname.iscsi
@@ -142,7 +142,7 @@ initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "$netroot" "$NEWR
 
 for nroot in $(getargs netroot); do
     [ "${nroot%%:*}" = "iscsi" ] || continue
-    type parse_iscsi_root >/dev/null 2>&1 || . /lib/net-lib.sh
+    type parse_iscsi_root > /dev/null 2>&1 || . /lib/net-lib.sh
     parse_iscsi_root "$nroot" || return 1
     netroot_enc=$(str_replace "$nroot" '/' '\2f')
     echo "${DRACUT_SYSTEMD+systemctl is-active initrd-root-device.target || }[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh
index d9f84a383202db9ea8f215f43aac486f61ed5134..aaa035a80a68e193e23e6d7335cc6b25710e9071 100755 (executable)
@@ -10,7 +10,7 @@
 
 [ -z $DEVPATH ] && exit 1
 
-if [ -n "$1" ] ; then
+if [ -n "$1" ]; then
     LUN=$1
 else
     LUN=-
@@ -19,7 +19,7 @@ ID=${DEVPATH##*/rport-}
 HOST=${ID%%:*}
 CHANNEL=${ID%%-*}
 CHANNEL=${CHANNEL#*:}
-if [ -f /sys$DEVPATH/scsi_target_id ] ; then
+if [ -f /sys$DEVPATH/scsi_target_id ]; then
     TARGET=$(cat /sys$DEVPATH/scsi_target_id)
 fi
 [ -z "$TARGET" ] && exit 1
index 6afaed2623c87c0d2a6c94a971e2fd2459e7a467..0860483770bb9f6f305bee20d426c2e12d71c460 100755 (executable)
@@ -6,7 +6,10 @@
 cmdline() {
     get_lunmask() {
         local _dev=$1
-        local _devpath=$(cd -P /sys/dev/block/$_dev ; echo $PWD)
+        local _devpath=$(
+            cd -P /sys/dev/block/$_dev
+            echo $PWD
+        )
         local _sdev _lun _rport _end_device _classdev _wwpn _sas_address
 
         [ "${_devpath#*/sd}" == "$_devpath" ] && return 1
@@ -14,7 +17,7 @@ cmdline() {
         _lun="${_sdev##*:}"
         # Check for FibreChannel
         _rport="${_devpath##*/rport-}"
-        if [ "$_rport" != "$_devpath" ] ; then
+        if [ "$_rport" != "$_devpath" ]; then
             _rport="${_rport%%/*}"
             _classdev="/sys/class/fc_remote_ports/rport-${_rport}"
             [ -d "$_classdev" ] || return 1
@@ -24,7 +27,7 @@ cmdline() {
         fi
         # Check for SAS
         _end_device="${_devpath##*/end_device-}"
-        if [ "$_end_device" != "$_devpath" ] ; then
+        if [ "$_end_device" != "$_devpath" ]; then
             _end_device="${_end_device%%/*}"
             _classdev="/sys/class/sas_device/end_device-${_end_device}"
             [ -e "$_classdev" ] || return 1
@@ -60,10 +63,10 @@ install() {
     inst_script "$moddir/fc_transport_scan_lun.sh" /usr/lib/udev/fc_transport_scan_lun.sh
     inst_script "$moddir/sas_transport_scan_lun.sh" /usr/lib/udev/sas_transport_scan_lun.sh
     inst_hook cmdline 30 "$moddir/parse-lunmask.sh"
-    if [[ $hostonly_cmdline == "yes" ]] ; then
+    if [[ $hostonly_cmdline == "yes" ]]; then
         local _lunmask
 
-        for _lunmask in $(cmdline) ; do
+        for _lunmask in $(cmdline); do
             printf "%s\n" "$_lunmask" >> "${initdir}/etc/cmdline.d/95lunmask.conf"
         done
     fi
index 480f6147e54411a102e82ff3d38679320076bd1d..9e1f7010fa46a430b37cb59ed7b916b5bb4a98c9 100755 (executable)
@@ -11,13 +11,13 @@ create_udev_rule() {
 
     [ -e ${_rule} ] && return 0
 
-    if [ ! -f "$_rule" ] ; then
-        if [ "$transport" = "fc" ] ; then
-            cat > $_rule <<EOF
+    if [ ! -f "$_rule" ]; then
+        if [ "$transport" = "fc" ]; then
+            cat > $_rule << EOF
 ACTION=="add", SUBSYSTEM=="fc_remote_ports", ATTR{port_name}=="$tgtid", PROGRAM="fc_transport_scan_lun.sh $lun"
 EOF
-        elif [ "$transport" = "sas" ] ; then
-            cat > $_rule <<EOF
+        elif [ "$transport" = "sas" ]; then
+            cat > $_rule << EOF
 ACTION=="add", SUBSYSTEM=="sas_device", ATTR{sas_address}=="$tgtid", PROGRAM="sas_transport_scan_lun.sh $lun"
 EOF
         fi
@@ -30,9 +30,9 @@ for lunmask_arg in $(getargs rd.lunmask); do
         local IFS=","
         set $lunmask_arg
         IFS="$OLDIFS"
-        if [ -d /sys/module/scsi_mod ] ; then
+        if [ -d /sys/module/scsi_mod ]; then
             printf "manual" > /sys/module/scsi_mod/parameters/scan
-        elif [ ! -f /etc/modprobe.d/95lunmask.conf ] ; then
+        elif [ ! -f /etc/modprobe.d/95lunmask.conf ]; then
             echo "options scsi_mod scan=manual" > /etc/modprobe.d/95lunmask.conf
         fi
         create_udev_rule $1 $2 $3
index f7702f8b8733f5ad7a6cecc9457c59573a0ec39a..dc83bee322e25f653ef46c972d5f44fcda4c68cc 100755 (executable)
@@ -10,7 +10,7 @@
 
 [ -z $DEVPATH ] && exit 1
 
-if [ -n "$1" ] ; then
+if [ -n "$1" ]; then
     LUN=$1
 else
     LUN=-
@@ -19,7 +19,7 @@ ID=${DEVPATH##*/end_device-}
 HOST=${ID%%:*}
 CHANNEL=${ID%%-*}
 CHANNEL=${CHANNEL#*:}
-if [ -f /sys$DEVPATH/scsi_target_id ] ; then
+if [ -f /sys$DEVPATH/scsi_target_id ]; then
     TARGET=$(cat /sys$DEVPATH/scsi_target_id)
 fi
 [ -z "$TARGET" ] && exit 1
index 9254b49a57927b453b748d49db823d9a07f3119d..202fd5ba57e10ff4970a0c28acd87bebcea1904c 100755 (executable)
@@ -37,4 +37,3 @@ install() {
     fi
     dracut_need_initqueue
 }
-
index 5dc7dea97ccb1c10369f5a8b56adfd83106dc2e7..38603bf8189260680befea3095b2f65fcdf133ed 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 [ -z "$root" ] && root=$(getarg root=)
 
@@ -14,15 +14,18 @@ GENERATOR_DIR="$2"
 ROOTFLAGS="$(getarg rootflags)"
 
 nroot=${root#nbd:}
-nbdserver=${nroot%%:*};
+nbdserver=${nroot%%:*}
 if [ "${nbdserver%"${nbdserver#?}"}" = "[" ]; then
     nbdserver=${nroot#[}
-    nbdserver=${nbdserver%%]:*}\]; nroot=${nroot#*]:}
+    nbdserver=${nbdserver%%]:*}\]
+    nroot=${nroot#*]:}
 else
     nroot=${nroot#*:}
 fi
-nbdport=${nroot%%:*}; nroot=${nroot#*:}
-nbdfstype=${nroot%%:*}; nroot=${nroot#*:}
+nbdport=${nroot%%:*}
+nroot=${nroot#*:}
+nbdfstype=${nroot%%:*}
+nroot=${nroot#*:}
 nbdflags=${nroot%%:*}
 
 if [ "$nbdflags" = "$nbdfstype" ]; then
index 6d6d4776835472612998c632c6b2959cc2a69356..fe22a3a94aa582cf9b684f0a644a78e3d25f8c57 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 PATH=/usr/sbin:/usr/bin:/sbin:/bin
 
@@ -22,15 +22,18 @@ NEWROOT="$3"
 [ "${nroot%%:*}" = "nbd" ] || return
 
 nroot=${nroot#nbd:}
-nbdserver=${nroot%%:*};
+nbdserver=${nroot%%:*}
 if [ "${nbdserver%"${nbdserver#?}"}" = "[" ]; then
     nbdserver=${nroot#[}
-    nbdserver=${nbdserver%%]:*}; nroot=${nroot#*]:}
+    nbdserver=${nbdserver%%]:*}
+    nroot=${nroot#*]:}
 else
     nroot=${nroot#*:}
 fi
-nbdport=${nroot%%:*}; nroot=${nroot#*:}
-nbdfstype=${nroot%%:*}; nroot=${nroot#*:}
+nbdport=${nroot%%:*}
+nroot=${nroot#*:}
+nbdfstype=${nroot%%:*}
+nroot=${nroot#*:}
 nbdflags=${nroot%%:*}
 nbdopts=${nroot#*:}
 
@@ -102,13 +105,13 @@ if [ "$root" = "block:/dev/root" -o "$root" = "dhcp" ]; then
     wait_for_dev -n /dev/root
 
     if [ -z "$DRACUT_SYSTEMD" ]; then
-        type write_fs_tab >/dev/null 2>&1 || . /lib/fs-lib.sh
+        type write_fs_tab > /dev/null 2>&1 || . /lib/fs-lib.sh
 
         write_fs_tab /dev/root "$nbdfstype" "$fsopts"
 
         printf '/bin/mount %s\n' \
-             "$NEWROOT" \
-             > $hookdir/mount/01-$$-nbd.sh
+            "$NEWROOT" \
+            > $hookdir/mount/01-$$-nbd.sh
     fi
     # if we're on systemd, use the nbd-generator script
     # to create the /sysroot mount.
@@ -119,14 +122,14 @@ if strstr "$(nbd-client --help 2>&1)" "systemd-mark"; then
     preopts="-systemd-mark $preopts"
 fi
 
-if [ "$nbdport" -gt 0 ] 2>/dev/null; then
+if [ "$nbdport" -gt 0 ] 2> /dev/null; then
     nbdport="$nbdport"
 else
     nbdport="-name $nbdport"
 fi
 
-nbd-client -check /dev/nbd0 >/dev/null || \
-    nbd-client "$nbdserver" $nbdport /dev/nbd0 $preopts $opts || exit 1
+nbd-client -check /dev/nbd0 > /dev/null \
+    || nbd-client "$nbdserver" $nbdport /dev/nbd0 $preopts $opts || exit 1
 
 # NBD doesn't emit uevents when it gets connected, so kick it
 echo change > /sys/block/nbd0/uevent
index a11a365fa247c5ef7d89f2a944732481c9cd0d19..354208169a8409b1957228de301e000cc1a2e106 100755 (executable)
@@ -9,7 +9,6 @@
 # root= takes precedence over netroot= if root=nbd[...]
 #
 
-
 # This script is sourced, so root should be set. But let's be paranoid
 [ -z "$root" ] && root=$(getarg root=)
 
@@ -21,8 +20,8 @@ if [ -z "$netroot" ]; then
 fi
 
 # Root takes precedence over netroot
-if [ "${root%%:*}" = "nbd" ] ; then
-    if [ -n "$netroot" ] ; then
+if [ "${root%%:*}" = "nbd" ]; then
+    if [ -n "$netroot" ]; then
         warn "root takes precedence over netroot. Ignoring netroot"
 
     fi
@@ -33,13 +32,13 @@ fi
 # If it's not nbd we don't continue
 [ "${netroot%%:*}" = "nbd" ] || return
 
-
 # Check required arguments
 nroot=${netroot#nbd:}
-server=${nroot%%:*};
+server=${nroot%%:*}
 if [ "${server%"${server#?}"}" = "[" ]; then
     server=${nroot#[}
-    server=${server%%]:*}\]; nroot=${nroot#*]:}
+    server=${server%%]:*}\]
+    nroot=${nroot#*]:}
 else
     nroot=${nroot#*:}
 fi
@@ -60,4 +59,3 @@ if [ -z "$root" ]; then
     root=block:/dev/root
     # the device is created and waited for in ./nbdroot.sh
 fi
-
index 2d919192c0b37760dbf2c4eb88f631600aaafbf5..9e1d5fa298a6f0f43d59f8a6d8ea9916631270ba 100755 (executable)
@@ -50,7 +50,7 @@ cmdline() {
 
     ### nfsroot= ###
     nfs_device=$(findmnt -t nfs4 -n -o SOURCE /)
-    if [ -n "$nfs_device" ];then
+    if [ -n "$nfs_device" ]; then
         nfs_root="root=nfs4:$nfs_device"
     else
         nfs_device=$(findmnt -t nfs -n -o SOURCE /)
@@ -65,7 +65,7 @@ cmdline() {
     if [[ $nfs_device =~ [0-9]*\.[0-9]*\.[0-9]*.[0-9]* ]] || [[ $nfs_device =~ \[[^]]*\] ]]; then
         nfs_address="${nfs_device%%:*}"
     else
-        lookup=$(host "${nfs_device%%:*}"| grep " address " | head -n1)
+        lookup=$(host "${nfs_device%%:*}" | grep " address " | head -n1)
         nfs_address=${lookup##* }
     fi
 
@@ -95,7 +95,7 @@ install() {
     inst_libdir_file 'libnfsidmap_nsswitch.so*' 'libnfsidmap/*.so' 'libnfsidmap*.so*'
 
     _nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' "$dracutsysrootdir"/etc/nsswitch.conf \
-        |  tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
+        | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
     _nsslibs=${_nsslibs#|}
     _nsslibs=${_nsslibs%|}
 
index 95844f582d51e57196626d59bd9acf1eec1094e4..1ee62c77708f40998fb6704724a349ced66b6830 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 . /lib/net-lib.sh
 
 # TODO: make these things not pollute the calling namespace
@@ -39,7 +39,7 @@ nfsroot_to_var() {
     arg="${arg##$nfs:}"
 
     # check if we have a server
-    if strstr "$arg" ':/' ; then
+    if strstr "$arg" ':/'; then
         server="${arg%%:/*}"
         arg="/${arg##*:/}"
     fi
@@ -54,10 +54,10 @@ nfsroot_to_var() {
     options="${options%%:}"
 
     # Does it really start with '/'?
-    [ -n "${path%%/*}" ] && path="error";
+    [ -n "${path%%/*}" ] && path="error"
 
     #Fix kernel legacy style separating path and options with ','
-    if [ "$path" != "${path#*,}" ] ; then
+    if [ "$path" != "${path#*,}" ]; then
         options=${path#*,}
         path=${path%%,*}
     fi
@@ -123,16 +123,16 @@ munge_nfs_options() {
     IFS=,
     for f in $options; do
         case $f in
-            ro|rw) nfsrw=$f ;;
-            lock|nolock) nfslock=$f ;;
+            ro | rw) nfsrw=$f ;;
+            lock | nolock) nfslock=$f ;;
             *) flags=${flags:+$flags,}$f ;;
         esac
     done
     IFS="$OLDIFS"
 
     # Override rw/ro if set on cmdline
-    getarg ro >/dev/null && nfsrw=ro
-    getarg rw >/dev/null && nfsrw=rw
+    getarg ro > /dev/null && nfsrw=ro
+    getarg rw > /dev/null && nfsrw=rw
 
     options=$nfsrw${flags:+,$flags}
 }
index dadfd90ad661c2dfe95271d5e8362c48d4cdec7a..fd64ca27d061713261eec8e7dc1189ec69959bee 100755 (executable)
@@ -1,13 +1,13 @@
 #!/bin/sh
 
 if modprobe sunrpc || strstr "$(cat /proc/filesystems)" rpc_pipefs; then
-    [ ! -d /var/lib/nfs/rpc_pipefs/nfs ] && \
-        mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
+    [ ! -d /var/lib/nfs/rpc_pipefs/nfs ] \
+        && mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
 
     # Start rpcbind or rpcbind
     # FIXME occasionally saw 'rpcbind: fork failed: No such device' -- why?
-    command -v portmap >/dev/null && [ -z "$(pidof portmap)" ] && portmap
-    if command -v rpcbind >/dev/null && [ -z "$(pidof rpcbind)" ]; then
+    command -v portmap > /dev/null && [ -z "$(pidof portmap)" ] && portmap
+    if command -v rpcbind > /dev/null && [ -z "$(pidof rpcbind)" ]; then
         mkdir -p /run/rpcbind
         rpcbind
     fi
@@ -15,8 +15,8 @@ if modprobe sunrpc || strstr "$(cat /proc/filesystems)" rpc_pipefs; then
     # Start rpc.statd as mount won't let us use locks on a NFSv4
     # filesystem without talking to it. NFSv4 does locks internally,
     # rpc.lockd isn't needed
-    command -v rpc.statd >/dev/null && [ -z "$(pidof rpc.statd)" ] && rpc.statd
-    command -v rpc.idmapd >/dev/null && [ -z "$(pidof rpc.idmapd)" ] && rpc.idmapd
+    command -v rpc.statd > /dev/null && [ -z "$(pidof rpc.statd)" ] && rpc.statd
+    command -v rpc.idmapd > /dev/null && [ -z "$(pidof rpc.idmapd)" ] && rpc.idmapd
 else
     warn 'Kernel module "sunrpc" not in the initramfs, or support for filesystem "rpc_pipefs" missing!'
 fi
index 016521a3f705ae82b32725aa264ab72ae13e7dae..6e65e83f16c81b76ba0061b4001b2da71229f111 100755 (executable)
@@ -1,8 +1,8 @@
 #!/bin/sh
 
-type incol2 >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type incol2 > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
-[ -f /tmp/nfs.rpc_pipefs_path ] && rpcpipefspath=`cat /tmp/nfs.rpc_pipefs_path`
+[ -f /tmp/nfs.rpc_pipefs_path ] && rpcpipefspath=$(cat /tmp/nfs.rpc_pipefs_path)
 [ -z "$rpcpipefspath" ] && rpcpipefspath=var/lib/nfs/rpc_pipefs
 
 pid=$(pidof rpc.statd)
@@ -16,15 +16,14 @@ pid=$(pidof rpcbind)
 
 if incol2 /proc/mounts /var/lib/nfs/rpc_pipefs; then
     # try to create the destination directory
-    [ -d $NEWROOT/$rpcpipefspath ] || \
-        mkdir -m 0755 -p $NEWROOT/$rpcpipefspath 2>/dev/null
+    [ -d $NEWROOT/$rpcpipefspath ] \
+        || mkdir -m 0755 -p $NEWROOT/$rpcpipefspath 2> /dev/null
 
     if [ -d $NEWROOT/$rpcpipefspath ]; then
         # mount --move does not seem to work???
         mount --bind /var/lib/nfs/rpc_pipefs $NEWROOT/$rpcpipefspath
-        umount /var/lib/nfs/rpc_pipefs 2>/dev/null
+        umount /var/lib/nfs/rpc_pipefs 2> /dev/null
     else
-        umount /var/lib/nfs/rpc_pipefs 2>/dev/null
+        umount /var/lib/nfs/rpc_pipefs 2> /dev/null
     fi
 fi
-
index 93a6b1a13b2b7821ce1ad51d4863387247dbc444..c5fa27831162bece5ab53998bd7522dfa2c84374 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 . /lib/nfs-lib.sh
 
 [ "$#" = 3 ] || exit 1
@@ -14,7 +14,10 @@ NEWROOT="$3"
 nfs_to_var $root $netif
 [ -z "$server" ] && die "Required parameter 'server' is missing"
 
-mount_nfs $root $NEWROOT $netif && { [ -e /dev/root ] || ln -s null /dev/root ; [ -e /dev/nfs ] || ln -s null /dev/nfs; }
+mount_nfs $root $NEWROOT $netif && {
+    [ -e /dev/root ] || ln -s null /dev/root
+    [ -e /dev/nfs ] || ln -s null /dev/nfs
+}
 
 [ -f $NEWROOT/etc/fstab ] && cat $NEWROOT/etc/fstab > /dev/null
 
index 44a69d486b9eafe5f9012a431794e13009d87b8d..765cfa0c5bbec79f604739f7f99a8da5ff3a4638 100755 (executable)
@@ -23,8 +23,8 @@
 # NFSv3 is used.
 #
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
- . /lib/nfs-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
+. /lib/nfs-lib.sh
 
 # This script is sourced, so root should be set. But let's be paranoid
 [ -z "$root" ] && root=$(getarg root=)
@@ -34,7 +34,7 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
 
 # netroot= cmdline argument must be ignored, but must be used if
 # we're inside netroot to parse dhcp root-path
-if [ -n "$netroot" ] ; then
+if [ -n "$netroot" ]; then
     for n in $(getargs netroot=); do
         [ "$n" = "$netroot" ] && break
     done
@@ -43,37 +43,38 @@ if [ -n "$netroot" ] ; then
         netroot=$root
     fi
 else
-    netroot=$root;
+    netroot=$root
 fi
 
 # LEGACY: nfsroot= is valid only if root=/dev/nfs
-if [ -n "$nfsroot" ] ; then
+if [ -n "$nfsroot" ]; then
     # @deprecated
     warn "Argument nfsroot is deprecated and might be removed in a future release. See 'man dracut.kernel' for more information."
-    if [ "$(getarg root=)" != "/dev/nfs"  ]; then
+    if [ "$(getarg root=)" != "/dev/nfs" ]; then
         die "Argument nfsroot only accepted for legacy root=/dev/nfs"
     fi
-    netroot=nfs:$nfsroot;
+    netroot=nfs:$nfsroot
 fi
 
 case "$netroot" in
-    /dev/nfs) netroot=nfs;;
+    /dev/nfs) netroot=nfs ;;
     /dev/*)
         if [ -n "$oldnetroot" ]; then
             netroot="$oldnetroot"
         else
             unset netroot
         fi
-       return
-       ;;
+        return
+        ;;
     # LEGACY: root=<server-ip>:/<path
-    [0-9]*:/*|[0-9]*\.[0-9]*\.[0-9]*[!:]|/*)
-        netroot=nfs:$netroot;;
+    [0-9]*:/* | [0-9]*\.[0-9]*\.[0-9]*[!:] | /*)
+        netroot=nfs:$netroot
+        ;;
 esac
 
 # Continue if nfs
 case "${netroot%%:*}" in
-    nfs|nfs4|/dev/nfs);;
+    nfs | nfs4 | /dev/nfs) ;;
     *)
         if [ -n "$oldnetroot" ]; then
             netroot="$oldnetroot"
@@ -106,9 +107,9 @@ fstype=${nfs#/dev/}
 netroot="$fstype:$server:$path:$options"
 
 # If we don't have a server, we need dhcp
-if [ -z "$server" ] ; then
+if [ -z "$server" ]; then
     DHCPORSERVER="1"
-fi;
+fi
 
 # Done, all good!
 rootok=1
index 268f1a2ce2295de6c5f31b43988e3099ffd32248..8285fa0c882f30a6bf51eeb83bbcf1853e10e0e9 100755 (executable)
@@ -12,12 +12,12 @@ check() {
 
         [[ -L "/sys/dev/block/$_dev" ]] || return 0
         cd -P "/sys/dev/block/$_dev" || return 0
-        if [ -f partition ] ; then
+        if [ -f partition ]; then
             cd ..
         fi
-        for d in device/nvme* ; do
+        for d in device/nvme*; do
             [ -L "$d" ] || continue
-            if readlink "$d" | grep -q nvme-fabrics ; then
+            if readlink "$d" | grep -q nvme-fabrics; then
                 trtype=$(cat "$d"/transport)
                 break
             fi
@@ -26,13 +26,13 @@ check() {
     }
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        pushd . >/dev/null
+        pushd . > /dev/null
         for_each_host_dev_and_slaves is_nvmf
         local _is_nvmf=$?
-        popd >/dev/null
+        popd > /dev/null
         [[ $_is_nvmf == 0 ]] || return 255
-        if [ ! -f /sys/class/fc/fc_udev_device/nvme_discovery ] ; then
-            if [ ! -f /etc/nvme/discovery.conf ] ; then
+        if [ ! -f /sys/class/fc/fc_udev_device/nvme_discovery ]; then
+            if [ ! -f /etc/nvme/discovery.conf ]; then
                 echo "No discovery arguments present"
                 return 255
             fi
@@ -64,12 +64,12 @@ cmdline() {
 
         [[ -L "/sys/dev/block/$_dev" ]] || return 0
         cd -P "/sys/dev/block/$_dev" || return 0
-        if [ -f partition ] ; then
+        if [ -f partition ]; then
             cd ..
         fi
-        for d in device/nvme* ; do
+        for d in device/nvme*; do
             [ -L "$d" ] || continue
-            if readlink "$d" | grep -q nvme-fabrics ; then
+            if readlink "$d" | grep -q nvme-fabrics; then
                 trtype=$(cat "$d"/transport)
                 break
             fi
@@ -82,27 +82,27 @@ cmdline() {
         done
     }
 
-    if [ -f /etc/nvme/hostnqn ] ; then
+    if [ -f /etc/nvme/hostnqn ]; then
         _hostnqn=$(cat /etc/nvme/hostnqn)
         echo -n " nvmf.hostnqn=${_hostnqn}"
     fi
-    if [ -f /etc/nvme/hostid ] ; then
+    if [ -f /etc/nvme/hostid ]; then
         _hostid=$(cat /etc/nvme/hostid)
         echo -n " nvmf.hostid=${_hostid}"
     fi
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        pushd . >/dev/null
+        pushd . > /dev/null
         for_each_host_dev_and_slaves gen_nvmf_cmdline
-        popd >/dev/null
+        popd > /dev/null
     }
 }
 
 # called by dracut
 install() {
     if [[ $hostonly_cmdline == "yes" ]]; then
-       local _nvmf_args=$(cmdline)
-       [[ "$_nvmf_args" ]] && printf "%s" "$_nvmf_args" >> "${initdir}/etc/cmdline.d/95nvmf-args.conf"
+        local _nvmf_args=$(cmdline)
+        [[ "$_nvmf_args" ]] && printf "%s" "$_nvmf_args" >> "${initdir}/etc/cmdline.d/95nvmf-args.conf"
     fi
     inst_simple "/etc/nvme/hostnqn"
     inst_simple "/etc/nvme/hostid"
index eb10dc97dfbfa24f9dbb39ce23f004a5bc2bf8a3..d75f780acd4b7aef6990b6a899dd8f08e999ce9b 100755 (executable)
@@ -17,9 +17,9 @@
 # specify any discover parameters for FC.
 #
 
-type is_ip >/dev/null 2>&1 || . /lib/net-lib.sh
+type is_ip > /dev/null 2>&1 || . /lib/net-lib.sh
 
-if getargbool 0 rd.nonvmf ; then
+if getargbool 0 rd.nonvmf; then
     warn "rd.nonvmf=0: skipping nvmf"
     return 0
 fi
@@ -27,7 +27,7 @@ fi
 initqueue --onetime modprobe --all -b -q nvme nvme_tcp nvme_core nvme_fabrics
 
 validate_ip_conn() {
-    if ! getargbool 0 rd.neednet ; then
+    if ! getargbool 0 rd.neednet; then
         warn "$trtype transport requires rd.neednet=1"
         return 1
     fi
@@ -35,20 +35,20 @@ validate_ip_conn() {
     local_address=$(ip -o route get to $traddr | sed -n 's/.*src \([0-9a-f.:]*\).*/\1/p')
 
     # confirm we got a local IP address
-    if ! is_ip "$local_address" ; then
-        warn "$traddr is an invalid address";
+    if ! is_ip "$local_address"; then
+        warn "$traddr is an invalid address"
         return 1
     fi
 
     ifname=$(ip -o route get to $local_address | sed -n 's/.*dev \([^ ]*\).*/\1/p')
 
-    if ip l show "$ifname" >/dev/null 2>&1 ; then
-       warn "invalid network interface $ifname"
-       return 1
+    if ip l show "$ifname" > /dev/null 2>&1; then
+        warn "invalid network interface $ifname"
+        return 1
     fi
 
     # confirm there's a route to destination
-    if ip route get "$traddr" >/dev/null 2>&1 ; then
+    if ip route get "$traddr" > /dev/null 2>&1; then
         warn "no route to $traddr"
         return 1
     fi
@@ -85,27 +85,27 @@ parse_nvmf_discover() {
             return 0
             ;;
     esac
-    if [ "$traddr" = "none" ] ; then
+    if [ "$traddr" = "none" ]; then
         warn "traddr is mandatory for $trtype"
-        return 0;
+        return 0
     fi
-    if [ "$trtype" = "fc" ] ; then
-        if [ "$traddr" = "auto" ] ; then
+    if [ "$trtype" = "fc" ]; then
+        if [ "$traddr" = "auto" ]; then
             rm /etc/nvme/discovery.conf
             return 1
         fi
-        if [ "$hosttraddr" = "none" ] ; then
+        if [ "$hosttraddr" = "none" ]; then
             warn "host traddr is mandatory for fc"
             return 0
         fi
-    elif [ "$trtype" != "rdma" ] && [ "$trtype" != "tcp" ] ; then
+    elif [ "$trtype" != "rdma" ] && [ "$trtype" != "tcp" ]; then
         warn "unsupported transport $trtype"
         return 0
     fi
     if [ "$trtype" = "tcp" ]; then
         validate_ip_conn
     fi
-    if [ "$trtype" = "fc" ] ; then
+    if [ "$trtype" = "fc" ]; then
         echo "--transport=$trtype --traddr=$traddr --host-traddr=$hosttraddr" >> /etc/nvme/discovery.conf
     else
         echo "--transport=$trtype --traddr=$traddr --host-traddr=$hosttraddr --trsvcid=$trsvcid" >> /etc/nvme/discovery.conf
@@ -114,11 +114,11 @@ parse_nvmf_discover() {
 }
 
 nvmf_hostnqn=$(getarg nvmf.hostnqn=)
-if [ -n "$nvmf_hostnqn" ] ; then
+if [ -n "$nvmf_hostnqn" ]; then
     echo "$nvmf_hostnqn" > /etc/nvme/hostnqn
 fi
 nvmf_hostid=$(getarg nvmf.hostid=)
-if [ -n "$nvmf_hostid" ] ; then
+if [ -n "$nvmf_hostid" ]; then
     echo "$nvmf_hostid" > /etc/nvme/hostid
 fi
 
@@ -130,14 +130,14 @@ done
 [ -f "/etc/nvme/hostnqn" ] || exit 0
 [ -f "/etc/nvme/hostid" ] || exit 0
 
-if [ -f "/etc/nvme/discovery.conf" ] ; then
+if [ -f "/etc/nvme/discovery.conf" ]; then
     /sbin/initqueue --settled --onetime --unique --name nvme-discover /usr/sbin/nvme connect-all
-    if [ "$trtype" = "tcp" ] ; then
+    if [ "$trtype" = "tcp" ]; then
         > /tmp/net.$ifname.did-setup
     fi
 else
     # No nvme command line arguments present, try autodiscovery
-    if [ "$trtype" = "fc" ] ; then
+    if [ "$trtype" = "fc" ]; then
         /sbin/initqueue --finished --onetime --unique --name nvme-fc-autoconnect /sbin/nvmf-autoconnect.sh
     fi
 fi
index 543dd239dd677175839e089140554b6752a386c0..8fbdcdaf20551144c32c3c7a24f5f514f3396517 100755 (executable)
@@ -12,14 +12,14 @@ check() {
         for i in /sys/devices/qeth/*/online; do
             read _online < $i
             [ $_online -eq 1 ] && return 0
-       done
+        done
     }
     return 255
 }
 
 # called by dracut
 installkernel() {
-   instmods qeth
+    instmods qeth
 }
 
 # called by dracut
@@ -31,11 +31,11 @@ install() {
 
     inst_rules_qeth() {
         for rule in /etc/udev/rules.d/{4,5}1-qeth-${1}.rules; do
-           # prefer chzdev generated 41- rules
-           if [ -f "$rule" ]; then
-              inst_rules "$rule"
-              break
-           fi
+            # prefer chzdev generated 41- rules
+            if [ -f "$rule" ]; then
+                inst_rules "$rule"
+                break
+            fi
         done
     }
 
@@ -44,9 +44,9 @@ install() {
         # not readable in qeth interfaces
         # that have just been assembled, ignore
         # read error and assume no carrier
-        read carrier 2>/dev/null < "$1/carrier"
+        read carrier 2> /dev/null < "$1/carrier"
         [ "$carrier" -eq 1 ] && return 0
-        return 1;
+        return 1
     }
 
     for dev in /sys/class/net/*; do
index 551e589afbdaf94b5413acca9dbd74f0fad573c5..f0507b136b514fc419c388a64752f051c9d687d8 100755 (executable)
@@ -33,25 +33,24 @@ cmdline() {
 # called by dracut
 install() {
     local _bin
-       local _resumeconf
+    local _resumeconf
 
     if [[ $hostonly_cmdline == "yes" ]]; then
-       _resumeconf=$(cmdline)
-       [[ $_resumeconf ]] && printf "%s\n" "$_resumeconf" >> "${initdir}/etc/cmdline.d/95resume.conf"
+        _resumeconf=$(cmdline)
+        [[ $_resumeconf ]] && printf "%s\n" "$_resumeconf" >> "${initdir}/etc/cmdline.d/95resume.conf"
     fi
 
     # if systemd is included and has the hibernate-resume tool, use it and nothing else
     if dracut_module_included "systemd" && [[ -x $dracutsysrootdir$systemdutildir/systemd-hibernate-resume ]]; then
         inst_multiple -o \
-                      "$systemdutildir"/system-generators/systemd-hibernate-resume-generator \
-                      "$systemdsystemunitdir"/systemd-hibernate-resume@.service \
-                      "$systemdutildir"/systemd-hibernate-resume
+            "$systemdutildir"/system-generators/systemd-hibernate-resume-generator \
+            "$systemdsystemunitdir"/systemd-hibernate-resume@.service \
+            "$systemdutildir"/systemd-hibernate-resume
         return 0
     fi
 
     # Optional uswsusp support
-    for _bin in /usr/sbin/resume /usr/lib/suspend/resume /usr/lib/uswsusp/resume
-    do
+    for _bin in /usr/sbin/resume /usr/lib/suspend/resume /usr/lib/uswsusp/resume; do
         [[ -x $dracutsysrootdir${_bin} ]] && {
             inst "${_bin}" /usr/sbin/resume
             [[ $hostonly ]] && [[ -f $dracutsysrootdir/etc/suspend.conf ]] && inst -H /etc/suspend.conf
@@ -65,6 +64,5 @@ install() {
         inst_script "$moddir/parse-resume.sh" /lib/dracut/parse-resume.sh
     fi
 
-    inst_script  "$moddir/resume.sh" /lib/dracut/resume.sh
+    inst_script "$moddir/resume.sh" /lib/dracut/resume.sh
 }
-
index e525aa2916ce43976fc949f8b13d56f88795e62c..e7cfe4720f13e86eac85e1a23ca9a6a40e65611e 100755 (executable)
@@ -2,12 +2,11 @@
 
 if resume=$(getarg resume=) && ! getarg noresume; then
     export resume
-    echo "$resume" >/.resume
+    echo "$resume" > /.resume
 else
     unset resume
 fi
 
-
 resume="$(label_uuid_to_dev "$resume")"
 
 if splash=$(getarg splash=); then
@@ -17,24 +16,23 @@ else
 fi
 
 case "$splash" in
-    quiet )
+    quiet)
         a_splash="-P splash=y"
-    ;;
-    * )
+        ;;
+    *)
         a_splash="-P splash=n"
-    ;;
+        ;;
 esac
 
-
 if ! getarg noresume; then
     if [ -n "$resume" ]; then
         wait_for_dev /dev/resume
 
         {
             printf "KERNEL==\"%s\", ACTION==\"add|change\", SYMLINK+=\"resume\"\n" \
-                ${resume#/dev/};
+                ${resume#/dev/}
             printf "SYMLINK==\"%s\", ACTION==\"add|change\", SYMLINK+=\"resume\"\n" \
-                ${resume#/dev/};
+                ${resume#/dev/}
         } >> /etc/udev/rules.d/99-resume-link.rules
 
         {
@@ -42,11 +40,11 @@ if ! getarg noresume; then
                 printf -- 'KERNEL=="%s", ' "${resume#/dev/}"
                 printf -- '%s' 'ACTION=="add|change", ENV{ID_FS_TYPE}=="suspend|swsuspend|swsupend",'
                 printf -- " RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \'%s\'\"\n" \
-                     "$a_splash" "$resume";
+                    "$a_splash" "$resume"
                 printf -- 'SYMLINK=="%s", ' "${resume#/dev/}"
                 printf -- '%s' 'ACTION=="add|change", ENV{ID_FS_TYPE}=="suspend|swsuspend|swsupend",'
                 printf -- " RUN+=\"/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s \'%s\'\"\n" \
-                    "$a_splash" "$resume";
+                    "$a_splash" "$resume"
             fi
 
             printf -- 'KERNEL=="%s", ' "${resume#/dev/}"
@@ -74,7 +72,7 @@ if ! getarg noresume; then
                 printf -- ' RUN+="/sbin/initqueue --finished --unique --name 00resume /usr/sbin/resume %s $tempnode"\n' "$a_splash"
             fi
             printf -- '%s' 'SUBSYSTEM=="block", ACTION=="add|change", ENV{ID_FS_TYPE}=="suspend|swsuspend|swsupend",'
-            printf -- '%s\n' ' RUN+="/sbin/initqueue --finished --unique --name 00resume echo %M:%m > /sys/power/resume"';
+            printf -- '%s\n' ' RUN+="/sbin/initqueue --finished --unique --name 00resume echo %M:%m > /sys/power/resume"'
         } >> /etc/udev/rules.d/99-resume.rules
     fi
 fi
index e7becd0ae925f0993e2057f732ed6cece02106d7..065455efd4e2040435830ad1673304846eb70f20 100755 (executable)
@@ -5,14 +5,14 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
 [ -s /.resume -a -b "$resume" ] && {
     # First try user level resume; it offers splash etc
     case "$splash" in
-        quiet )
+        quiet)
             a_splash="-P splash=y"
-        ;;
-        * )
+            ;;
+        *)
             a_splash="-P splash=n"
-        ;;
+            ;;
     esac
     [ -x "$(command -v resume)" ] && command resume $a_splash "$resume"
 
-    (readlink -fn $resume > /sys/power/resume)>/.resume
+    (readlink -fn $resume > /sys/power/resume) > /.resume
 }
index 6503b517b1dac3a0478dc69aa2a5b93955e08e4c..1c73028286c1c050ba14f8980c0bf0086fad266a 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
-type det_fs >/dev/null 2>&1 || . /lib/fs-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
+type det_fs > /dev/null 2>&1 || . /lib/fs-lib.sh
 
 mount_root() {
     local _ret
@@ -19,7 +19,7 @@ mount_root() {
                 fsckoptions="-j $journaldev $fsckoptions"
                 rflags="${rflags:+${rflags},}jdev=$journaldev"
                 ;;
-            *);;
+            *) ;;
         esac
     fi
 
@@ -41,11 +41,11 @@ mount_root() {
         READONLY=yes
     fi
 
-    if getarg noreadonlyroot ; then
+    if getarg noreadonlyroot; then
         READONLY=no
     fi
 
-    if [ -f "$NEWROOT"/fastboot ] || getargbool 0 fastboot ; then
+    if [ -f "$NEWROOT"/fastboot ] || getargbool 0 fastboot; then
         fastboot=yes
     fi
 
@@ -54,11 +54,11 @@ mount_root() {
             fsckoptions=$(cat "$NEWROOT"/fsckoptions)
         fi
 
-        if [ -f "$NEWROOT"/forcefsck ] || getargbool 0 forcefsck ; then
+        if [ -f "$NEWROOT"/forcefsck ] || getargbool 0 forcefsck; then
             fsckoptions="-f $fsckoptions"
         elif [ -f "$NEWROOT"/.autofsck ]; then
-            [ -f "$NEWROOT"/etc/sysconfig/autofsck ] && \
-                . "$NEWROOT"/etc/sysconfig/autofsck
+            [ -f "$NEWROOT"/etc/sysconfig/autofsck ] \
+                && . "$NEWROOT"/etc/sysconfig/autofsck
             if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then
                 AUTOFSCK_OPT="$AUTOFSCK_OPT -f"
             fi
@@ -74,7 +74,7 @@ mount_root() {
 
     rootopts=
     if getargbool 1 rd.fstab -d -n rd_NO_FSTAB \
-        && ! getarg rootflags >/dev/null \
+        && ! getarg rootflags > /dev/null \
         && [ -f "$NEWROOT/etc/fstab" ] \
         && ! [ -L "$NEWROOT/etc/fstab" ]; then
         # if $NEWROOT/etc/fstab contains special mount options for
@@ -106,10 +106,10 @@ mount_root() {
     # printf '%s %s %s %s 1 1 \n' "$esc_root" "$NEWROOT" "$rootfs" "$rflags" >/etc/fstab
 
     ran_fsck=0
-    if fsck_able "$rootfs" && \
-        [ "$rootfsck" != "0" -a -z "$fastboot" -a "$READONLY" != "yes" ] && \
-            ! strstr "${rflags}" _netdev && \
-            ! getargbool 0 rd.skipfsck; then
+    if fsck_able "$rootfs" \
+        && [ "$rootfsck" != "0" -a -z "$fastboot" -a "$READONLY" != "yes" ] \
+        && ! strstr "${rflags}" _netdev \
+        && ! getargbool 0 rd.skipfsck; then
         umount "$NEWROOT"
         fsck_single "${root#block:}" "$rootfs" "$rflags" "$fsckoptions"
         _ret=$?
@@ -127,8 +127,8 @@ mount_root() {
     fi
 
     if ! getargbool 0 rd.skipfsck; then
-        [ -f "$NEWROOT"/forcefsck ] && rm -f -- "$NEWROOT"/forcefsck 2>/dev/null
-        [ -f "$NEWROOT"/.autofsck ] && rm -f -- "$NEWROOT"/.autofsck 2>/dev/null
+        [ -f "$NEWROOT"/forcefsck ] && rm -f -- "$NEWROOT"/forcefsck 2> /dev/null
+        [ -f "$NEWROOT"/.autofsck ] && rm -f -- "$NEWROOT"/.autofsck 2> /dev/null
     fi
 }
 
index 72c0a9566bcbb971ffbd85f15a099e152df240be..75dc3f7ee0ee749db15d767bcecfaf0f1d446803 100755 (executable)
@@ -3,10 +3,12 @@
 case "${root#block:}" in
     LABEL=* | UUID=* | PARTUUID=* | PARTLABEL=*)
         root="block:$(label_uuid_to_dev "$root")"
-        rootok=1 ;;
+        rootok=1
+        ;;
     /dev/*)
         root="block:${root#block:}"
-        rootok=1 ;;
+        rootok=1
+        ;;
 esac
 
 [ "${root%%:*}" = "block" ] && wait_for_dev "${root#block:}"
index 2fa6ba39b8c7135650d868fddee80751b6cd470b..ce4ee850cf3d6060346419f08c1fd19eb063ae07 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 for root in $(getargs rootfallback=); do
     root=$(label_uuid_to_dev "$root")
index 3283d27cfd5c5913ac900f7e06060ac8163068f5..fb37536418b0ac65cb8e86df3f833ca4543e28fb 100755 (executable)
@@ -7,7 +7,7 @@ check() {
     [[ $mount_needs ]] && return 1
 
     # If our prerequisites are not met, fail.
-    require_binaries ssh scp  || return 1
+    require_binaries ssh scp || return 1
 
     if [[ $sshkey ]]; then
         [[ ! -f $dracutsysrootdir$sshkey ]] && {
@@ -25,8 +25,7 @@ depends() {
     echo network
 }
 
-inst_sshenv()
-{
+inst_sshenv() {
     if [[ -d $dracutsysrootdir/root/.ssh ]]; then
         inst_dir /root/.ssh
         chmod 700 "${initdir}"/root/.ssh
@@ -71,10 +70,10 @@ install() {
     _nsslibs=$(
         sed -e 's/#.*//; s/^[^:]*://; s/\[[^]]*\]//' \
             "$dracutsysrootdir"/etc/nsswitch.conf \
-        |  tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
+            | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|'
+    )
     _nsslibs=${_nsslibs#|}
     _nsslibs=${_nsslibs%|}
 
     inst_libdir_file -n "$_nsslibs" 'libnss_*.so*'
 }
-
index e1e4a3e3d91e2f47d64bc1498fde785c65844304..8db8bde8f9969a0f9d1c6054f918efedb5d7f121 100755 (executable)
@@ -16,7 +16,7 @@ install() {
         [[ -x $dracutsysrootdir$_i ]] || continue
         inst "$_i"
 
-        if ! [[ -f  ${initdir}${systemdutildir}/systemd-udevd ]]; then
+        if ! [[ -f ${initdir}${systemdutildir}/systemd-udevd ]]; then
             ln -fs "$_i" "${initdir}${systemdutildir}"/systemd-udevd
         fi
         break
@@ -43,8 +43,7 @@ install() {
         73-seat-late.rules \
         75-net-description.rules \
         80-drivers.rules 95-udev-late.rules \
-        80-net-name-slot.rules\
-        80-net-setup-link.rules \
+        80-net-name-slot.rules 80-net-setup-link.rules \
         95-late.rules \
         "$moddir/59-persistent-storage.rules" \
         "$moddir/61-persistent-storage.rules" \
@@ -65,14 +64,14 @@ install() {
 
     {
         for i in cdrom tape dialout floppy; do
-            if ! grep -q "^$i:" "$initdir"/etc/group 2>/dev/null; then
-                if ! grep "^$i:" "$dracutsysrootdir"/etc/group 2>/dev/null; then
-                        case $i in
-                            cdrom)   echo "$i:x:11:";;
-                            dialout) echo "$i:x:18:";;
-                            floppy)  echo "$i:x:19:";;
-                            tape)    echo "$i:x:33:";;
-                        esac
+            if ! grep -q "^$i:" "$initdir"/etc/group 2> /dev/null; then
+                if ! grep "^$i:" "$dracutsysrootdir"/etc/group 2> /dev/null; then
+                    case $i in
+                        cdrom) echo "$i:x:11:" ;;
+                        dialout) echo "$i:x:18:" ;;
+                        floppy) echo "$i:x:19:" ;;
+                        tape) echo "$i:x:33:" ;;
+                    esac
                 fi
             fi
         done
@@ -98,10 +97,9 @@ install() {
 
     inst_multiple -o /etc/pcmcia/config.opts
 
-    [[ -f $dracutsysrootdir/etc/arch-release ]] && \
-        inst_script "$moddir/load-modules.sh" /lib/udev/load-modules.sh
+    [[ -f $dracutsysrootdir/etc/arch-release ]] \
+        && inst_script "$moddir/load-modules.sh" /lib/udev/load-modules.sh
 
     inst_libdir_file "libnss_files*"
 
 }
-
index 728110c02134b840f154bf90b2a28ae82cf4d9c3..f64ad97dcb3e98091c567cb7f6d8a0e5dae948d9 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 filter_rootopts() {
     rootopts=$1
@@ -12,10 +12,11 @@ filter_rootopts() {
     local v
     while [ $# -gt 0 ]; do
         case $1 in
-            rw|ro);;
-            defaults);;
+            rw | ro) ;;
+            defaults) ;;
             *)
-                v="$v,${1}";;
+                v="$v,${1}"
+                ;;
         esac
         shift
     done
@@ -64,8 +65,8 @@ mount_root() {
     info "Remounting ${root#virtfs:} with -o ${rflags}"
     mount -t ${rootfs} -o "$rflags" "${root#virtfs:}" "$NEWROOT" 2>&1 | vinfo
 
-    [ -f "$NEWROOT"/forcefsck ] && rm -f -- "$NEWROOT"/forcefsck 2>/dev/null
-    [ -f "$NEWROOT"/.autofsck ] && rm -f -- "$NEWROOT"/.autofsck 2>/dev/null
+    [ -f "$NEWROOT"/forcefsck ] && rm -f -- "$NEWROOT"/forcefsck 2> /dev/null
+    [ -f "$NEWROOT"/.autofsck ] && rm -f -- "$NEWROOT"/.autofsck 2> /dev/null
 }
 
 if [ -n "$root" -a -z "${root%%virtfs:*}" ]; then
index c03443bb88a5e26db9d3d8419ca265688682ebc5..7a24656226f69a57c9ba36aba41db00633b2a6ef 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-if [ "${root%%:*}" = "virtfs" ] ; then
+if [ "${root%%:*}" = "virtfs" ]; then
     modprobe 9pnet_virtio
 
     rootok=1
index 5aa6add87ca29e5e77bf003464e26c4c72e3ef30..4d0d8b2fa3b8ce5c7c3136662ee77e6e5d4b4af9 100755 (executable)
@@ -3,7 +3,7 @@
 getargbool 1 rd.zfcp.conf -d -n rd_NO_ZFCPCONF || rm /etc/zfcp.conf
 
 for zfcp_arg in $(getargs rd.zfcp -d 'rd_ZFCP='); do
-    echo $zfcp_arg | grep '^0\.[0-9a-fA-F]\.[0-9a-fA-F]\{4\}\(,0x[0-9a-fA-F]\{16\},0x[0-9a-fA-F]\{16\}\)\?$' >/dev/null
+    echo $zfcp_arg | grep '^0\.[0-9a-fA-F]\.[0-9a-fA-F]\{4\}\(,0x[0-9a-fA-F]\{16\},0x[0-9a-fA-F]\{16\}\)\?$' > /dev/null
     test $? -ne 0 && die "For argument 'rd.zfcp=$zfcp_arg'\nSorry, invalid format."
     (
         IFS=","
index 5ffc9e4011acad814bb17377074d6715215ea531..9c5450aba64be25f4e76c44b0e94e91cc7f3780a 100755 (executable)
@@ -4,7 +4,10 @@
 cmdline() {
     is_zfcp() {
         local _dev=$1
-        local _devpath=$(cd -P /sys/dev/block/$_dev ; echo $PWD)
+        local _devpath=$(
+            cd -P /sys/dev/block/$_dev
+            echo $PWD
+        )
         local _sdev _scsiid _hostno _lun _wwpn _ccw _port_type
         local _allow_lun_scan _is_npiv
 
@@ -22,7 +25,7 @@ cmdline() {
                 ;;
         esac
         _ccw=$(cat ${_sdev}/hba_id)
-        if [ "$_is_npiv" ] && [ "$_allow_lun_scan" = "Y" ] ; then
+        if [ "$_is_npiv" ] && [ "$_allow_lun_scan" = "Y" ]; then
             echo "rd.zfcp=${_ccw}"
         else
             _lun=$(cat ${_sdev}/fcp_lun)
@@ -45,9 +48,9 @@ check() {
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
         found=0
-        for _ccw in /sys/bus/ccw/devices/*/host* ; do
+        for _ccw in /sys/bus/ccw/devices/*/host*; do
             [ -d "$_ccw" ] || continue
-            found=$(($found+1));
+            found=$(($found + 1))
         done
         [ $found -eq 0 ] && return 255
     }
@@ -63,14 +66,14 @@ depends() {
 install() {
     inst_multiple /usr/lib/udev/collect
     inst_hook cmdline 30 "$moddir/parse-zfcp.sh"
-    if [[ $hostonly_cmdline == "yes" ]] ; then
+    if [[ $hostonly_cmdline == "yes" ]]; then
         local _zfcp
 
-        for _zfcp in $(cmdline) ; do
+        for _zfcp in $(cmdline); do
             printf "%s\n" "$_zfcp" >> "${initdir}/etc/cmdline.d/94zfcp.conf"
         done
     fi
-    if [[ $hostonly ]] ; then
+    if [[ $hostonly ]]; then
         inst_rules_wildcard 51-zfcp-*.rules
         inst_rules_wildcard 41-s390x-zfcp-*.rules
     fi
index 825ca9554a6065706c722e614e779fa7054dab61..66e9132e02abc193d1abe2aa5d7826db6d1e4e83 100755 (executable)
@@ -7,23 +7,23 @@ create_udev_rule() {
     local _rule=/etc/udev/rules.d/51-zfcp-${ccw}.rules
     local _cu_type _dev_type
 
-    if [ -x /sbin/cio_ignore ] && cio_ignore -i $ccw > /dev/null ; then
+    if [ -x /sbin/cio_ignore ] && cio_ignore -i $ccw > /dev/null; then
         cio_ignore -r $ccw
     fi
 
-    if [ -e /sys/bus/ccw/devices/${ccw} ] ; then
+    if [ -e /sys/bus/ccw/devices/${ccw} ]; then
         read _cu_type < /sys/bus/ccw/devices/${ccw}/cutype
         read _dev_type < /sys/bus/ccw/devices/${ccw}/devtype
     fi
-    if [ "$_cu_type" != "1731/03" ] ; then
-        return 0;
+    if [ "$_cu_type" != "1731/03" ]; then
+        return 0
     fi
-    if [ "$_dev_type" != "1732/03" ] && [ "$_dev_type" != "1732/04" ] ; then
-        return 0;
+    if [ "$_dev_type" != "1732/03" ] && [ "$_dev_type" != "1732/04" ]; then
+        return 0
     fi
 
-    if [ ! -f "$_rule" ] ; then
-        cat > $_rule <<EOF
+    if [ ! -f "$_rule" ]; then
+        cat > $_rule << EOF
 ACTION=="add", SUBSYSTEM=="ccw", KERNEL=="$ccw", IMPORT{program}="collect $ccw %k ${ccw} zfcp"
 ACTION=="add", SUBSYSTEM=="drivers", KERNEL=="zfcp", IMPORT{program}="collect $ccw %k ${ccw} zfcp"
 ACTION=="add", ENV{COLLECT_$ccw}=="0", ATTR{[ccw/$ccw]online}="1"
@@ -31,18 +31,18 @@ EOF
     fi
     [ -z "$wwpn" ] || [ -z "$lun" ] && return
     m=$(sed -n "/.*${wwpn}.*${lun}.*/p" $_rule)
-    if [ -z "$m" ] ; then
-        cat >> $_rule <<EOF
+    if [ -z "$m" ]; then
+        cat >> $_rule << EOF
 ACTION=="add", KERNEL=="rport-*", ATTR{port_name}=="$wwpn", SUBSYSTEMS=="ccw", KERNELS=="$ccw", ATTR{[ccw/$ccw]$wwpn/unit_add}="$lun"
 EOF
     fi
-    if [ -x /sbin/cio_ignore ] && ! cio_ignore -i $ccw > /dev/null ; then
+    if [ -x /sbin/cio_ignore ] && ! cio_ignore -i $ccw > /dev/null; then
         cio_ignore -r $ccw
     fi
 }
 
-if [[ -f /sys/firmware/ipl/ipl_type &&
-            $(</sys/firmware/ipl/ipl_type) = "fcp" ]] ; then
+if [[ -f /sys/firmware/ipl/ipl_type && \
+    $(< /sys/firmware/ipl/ipl_type) = "fcp" ]]; then
     (
         _wwpn=$(cat /sys/firmware/ipl/wwpn)
         _lun=$(cat /sys/firmware/ipl/lun)
@@ -69,7 +69,7 @@ for zfcp_arg in $(getargs root=) $(getargs resume=); do
                 ccw_arg=${zfcp_arg##*/}
                 ;;
         esac
-        if [ -n "$ccw_arg" ] ; then
+        if [ -n "$ccw_arg" ]; then
             OLDIFS="$IFS"
             IFS="-"
             set -- $ccw_arg
index 89341c02cc65f7c132d4aec681cda7b0e753ca35..ba5f25844ca5de95f9f708607a1df7fe359358ac 100755 (executable)
@@ -26,4 +26,3 @@ install() {
     inst_rules 81-ccw.rules
     inst_multiple znet_cio_free grep sed seq readlink /lib/udev/ccw_init
 }
-
index 8e57571d8a9adfc5fc9a03b491c8d2d1e5b8b379..2493c1d8ae2383e3daaac7d914b010aceaf33944 100755 (executable)
@@ -3,6 +3,6 @@
 SECURITYFSDIR="/sys/kernel/security"
 export SECURITYFSDIR
 
-if ! findmnt "${SECURITYFSDIR}" >/dev/null 2>&1; then
-   mount -t securityfs -o nosuid,noexec,nodev securityfs ${SECURITYFSDIR} >/dev/null 2>&1
+if ! findmnt "${SECURITYFSDIR}" > /dev/null 2>&1; then
+    mount -t securityfs -o nosuid,noexec,nodev securityfs ${SECURITYFSDIR} > /dev/null 2>&1
 fi
index 8a2550a8a60bd8e8a17d4a98e9dca64e0322ccaa..c10200dc6c7493419baff4911494112de8ecc2d5 100755 (executable)
@@ -17,4 +17,3 @@ install() {
     inst_multiple biosdevname
     inst_rules 71-biosdevname.rules
 }
-
index 47da36f52b304ba8560f567d8d7b3d77d201f2c1..452873fe6a5e3e92e17f0dacf6e205a5ad81e227 100755 (executable)
@@ -8,4 +8,3 @@ else
     info "biosdevname=1: activating biosdevname network renaming"
     udevproperty UDEV_BIOSDEVNAME=1
 fi
-
index 53aa20e777cc2c989e0012813078359f96a57bb6..9f3fb52b667ceffabf166cc5aa981ac62ade66c0 100755 (executable)
@@ -10,27 +10,26 @@ MASTERKEYSCONFIG="${NEWROOT}/etc/sysconfig/masterkey"
 MULTIKERNELMODE="NO"
 PCRLOCKNUM=11
 
-load_masterkey()
-{
+load_masterkey() {
     # read the configuration from the config file
-    [ -f "${MASTERKEYSCONFIG}" ] && \
-        . ${MASTERKEYSCONFIG}
+    [ -f "${MASTERKEYSCONFIG}" ] \
+        && . ${MASTERKEYSCONFIG}
 
     # override the kernel master key path name from the 'masterkey=' parameter
     # in the kernel command line
     MASTERKEYARG=$(getarg masterkey=)
-    [ $? -eq 0 ] && \
-        MASTERKEY=${MASTERKEYARG}
+    [ $? -eq 0 ] \
+        && MASTERKEY=${MASTERKEYARG}
 
     # override the kernel master key type from the 'masterkeytype=' parameter
     # in the kernel command line
     MASTERKEYTYPEARG=$(getarg masterkeytype=)
-    [ $? -eq 0 ] && \
-        MASTERKEYTYPE=${MASTERKEYTYPEARG}
+    [ $? -eq 0 ] \
+        && MASTERKEYTYPE=${MASTERKEYTYPEARG}
 
     # set default values
-    [ -z "${MASTERKEYTYPE}" ] && \
-        MASTERKEYTYPE="trusted"
+    [ -z "${MASTERKEYTYPE}" ] \
+        && MASTERKEYTYPE="trusted"
 
     if [ -z "${MASTERKEY}" ]; then
         # append the kernel version to the default masterkey path name
@@ -57,14 +56,14 @@ load_masterkey()
     KEYBLOB=$(cat ${MASTERKEYPATH})
 
     # add the 'load' prefix if the key type is 'trusted'
-    [ "${MASTERKEYTYPE}" = "trusted" ] && \
-        KEYBLOB="load ${KEYBLOB} pcrlock=${PCRLOCKNUM}"
+    [ "${MASTERKEYTYPE}" = "trusted" ] \
+        && KEYBLOB="load ${KEYBLOB} pcrlock=${PCRLOCKNUM}"
 
     # load the kernel master key
     info "Loading the kernel master key"
-    keyctl add "${MASTERKEYTYPE}" "kmk-${MASTERKEYTYPE}" "${KEYBLOB}" @u >/dev/null || {
-        info "masterkey: failed to load the kernel master key: kmk-${MASTERKEYTYPE}";
-        return 1;
+    keyctl add "${MASTERKEYTYPE}" "kmk-${MASTERKEYTYPE}" "${KEYBLOB}" @u > /dev/null || {
+        info "masterkey: failed to load the kernel master key: kmk-${MASTERKEYTYPE}"
+        return 1
     }
 
     return 0
index fd64a68dce18e6f6a8dfdd29e486ec7d224b0dc6..f86af4a3cfe85be1ce17687118f5c18596155105 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 getarg "rd.cmdline=ask" || exit 0
 
index ac3f2607579a2a9c91fb8f14bcc4a7f9fbd9f9e9..a963d9d9697aec8ebb6b3f1b764b060a2cf7e577 100755 (executable)
@@ -1,9 +1,9 @@
 #!/bin/sh
 
 if [ -f /dracut-state.sh ]; then
-    . /dracut-state.sh 2>/dev/null
+    . /dracut-state.sh 2> /dev/null
 fi
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 [ -f /usr/lib/initrd-release ] && . /usr/lib/initrd-release
 [ -n "$VERSION" ] && info "dracut-$VERSION"
@@ -52,13 +52,16 @@ source_hook cmdline
 case "${root#block:}${root_unset}" in
     LABEL=* | UUID=* | PARTUUID=* | PARTLABEL=*)
         root="block:$(label_uuid_to_dev "$root")"
-        rootok=1 ;;
+        rootok=1
+        ;;
     /dev/*)
         root="block:${root}"
-        rootok=1 ;;
-    UNSET|gpt-auto|tmpfs)
+        rootok=1
+        ;;
+    UNSET | gpt-auto | tmpfs)
         # systemd's gpt-auto-generator/fstab-generator handles this case.
-        rootok=1 ;;
+        rootok=1
+        ;;
 esac
 
 [ -z "${root}${root_unset}" ] && die "Empty root= argument"
index 864f13ba4f4d213ababea017f2e3e8b0190b6058..b18962a9de12d5f91e2ac6992fe1b35ece90b75a 100755 (executable)
@@ -2,13 +2,13 @@
 
 export DRACUT_SYSTEMD=1
 if [ -f /dracut-state.sh ]; then
-    . /dracut-state.sh 2>/dev/null
+    . /dracut-state.sh 2> /dev/null
 fi
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 source_conf /etc/conf.d
 
-type plymouth >/dev/null 2>&1 && plymouth quit
+type plymouth > /dev/null 2>&1 && plymouth quit
 
 export _rdshell_name="dracut" action="Boot" hook="emergency"
 _emergency_action=$(getarg rd.emergency)
@@ -46,11 +46,14 @@ fi
 
 case "$_emergency_action" in
     reboot)
-        reboot || exit 1;;
+        reboot || exit 1
+        ;;
     poweroff)
-        poweroff || exit 1;;
+        poweroff || exit 1
+        ;;
     halt)
-        halt || exit 1;;
+        halt || exit 1
+        ;;
 esac
 
 exit 0
index 89225995ba2a7c7b63c864c61a7636b0cdb9ea36..e20901b62921aa291573628a8d08b56a7a685c8e 100755 (executable)
@@ -2,9 +2,9 @@
 
 export DRACUT_SYSTEMD=1
 if [ -f /dracut-state.sh ]; then
-    . /dracut-state.sh 2>/dev/null
+    . /dracut-state.sh 2> /dev/null
 fi
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 source_conf /etc/conf.d
 
@@ -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
@@ -37,7 +37,7 @@ while :; do
         check_finished && break 2
     done
 
-    udevadm settle --timeout=0 >/dev/null 2>&1 || continue
+    udevadm settle --timeout=0 > /dev/null 2>&1 || continue
 
     for job in $hookdir/initqueue/settled/*.sh; do
         [ -e "$job" ] || break
@@ -45,7 +45,7 @@ while :; do
         check_finished && break 2
     done
 
-    udevadm settle --timeout=0 >/dev/null 2>&1 || continue
+    udevadm settle --timeout=0 > /dev/null 2>&1 || continue
 
     # no more udev jobs and queues empty.
     sleep 0.5
@@ -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")\""
@@ -64,16 +64,16 @@ while :; do
             for job in $hookdir/initqueue/timeout/*.sh; do
                 [ -e "$job" ] || break
                 job=$job . $job
-                udevadm settle --timeout=0 >/dev/null 2>&1 || main_loop=0
+                udevadm settle --timeout=0 > /dev/null 2>&1 || main_loop=0
                 [ -f $hookdir/initqueue/work ] && main_loop=0
                 [ $main_loop -eq 0 ] && break
             done
         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
+        if ! [ -f /sysroot/etc/fstab ] || ! [ -e /sysroot/sbin/init ]; then
             emergency_shell "Could not boot."
         fi
         warn "Not all disks have been found."
index c4febfeb1eb0e726a9ad922e36b5056cc8d12ee6..cd76a1fa25a2a4dd7b361931a772d138d8dde35a 100755 (executable)
@@ -1,9 +1,9 @@
 #!/bin/sh
 export DRACUT_SYSTEMD=1
 if [ -f /dracut-state.sh ]; then
-    . /dracut-state.sh 2>/dev/null
+    . /dracut-state.sh 2> /dev/null
 fi
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 source_conf /etc/conf.d
 
@@ -15,20 +15,20 @@ getarg 'rd.break=mount' -d 'rdbreak=mount' && emergency_shell -n mount "Break mo
 i=0
 while :; do
     if ismounted "$NEWROOT"; then
-        usable_root "$NEWROOT" && break;
+        usable_root "$NEWROOT" && break
         umount "$NEWROOT"
     fi
     for f in $hookdir/mount/*.sh; do
         [ -f "$f" ] && . "$f"
         if ismounted "$NEWROOT"; then
-            usable_root "$NEWROOT" && break;
+            usable_root "$NEWROOT" && break
             warn "$NEWROOT has no proper rootfs layout, ignoring and removing offending mount hook"
             umount "$NEWROOT"
             rm -f -- "$f"
         fi
     done
 
-    i=$(($i+1))
+    i=$(($i + 1))
     [ $i -gt 20 ] && emergency_shell "Can't mount root filesystem"
 done
 
index ae5112861f1d2f23f6981db5b3c43bb6f035aa0a..7932084fd65ad6cfba58b5b122a2efdbaef80f8f 100755 (executable)
@@ -2,9 +2,9 @@
 
 export DRACUT_SYSTEMD=1
 if [ -f /dracut-state.sh ]; then
-    . /dracut-state.sh 2>/dev/null
+    . /dracut-state.sh 2> /dev/null
 fi
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 source_conf /etc/conf.d
 
index cc70e3c3498a20e2702b05b692abe3ac8946ae40..0e4df68288a032decdb78e5c2b2daa18661e61d0 100755 (executable)
@@ -2,9 +2,9 @@
 
 export DRACUT_SYSTEMD=1
 if [ -f /dracut-state.sh ]; then
-    . /dracut-state.sh 2>/dev/null
+    . /dracut-state.sh 2> /dev/null
 fi
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 source_conf /etc/conf.d
 
@@ -18,8 +18,8 @@ source_hook pre-pivot
 getarg 'rd.break=cleanup' 'rdbreak=cleanup' && emergency_shell -n cleanup "Break cleanup"
 source_hook cleanup
 
-_bv=$(getarg rd.break -d rdbreak) && [ -z "$_bv" ] &&
-    emergency_shell -n switch_root "Break before switch_root"
+_bv=$(getarg rd.break -d rdbreak) && [ -z "$_bv" ] \
+    && emergency_shell -n switch_root "Break before switch_root"
 unset _bv
 
 # remove helper symlink
index a1a33960c0f8b19d03d4c604a7954dd858d68f9c..8d707b9b7fe7ac970d5bcef3128fe09c144827ae 100755 (executable)
@@ -2,9 +2,9 @@
 
 export DRACUT_SYSTEMD=1
 if [ -f /dracut-state.sh ]; then
-    . /dracut-state.sh 2>/dev/null
+    . /dracut-state.sh 2> /dev/null
 fi
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 source_conf /etc/conf.d
 
@@ -14,7 +14,7 @@ source_hook pre-trigger
 
 getarg 'rd.break=pre-trigger' 'rdbreak=pre-trigger' && emergency_shell -n pre-trigger "Break pre-trigger"
 
-udevadm control --reload >/dev/null 2>&1 || :
+udevadm control --reload > /dev/null 2>&1 || :
 
 export -p > /dracut-state.sh
 
index ca130482c2ff88b822902d83d4434133f586ebed..2a9336edf700c73fba2fae559ab2cac3f9ce38be 100755 (executable)
@@ -1,9 +1,9 @@
 #!/bin/sh
 export DRACUT_SYSTEMD=1
 if [ -f /dracut-state.sh ]; then
-    . /dracut-state.sh 2>/dev/null
+    . /dracut-state.sh 2> /dev/null
 fi
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 source_conf /etc/conf.d
 
@@ -14,11 +14,11 @@ getarg 'rd.break=pre-udev' 'rdbreak=pre-udev' && emergency_shell -n pre-udev "Br
 source_hook pre-udev
 
 _modprobe_d=/etc/modprobe.d
-if [ -d /usr/lib/modprobe.d ] ; then
+if [ -d /usr/lib/modprobe.d ]; then
     _modprobe_d=/usr/lib/modprobe.d
-elif [ -d /lib/modprobe.d ] ; then
+elif [ -d /lib/modprobe.d ]; then
     _modprobe_d=/lib/modprobe.d
-elif [ ! -d $_modprobe_d ] ; then
+elif [ ! -d $_modprobe_d ]; then
     mkdir -p $_modprobe_d
 fi
 
@@ -31,20 +31,19 @@ for i in $(getargs rd.driver.pre -d rdloaddriver=); do
     )
 done
 
-
 [ -d /etc/modprobe.d ] || mkdir -p /etc/modprobe.d
 
 for i in $(getargs rd.driver.blacklist -d rdblacklist=); do
     (
         IFS=,
         for p in $i; do
-            echo "blacklist $p" >>  $_modprobe_d/initramfsblacklist.conf
+            echo "blacklist $p" >> $_modprobe_d/initramfsblacklist.conf
         done
     )
 done
 
 for p in $(getargs rd.driver.post -d rdinsmodpost=); do
-    echo "blacklist $p" >>  $_modprobe_d/initramfsblacklist.conf
+    echo "blacklist $p" >> $_modprobe_d/initramfsblacklist.conf
     _do_insmodpost=1
 done
 
index e0adf992d37d3085cb466c9e40d901b97fe62b11..7166e9c1e098c25ce0e4838ac6e7b166ca73e680 100755 (executable)
@@ -56,4 +56,3 @@ install() {
 
     inst_multiple sulogin
 }
-
index a9fef9c90de6755fdd8671323c5f5bd16e6325d4..c3a992df7f62ba00719746ceed417f94fcce47a7 100755 (executable)
@@ -1,9 +1,8 @@
 #!/bin/sh
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
-generator_wait_for_dev()
-{
+generator_wait_for_dev() {
     local _name
     local _timeout
 
@@ -44,8 +43,7 @@ EOF
     fi
 }
 
-generator_mount_rootfs()
-{
+generator_mount_rootfs() {
     local _type=$2
     local _flags=$3
     local _name
@@ -73,8 +71,7 @@ generator_mount_rootfs()
     fi
 }
 
-generator_fsck_after_pre_mount()
-{
+generator_fsck_after_pre_mount() {
     local _name
 
     [ -z "$1" ] && return 0
@@ -94,20 +91,22 @@ root=$(getarg root=)
 case "${root#block:}" in
     LABEL=* | UUID=* | PARTUUID=* | PARTLABEL=*)
         root="block:$(label_uuid_to_dev "$root")"
-        rootok=1 ;;
+        rootok=1
+        ;;
     /dev/nfs) # ignore legacy /dev/nfs
         ;;
     /dev/*)
         root="block:${root}"
-        rootok=1 ;;
+        rootok=1
+        ;;
 esac
 
 GENERATOR_DIR="$1"
 
-if [ "$rootok" = "1"  ]; then
-   generator_wait_for_dev "${root#block:}" "$RDRETRY"
-   generator_fsck_after_pre_mount "${root#block:}"
-   strstr "$(cat /proc/cmdline)" 'root=' || generator_mount_rootfs "${root#block:}" "$(getarg rootfstype=)" "$(getarg rootflags=)"
+if [ "$rootok" = "1" ]; then
+    generator_wait_for_dev "${root#block:}" "$RDRETRY"
+    generator_fsck_after_pre_mount "${root#block:}"
+    strstr "$(cat /proc/cmdline)" 'root=' || generator_mount_rootfs "${root#block:}" "$(getarg rootfstype=)" "$(getarg rootflags=)"
 fi
 
 exit 0
index ed45dbcd334be55dea9a21b075f18be4db15f63d..a916a1f1d466ca79b5e803e513eb4de9afa63352 100755 (executable)
@@ -13,17 +13,16 @@ ECRYPTFSKEYID=""
 ECRYPTFSSRCDIR="/secret"
 ECRYPTFS_EXTRA_MOUNT_OPTS=""
 
-load_ecryptfs_key()
-{
+load_ecryptfs_key() {
     # override the eCryptfs key path name from the 'ecryptfskey=' parameter in the kernel
     # command line
     ECRYPTFSKEYARG=$(getarg ecryptfskey=)
-    [ $? -eq 0 ] && \
-        ECRYPTFSKEY=${ECRYPTFSKEYARG}
+    [ $? -eq 0 ] \
+        && ECRYPTFSKEY=${ECRYPTFSKEYARG}
 
     # set the default value
-    [ -z "${ECRYPTFSKEY}" ] && \
-        ECRYPTFSKEY="/etc/keys/ecryptfs-trusted.blob";
+    [ -z "${ECRYPTFSKEY}" ] \
+        && ECRYPTFSKEY="/etc/keys/ecryptfs-trusted.blob"
 
     # set the eCryptfs key path name
     ECRYPTFSKEYPATH="${NEWROOT}${ECRYPTFSKEY}"
@@ -42,36 +41,34 @@ load_ecryptfs_key()
     # load the eCryptfs encrypted key blob
     ECRYPTFSKEYID=$(keyctl add ${ECRYPTFSKEYTYPE} ${ECRYPTFSKEYDESC} "load ${KEYBLOB}" @u)
     [ $? -eq 0 ] || {
-        info "eCryptfs: failed to load the eCryptfs key: ${ECRYPTFSKEYDESC}";
-        return 1;
+        info "eCryptfs: failed to load the eCryptfs key: ${ECRYPTFSKEYDESC}"
+        return 1
     }
 
     return 0
 }
 
-unload_ecryptfs_key()
-{
+unload_ecryptfs_key() {
     # unlink the eCryptfs encrypted key
     keyctl unlink ${ECRYPTFSKEYID} @u || {
-        info "eCryptfs: failed to unlink the eCryptfs key: ${ECRYPTFSKEYDESC}";
-        return 1;
+        info "eCryptfs: failed to unlink the eCryptfs key: ${ECRYPTFSKEYDESC}"
+        return 1
     }
 
     return 0
 }
 
-mount_ecryptfs()
-{
+mount_ecryptfs() {
     # read the configuration from the config file
-    [ -f "${ECRYPTFSCONFIG}" ] && \
-        . ${ECRYPTFSCONFIG}
+    [ -f "${ECRYPTFSCONFIG}" ] \
+        && . ${ECRYPTFSCONFIG}
 
     # load the eCryptfs encrypted key
     load_ecryptfs_key || return 1
 
     # set the default value for ECRYPTFSDSTDIR
-    [ -z "${ECRYPTFSDSTDIR}" ] && \
-        ECRYPTFSDSTDIR=${ECRYPTFSSRCDIR}
+    [ -z "${ECRYPTFSDSTDIR}" ] \
+        && ECRYPTFSDSTDIR=${ECRYPTFSSRCDIR}
 
     # set the eCryptfs filesystem mount point
     ECRYPTFSSRCMNT="${NEWROOT}${ECRYPTFSSRCDIR}"
@@ -79,14 +76,14 @@ mount_ecryptfs()
 
     # build the mount options variable
     ECRYPTFS_MOUNT_OPTS="ecryptfs_sig=${ECRYPTFSKEYDESC}"
-    [ ! -z "${ECRYPTFS_EXTRA_MOUNT_OPTS}" ] && \
-        ECRYPTFS_MOUNT_OPTS="${ECRYPTFS_MOUNT_OPTS},${ECRYPTFS_EXTRA_MOUNT_OPTS}"
+    [ ! -z "${ECRYPTFS_EXTRA_MOUNT_OPTS}" ] \
+        && ECRYPTFS_MOUNT_OPTS="${ECRYPTFS_MOUNT_OPTS},${ECRYPTFS_EXTRA_MOUNT_OPTS}"
 
     # mount the eCryptfs filesystem
     info "Mounting the configured eCryptfs filesystem"
-    mount -i -t ecryptfs -o${ECRYPTFS_MOUNT_OPTS} ${ECRYPTFSSRCMNT} ${ECRYPTFSDSTMNT} >/dev/null || {
-        info "eCryptfs: mount of the eCryptfs filesystem failed";
-        return 1;
+    mount -i -t ecryptfs -o${ECRYPTFS_MOUNT_OPTS} ${ECRYPTFSSRCMNT} ${ECRYPTFSDSTMNT} > /dev/null || {
+        info "eCryptfs: mount of the eCryptfs filesystem failed"
+        return 1
     }
 
     # unload the eCryptfs encrypted key
index 39e13f040e7043a8e919926b1812c2a2108aed93..c359f6e3b8572be8e708008b5407a87bb474af0d 100755 (executable)
@@ -12,21 +12,20 @@ EVMKEYDESC="evm-key"
 EVMKEYTYPE="encrypted"
 EVMKEYID=""
 
-load_evm_key()
-{
+load_evm_key() {
     # read the configuration from the config file
-    [ -f "${EVMCONFIG}" ] && \
-        . ${EVMCONFIG}
+    [ -f "${EVMCONFIG}" ] \
+        && . ${EVMCONFIG}
 
     # override the EVM key path name from the 'evmkey=' parameter in the kernel
     # command line
     EVMKEYARG=$(getarg evmkey=)
-    [ $? -eq 0 ] && \
-        EVMKEY=${EVMKEYARG}
+    [ $? -eq 0 ] \
+        && EVMKEY=${EVMKEYARG}
 
     # set the default value
-    [ -z "${EVMKEY}" ] && \
-        EVMKEY="/etc/keys/evm-trusted.blob";
+    [ -z "${EVMKEY}" ] \
+        && EVMKEY="/etc/keys/evm-trusted.blob"
 
     # set the EVM key path name
     EVMKEYPATH="${NEWROOT}${EVMKEY}"
@@ -45,25 +44,24 @@ load_evm_key()
     # load the EVM encrypted key
     EVMKEYID=$(keyctl add ${EVMKEYTYPE} ${EVMKEYDESC} "load ${KEYBLOB}" @u)
     [ $? -eq 0 ] || {
-        info "integrity: failed to load the EVM encrypted key: ${EVMKEYDESC}";
-        return 1;
+        info "integrity: failed to load the EVM encrypted key: ${EVMKEYDESC}"
+        return 1
     }
     return 0
 }
 
-load_evm_x509()
-{
+load_evm_x509() {
     info "Load EVM IMA X509"
 
     # override the EVM key path name from the 'evmx509=' parameter in
     # the kernel command line
     EVMX509ARG=$(getarg evmx509=)
-    [ $? -eq 0 ] && \
-        EVMX509=${EVMX509ARG}
+    [ $? -eq 0 ] \
+        && EVMX509=${EVMX509ARG}
 
     # set the default value
-    [ -z "${EVMX509}" ] && \
-        EVMX509="/etc/keys/x509_evm.der";
+    [ -z "${EVMX509}" ] \
+        && EVMX509="/etc/keys/x509_evm.der"
 
     # set the EVM public key path name
     EVMX509PATH="${NEWROOT}${EVMX509}"
@@ -83,18 +81,18 @@ load_evm_x509()
         evm_pubid=${line%%:*}
     else
         # look for an existing regular keyring
-        evm_pubid=`keyctl search @u keyring _evm`
+        evm_pubid=$(keyctl search @u keyring _evm)
         if [ -z "${evm_pubid}" ]; then
             # create a new regular _evm keyring
-            evm_pubid=`keyctl newring _evm @u`
+            evm_pubid=$(keyctl newring _evm @u)
         fi
     fi
 
     # load the EVM public key onto the EVM keyring
     EVMX509ID=$(evmctl import ${EVMX509PATH} ${evm_pubid})
     [ $? -eq 0 ] || {
-        info "integrity: failed to load the EVM X509 cert ${EVMX509PATH}";
-        return 1;
+        info "integrity: failed to load the EVM X509 cert ${EVMX509PATH}"
+        return 1
     }
 
     if [ "${RD_DEBUG}" = "yes" ]; then
@@ -104,19 +102,17 @@ load_evm_x509()
     return 0
 }
 
-unload_evm_key()
-{
+unload_evm_key() {
     # unlink the EVM encrypted key
     keyctl unlink ${EVMKEYID} @u || {
-        info "integrity: failed to unlink the EVM encrypted key: ${EVMKEYDESC}";
-        return 1;
+        info "integrity: failed to unlink the EVM encrypted key: ${EVMKEYDESC}"
+        return 1
     }
 
     return 0
 }
 
-enable_evm()
-{
+enable_evm() {
     # check kernel support for EVM
     if [ ! -e "${EVMSECFILE}" ]; then
         if [ "${RD_DEBUG}" = "yes" ]; then
index e142f74d9363ca37fdfdaef98e6cff8d53028f0f..04d83f10276412bcb079f8bc99f8548763961ce9 100755 (executable)
@@ -4,8 +4,7 @@ SECURITYFSDIR="/sys/kernel/security"
 IMASECDIR="${SECURITYFSDIR}/ima"
 IMACONFIG="${NEWROOT}/etc/sysconfig/ima"
 
-load_x509_keys()
-{
+load_x509_keys() {
     KEYRING_ID=$1
 
     # override the default configuration
@@ -17,7 +16,7 @@ load_x509_keys()
         IMAKEYSDIR="/etc/keys/ima"
     fi
 
-    PUBKEY_LIST=`ls ${NEWROOT}${IMAKEYSDIR}/*`
+    PUBKEY_LIST=$(ls ${NEWROOT}${IMAKEYSDIR}/*)
     for PUBKEY in ${PUBKEY_LIST}; do
         # check for public key's existence
         if [ ! -f "${PUBKEY}" ]; then
@@ -30,11 +29,11 @@ load_x509_keys()
         X509ID=$(evmctl import ${PUBKEY} ${KEYRING_ID})
         if [ $? -ne 0 ]; then
             info "integrity: IMA x509 cert not loaded on keyring: ${PUBKEY}"
-        fi 
+        fi
     done
 
     if [ "${RD_DEBUG}" = "yes" ]; then
-        keyctl show  ${KEYRING_ID}
+        keyctl show ${KEYRING_ID}
     fi
     return 0
 }
@@ -52,9 +51,9 @@ line=$(keyctl describe %keyring:.ima)
 if [ $? -eq 0 ]; then
     _ima_id=${line%%:*}
 else
-    _ima_id=`keyctl search @u keyring _ima`
+    _ima_id=$(keyctl search @u keyring _ima)
     if [ -z "${_ima_id}" ]; then
-        _ima_id=`keyctl newring _ima @u`
+        _ima_id=$(keyctl newring _ima @u)
     fi
 fi
 
index 85cd3b94ee1f88be5581c4b81cb9a1cc60e12cf1..dd78e39ad7df7ee9d97bd12f85eb6233ef182ae6 100755 (executable)
@@ -10,8 +10,7 @@ IMASECDIR="${SECURITYFSDIR}/ima"
 IMACONFIG="${NEWROOT}/etc/sysconfig/ima"
 IMAPOLICY="/etc/sysconfig/ima-policy"
 
-load_ima_policy()
-{
+load_ima_policy() {
     # check kernel support for IMA
     if [ ! -e "${IMASECDIR}" ]; then
         if [ "${RD_DEBUG}" = "yes" ]; then
@@ -21,17 +20,17 @@ load_ima_policy()
     fi
 
     # override the default configuration
-    [ -f "${IMACONFIG}" ] && \
-        . ${IMACONFIG}
+    [ -f "${IMACONFIG}" ] \
+        && . ${IMACONFIG}
 
     # set the IMA policy path name
     IMAPOLICYPATH="${NEWROOT}${IMAPOLICY}"
 
     # check the existence of the IMA policy file
     [ -f "${IMAPOLICYPATH}" ] && {
-        info "Loading the provided IMA custom policy";
-        printf '%s' "${IMAPOLICYPATH}" > ${IMASECDIR}/policy || \
-            cat "${IMAPOLICYPATH}" > ${IMASECDIR}/policy
+        info "Loading the provided IMA custom policy"
+        printf '%s' "${IMAPOLICYPATH}" > ${IMASECDIR}/policy \
+            || cat "${IMAPOLICYPATH}" > ${IMASECDIR}/policy
     }
 
     return 0
index 8c989c29b769c1506cfb8d0e8764e3459141fa92..9684181b20ac79eb31708f13d3b9ebd075f29ee8 100755 (executable)
@@ -14,4 +14,3 @@ depends() {
 install() {
     inst_hook initqueue/settled 99 "$moddir/pollcdrom.sh"
 }
-
index a7b2b9a7daa8cbae863b64037ac427c033fab96f..b3f0fb6ab09fd67e6283a20c3f2e31a53eabf81f 100755 (executable)
@@ -15,4 +15,3 @@ install() {
     inst_hook pre-pivot 50 "$moddir/selinux-loadpolicy.sh"
     inst_multiple setenforce
 }
-
index ca81a38361e187b3feee89400a2bb54c44ca495c..06640200f0f0dc5062d043e51ff77b795ab9f348 100755 (executable)
@@ -2,8 +2,7 @@
 
 # FIXME: load selinux policy.  this should really be done after we switchroot
 
-rd_load_policy()
-{
+rd_load_policy() {
     # If SELinux is disabled exit now
     getarg "selinux=0" > /dev/null && return 0
 
@@ -38,7 +37,7 @@ rd_load_policy()
         umount $NEWROOT/sys
 
         if [ "$SELINUX" = "disabled" ]; then
-            return 0;
+            return 0
         fi
 
         if [ $ret -eq 0 -o $ret -eq 2 ]; then
index 2435c4d556686589be7ec30015120f9b50402050..fdd010324e69b083fd830d20e6df8545bc96b9a8 100755 (executable)
@@ -15,12 +15,12 @@ depends() {
 install() {
     local _i
     local _installs
-    if find_binary rsyslogd >/dev/null; then
+    if find_binary rsyslogd > /dev/null; then
         _installs="rsyslogd"
         inst_libdir_file rsyslog/lmnet.so rsyslog/imklog.so rsyslog/imuxsock.so rsyslog/imjournal.so
-    elif find_binary syslogd >/dev/null; then
+    elif find_binary syslogd > /dev/null; then
         _installs="syslogd"
-    elif find_binary syslog-ng >/dev/null; then
+    elif find_binary syslog-ng > /dev/null; then
         _installs="syslog-ng"
     else
         derror "Could not find any syslog binary although the syslogmodule" \
@@ -28,7 +28,7 @@ install() {
     fi
     if [ -n "$_installs" ]; then
         inst_multiple cat $_installs
-        inst_hook cmdline  90 "$moddir/parse-syslog-opts.sh"
+        inst_hook cmdline 90 "$moddir/parse-syslog-opts.sh"
         inst_hook cleanup 99 "$moddir/syslog-cleanup.sh"
         inst_hook initqueue/online 70 "$moddir/rsyslogd-start.sh"
         inst_simple "$moddir/rsyslogd-stop.sh" /sbin/rsyslogd-stop
@@ -37,4 +37,3 @@ install() {
     fi
     dracut_need_initqueue
 }
-
index 9ec6ad472d42a56d644d088318eeb3ec07eaca58..eed080010b86a3c1fa3be29776dd8966bc2b8ee7 100755 (executable)
@@ -7,7 +7,7 @@
 #sysloglevel=level  What level has to be logged
 #syslogtype=rsyslog|syslog|syslogng
 #                   Don't auto detect syslog but set it
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 detect_syslog() {
     syslogtype=""
index 86ad50ea2fd05d11a94aa63265be430e211a827f..914669f9ac6bcb24734dfedd411b23887728a349 100755 (executable)
@@ -2,7 +2,7 @@
 
 # Triggered by initqueue/online and starts rsyslogd with bootparameters
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 # prevent starting again if already running
 if [ -f /var/run/syslogd.pid ]; then
index 52c8edf6a95d0a23d05fa413ebacc04258c86774..d810079b30911f7f9a27c39ab194a113e644c7b9 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 # Kills rsyslogd
 
index f8e66e46435dd6ff19b4af96f0cb0c07e5f48993..05cce5faf6dd0035fe44416a52c4b259877e2c7a 100755 (executable)
@@ -2,13 +2,13 @@
 
 # Just cleans up a previously started syslogd
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 if [ -f /tmp/syslog.server ]; then
     read syslogtype < /tmp/syslog.type
-    if command -v "${syslogtype}-stop" >/dev/null; then
+    if command -v "${syslogtype}-stop" > /dev/null; then
         ${syslogtype}-stop
     else
         warn "syslog-cleanup: Could not find script to stop syslog of type \"$syslogtype\". Syslog will not be stopped."
     fi
-fi
\ No newline at end of file
+fi
index 5eb068aa6e9f7cc4335fbb2aa525be750f036130..bc88deb8bb2bf10e0e0c6ef0fe4a4d6e228fd9ed 100755 (executable)
@@ -18,4 +18,3 @@ install() {
     fi
     :
 }
-
index b8da85bfa2afd65a96ba2d42130af7f47a436803..7c8fa63142b1727216d260b43143cf67decf9577 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
-type info >/dev/null 2>&1 || . /lib/dracut-lib.sh
-type fsck_single >/dev/null 2>&1 || . /lib/fs-lib.sh
+type info > /dev/null 2>&1 || . /lib/dracut-lib.sh
+type fsck_single > /dev/null 2>&1 || . /lib/fs-lib.sh
 
 filtersubvol() {
     local _oldifs
@@ -11,15 +11,14 @@ filtersubvol() {
     IFS="$_oldifs"
     while [ $# -gt 0 ]; do
         case $1 in
-            subvol\=*) :;;
+            subvol\=*) : ;;
             *) printf '%s' "${1}," ;;
         esac
         shift
     done
 }
 
-fsck_usr()
-{
+fsck_usr() {
     local _dev=$1
     local _fs=$2
     local _fsopts=$3
@@ -29,7 +28,7 @@ fsck_usr()
         _fsckoptions=$(cat "$NEWROOT"/fsckoptions)
     fi
 
-    if [ -f "$NEWROOT"/forcefsck ] || getargbool 0 forcefsck ; then
+    if [ -f "$NEWROOT"/forcefsck ] || getargbool 0 forcefsck; then
         _fsckoptions="-f $_fsckoptions"
     elif [ -f "$NEWROOT"/.autofsck ]; then
         [ -f "$NEWROOT"/etc/sysconfig/autofsck ] && . "$NEWROOT"/etc/sysconfig/autofsck
@@ -48,8 +47,7 @@ fsck_usr()
     fsck_single "$_dev" "$_fs" "$_fsopts" "$_fsckoptions"
 }
 
-mount_usr()
-{
+mount_usr() {
     local _dev _mp _fs _opts _rest _usr_found _ret _freq _passno
     # check, if we have to mount the /usr filesystem
     while read _dev _mp _fs _opts _freq _passno || [ -n "$_dev" ]; do
@@ -57,9 +55,9 @@ mount_usr()
         if [ "$_mp" = "/usr" ]; then
             _dev="$(label_uuid_to_dev "$_dev")"
 
-            if strstr "$_opts" "subvol=" && \
-                [ "${root#block:}" -ef $_dev ] && \
-                [ -n "$rflags" ]; then
+            if strstr "$_opts" "subvol=" \
+                && [ "${root#block:}" -ef $_dev ] \
+                && [ -n "$rflags" ]; then
                 # for btrfs subvolumes we have to mount /usr with the same rflags
                 rflags=$(filtersubvol "$rflags")
                 rflags=${rflags%%,}
@@ -84,7 +82,7 @@ mount_usr()
             if [ "0" != "${_passno:-0}" ]; then
                 fsck_usr "$_dev" "$_fs" "$_opts"
                 _fsck_ret=$?
-                [ $_fsck_ret -ne 255 ] && echo $_fsck_ret >/run/initramfs/usr-fsck
+                [ $_fsck_ret -ne 255 ] && echo $_fsck_ret > /run/initramfs/usr-fsck
             fi
         fi
 
index 0a53eb8b8f4923d8f53edf95d86920a66b2277ff..7999c81f9e208e993654ab6dfbf65471ece2cbb2 100755 (executable)
@@ -55,8 +55,8 @@ str_ends() {
 
 trim() {
     local var="$*"
-    var="${var#"${var%%[![:space:]]*}"}"   # remove leading whitespace characters
-    var="${var%"${var##*[![:space:]]}"}"   # remove trailing whitespace characters
+    var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
+    var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters
     printf "%s" "$var"
 }
 
@@ -71,8 +71,8 @@ if [ -z "$DRACUT_SYSTEMD" ]; then
     info() {
         check_quiet
         echo "<30>dracut: $*" > /dev/kmsg
-        [ "$DRACUT_QUIET" != "yes" ] && \
-            echo "dracut: $*" >&2 || :
+        [ "$DRACUT_QUIET" != "yes" ] \
+            && echo "dracut: $*" >&2 || :
     }
 
 else
@@ -89,13 +89,13 @@ fi
 
 vwarn() {
     while read line || [ -n "$line" ]; do
-        warn $line;
+        warn $line
     done
 }
 
 vinfo() {
     while read line || [ -n "$line" ]; do
-        info $line;
+        info $line
     done
 }
 
@@ -106,7 +106,9 @@ vinfo() {
 # example:
 # str_replace '  one two  three  ' ' ' '_'
 str_replace() {
-    local in="$1"; local s="$2"; local r="$3"
+    local in="$1"
+    local s="$2"
+    local r="$3"
     local out=''
 
     while strstr "${in}" "$s"; do
@@ -124,11 +126,11 @@ killall_proc_mountpoint() {
     for _pid in /proc/*; do
         _pid=${_pid##/proc/}
         case $_pid in
-            *[!0-9]*) continue;;
+            *[!0-9]*) continue ;;
         esac
         [ -e "/proc/$_pid/exe" ] || continue
         [ -e "/proc/$_pid/root" ] || continue
-        if strstr "$(ls -l -- "/proc/$_pid" "/proc/$_pid/fd" 2>/dev/null)" "$1" ; then
+        if strstr "$(ls -l -- "/proc/$_pid" "/proc/$_pid/fd" 2> /dev/null)" "$1"; then
             kill -9 "$_pid"
             _killed=1
         fi
@@ -146,19 +148,19 @@ getcmdline() {
 
     if [ -e /etc/cmdline ]; then
         while read -r _line || [ -n "$_line" ]; do
-            CMDLINE_ETC="$CMDLINE_ETC $_line";
-        done </etc/cmdline;
+            CMDLINE_ETC="$CMDLINE_ETC $_line"
+        done < /etc/cmdline
     fi
     for _i in /etc/cmdline.d/*.conf; do
         [ -e "$_i" ] || continue
         while read -r _line || [ -n "$_line" ]; do
-            CMDLINE_ETC_D="$CMDLINE_ETC_D $_line";
-        done <"$_i";
+            CMDLINE_ETC_D="$CMDLINE_ETC_D $_line"
+        done < "$_i"
     done
     if [ -e /proc/cmdline ]; then
         while read -r _line || [ -n "$_line" ]; do
             CMDLINE_PROC="$CMDLINE_PROC $_line"
-        done </proc/cmdline;
+        done < /proc/cmdline
     fi
     CMDLINE="$CMDLINE_ETC_D $CMDLINE_ETC $CMDLINE_PROC"
     printf "%s" "$CMDLINE"
@@ -171,8 +173,12 @@ getarg() {
     export CMDLINE
     while [ $# -gt 0 ]; do
         case $1 in
-            -d) _deprecated=1; shift;;
-            -y) if dracut-getarg "$2" >/dev/null; then
+            -d)
+                _deprecated=1
+                shift
+                ;;
+            -y)
+                if dracut-getarg "$2" > /dev/null; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
                     fi
@@ -181,9 +187,11 @@ getarg() {
                     return 0
                 fi
                 _deprecated=0
-                shift 2;;
-            -n) if dracut-getarg "$2" >/dev/null; then
-                    echo 0;
+                shift 2
+                ;;
+            -n)
+                if dracut-getarg "$2" > /dev/null; then
+                    echo 0
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
                     fi
@@ -191,8 +199,10 @@ getarg() {
                     return 1
                 fi
                 _deprecated=0
-                shift 2;;
-            *)  if [ -z "$_newoption" ]; then
+                shift 2
+                ;;
+            *)
+                if [ -z "$_newoption" ]; then
                     _newoption="$1"
                 fi
                 if dracut-getarg "$1"; then
@@ -200,10 +210,11 @@ getarg() {
                         [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
                     fi
                     debug_on
-                    return 0;
+                    return 0
                 fi
                 _deprecated=0
-                shift;;
+                shift
+                ;;
         esac
     done
     debug_on
@@ -221,7 +232,8 @@ getargbool() {
     local _b
     unset _b
     local _default
-    _default="$1"; shift
+    _default="$1"
+    shift
     _b=$(getarg "$@")
     [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
     if [ -n "$_b" ]; then
@@ -234,7 +246,7 @@ getargbool() {
 
 isdigit() {
     case "$1" in
-        *[!0-9]*|"") return 1;;
+        *[!0-9]* | "") return 1 ;;
     esac
 
     return 0
@@ -249,14 +261,17 @@ getargnum() {
     local _b
     unset _b
     local _default _min _max
-    _default="$1"; shift
-    _min="$1"; shift
-    _max="$1"; shift
+    _default="$1"
+    shift
+    _min="$1"
+    shift
+    _max="$1"
+    shift
     _b=$(getarg "$1")
     [ $? -ne 0 -a -z "$_b" ] && _b=$_default
     if [ -n "$_b" ]; then
-        isdigit "$_b" && _b=$(($_b)) && \
-          [ $_b -ge $_min ] && [ $_b -le $_max ] && echo $_b && return
+        isdigit "$_b" && _b=$(($_b)) \
+            && [ $_b -ge $_min ] && [ $_b -le $_max ] && echo $_b && return
     fi
     echo $_default
 }
@@ -294,10 +309,9 @@ getargs() {
         return 0
     fi
     debug_on
-    return 1;
+    return 1
 }
 
-
 # Prints value of given option.  If option is a flag and it's present,
 # it just returns 0.  Otherwise 1 is returned.
 # $1 = options separated by commas
@@ -309,7 +323,9 @@ getargs() {
 # Output:
 # sha256
 getoptcomma() {
-    local line=",$1,"; local opt="$2"; local tmp
+    local line=",$1,"
+    local opt="$2"
+    local tmp
 
     case "${line}" in
         *,${opt}=*,*)
@@ -317,7 +333,7 @@ getoptcomma() {
             echo "${tmp%%,*}"
             return 0
             ;;
-        *,${opt},*) return 0;;
+        *,${opt},*) return 0 ;;
     esac
     return 1
 }
@@ -337,7 +353,9 @@ getoptcomma() {
 # TODO: ':' inside fields.
 splitsep() {
     debug_off
-    local sep="$1"; local str="$2"; shift 2
+    local sep="$1"
+    local str="$2"
+    shift 2
     local tmp
 
     while [ -n "$str" -a "$#" -gt 1 ]; do
@@ -359,9 +377,9 @@ setdebug() {
             RD_DEBUG=no
             if getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then
                 RD_DEBUG=yes
-                [ -n "$BASH" ] && \
-                    export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): ';
-           fi
+                [ -n "$BASH" ] \
+                    && export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): '
+            fi
         fi
         export RD_DEBUG
     fi
@@ -373,8 +391,9 @@ setdebug
 source_all() {
     local f
     local _dir
-    _dir=$1; shift
-    [ "$_dir" ] && [  -d "/$_dir" ] || return
+    _dir=$1
+    shift
+    [ "$_dir" ] && [ -d "/$_dir" ] || return
     for f in "/$_dir"/*.sh; do [ -e "$f" ] && . "$f" "$@"; done
 }
 
@@ -383,7 +402,8 @@ export hookdir
 
 source_hook() {
     local _dir
-    _dir=$1; shift
+    _dir=$1
+    shift
     source_all "/lib/dracut/hooks/$_dir" "$@"
 }
 
@@ -391,26 +411,26 @@ check_finished() {
     local f
     for f in $hookdir/initqueue/finished/*.sh; do
         [ "$f" = "$hookdir/initqueue/finished/*.sh" ] && return 0
-        { [ -e "$f" ] && ( . "$f" ) ; } || return 1
+        { [ -e "$f" ] && (. "$f"); } || return 1
     done
     return 0
 }
 
 source_conf() {
     local f
-    [ "$1" ] && [  -d "/$1" ] || return
+    [ "$1" ] && [ -d "/$1" ] || return
     for f in "/$1"/*.conf; do [ -e "$f" ] && . "$f"; done
 }
 
 die() {
     {
-        echo "<24>dracut: FATAL: $*";
-        echo "<24>dracut: Refusing to continue";
+        echo "<24>dracut: FATAL: $*"
+        echo "<24>dracut: Refusing to continue"
     } > /dev/kmsg
 
     {
-        echo "warn dracut: FATAL: \"$*\"";
-        echo "warn dracut: Refusing to continue";
+        echo "warn dracut: FATAL: \"$*\""
+        echo "warn dracut: Refusing to continue"
     } >> $hookdir/emergency/01-die.sh
     [ -d /run/initramfs ] || mkdir -p -- /run/initramfs
 
@@ -441,7 +461,6 @@ check_quiet() {
     fi
 }
 
-
 check_occurances() {
     # Count the number of times the character $ch occurs in $str
     # Return 0 if the count matches the expected number, 1 otherwise
@@ -452,7 +471,7 @@ check_occurances() {
 
     while [ "${str#*$ch}" != "${str}" ]; do
         str="${str#*$ch}"
-        count=$(( $count + 1 ))
+        count=$(($count + 1))
     done
 
     [ $count -eq $expected ]
@@ -460,12 +479,12 @@ check_occurances() {
 
 incol2() {
     debug_off
-    local dummy check;
-    local file="$1";
-    local str="$2";
+    local dummy check
+    local file="$1"
+    local str="$2"
 
-    [ -z "$file" ] && return 1;
-    [ -z "$str"  ] && return 1;
+    [ -z "$file" ] && return 1
+    [ -z "$str" ] && return 1
 
     while read dummy check restofline || [ -n "$check" ]; do
         if [ "$check" = "$str" ]; then
@@ -508,7 +527,7 @@ find_mount() {
 
 # usage: ismounted <mountpoint>
 # usage: ismounted /dev/<device>
-if command -v findmnt >/dev/null; then
+if command -v findmnt > /dev/null; then
     ismounted() {
         findmnt "$1" > /dev/null 2>&1
     }
@@ -537,17 +556,17 @@ fi
 # TODO: symlinks
 udevmatch() {
     case "$1" in
-    UUID=????????-????-????-????-????????????|LABEL=*|PARTLABEL=*|PARTUUID=????????-????-????-????-????????????)
-        printf 'ENV{ID_FS_%s}=="%s"' "${1%%=*}" "${1#*=}"
-        ;;
-    UUID=*)
-        printf 'ENV{ID_FS_UUID}=="%s*"' "${1#*=}"
-        ;;
-    PARTUUID=*)
-        printf 'ENV{ID_FS_PARTUUID}=="%s*"' "${1#*=}"
-        ;;
-    /dev/?*) printf -- 'KERNEL=="%s"' "${1#/dev/}" ;;
-    *) return 255 ;;
+        UUID=????????-????-????-????-???????????? | LABEL=* | PARTLABEL=* | PARTUUID=????????-????-????-????-????????????)
+            printf 'ENV{ID_FS_%s}=="%s"' "${1%%=*}" "${1#*=}"
+            ;;
+        UUID=*)
+            printf 'ENV{ID_FS_UUID}=="%s*"' "${1#*=}"
+            ;;
+        PARTUUID=*)
+            printf 'ENV{ID_FS_PARTUUID}=="%s*"' "${1#*=}"
+            ;;
+        /dev/?*) printf -- 'KERNEL=="%s"' "${1#/dev/}" ;;
+        *) return 255 ;;
     esac
 }
 
@@ -583,13 +602,14 @@ label_uuid_to_dev() {
 # # funiq /mnt cdrom
 # /mnt/cdrom2
 funiq() {
-    local dir="$1"; local prefix="$2"
+    local dir="$1"
+    local prefix="$2"
     local i=0
 
     [ -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"
@@ -600,13 +620,15 @@ funiq() {
 #
 # mkuniqdir subdir new_dir_name
 mkuniqdir() {
-    local dir="$1"; local prefix="$2"
-    local retdir; local retdir_new
+    local dir="$1"
+    local prefix="$2"
+    local retdir
+    local retdir_new
 
     [ -d "${dir}" ] || mkdir -m 0755 -p "${dir}" || return 1
 
     retdir=$(funiq "${dir}" "${prefix}") || return 1
-    until mkdir -m 0755 "${retdir}" 2>/dev/null; do
+    until mkdir -m 0755 "${retdir}" 2> /dev/null; do
         retdir_new=$(funiq "${dir}" "${prefix}") || return 1
         [ "$retdir_new" = "$retdir" ] && return 1
         retdir="$retdir_new"
@@ -622,8 +644,12 @@ mkuniqdir() {
 # copytree SRC DEST
 copytree() {
     local src="$1" dest="$2"
-    mkdir -p "$dest"; dest=$(readlink -e -q "$dest")
-    ( cd "$src"; cp -af . -t "$dest" )
+    mkdir -p "$dest"
+    dest=$(readlink -e -q "$dest")
+    (
+        cd "$src"
+        cp -af . -t "$dest"
+    )
 }
 
 # Evaluates command for UUIDs either given as arguments for this function or all
@@ -648,8 +674,12 @@ foreach_uuid_until() (
     cd /dev/disk/by-uuid
 
     [ "$1" = -p ] && local prefix="$2" && shift 2
-    local cmd="$1"; shift; local uuids_list="$*"
-    local uuid; local full_uuid; local ___
+    local cmd="$1"
+    shift
+    local uuids_list="$*"
+    local uuid
+    local full_uuid
+    local ___
 
     [ -n "${cmd}" ] || return 1
 
@@ -679,17 +709,19 @@ foreach_uuid_until() (
 #   /dev/sdb1
 #   /dev/sdf3
 devnames() {
-    local dev="$1"; local d; local names
+    local dev="$1"
+    local d
+    local names
 
     case "$dev" in
-    UUID=*)
-        dev="$(foreach_uuid_until '! blkid -U $___' "${dev#UUID=}")" \
-            && return 255
-        [ -z "$dev" ] && return 255
-        ;;
-    LABEL=*) dev="$(blkid -L "${dev#LABEL=}")" || return 255 ;;
-    /dev/?*) ;;
-    *) return 255 ;;
+        UUID=*)
+            dev="$(foreach_uuid_until '! blkid -U $___' "${dev#UUID=}")" \
+                && return 255
+            [ -z "$dev" ] && return 255
+            ;;
+        LABEL=*) dev="$(blkid -L "${dev#LABEL=}")" || return 255 ;;
+        /dev/?*) ;;
+        *) return 255 ;;
     esac
 
     for d in $dev; do
@@ -701,7 +733,6 @@ $(readlink -e -q "$d")" || return 255
 }"
 }
 
-
 usable_root() {
     local _i
 
@@ -723,13 +754,19 @@ inst_hook() {
     while [ $# -gt 0 ]; do
         case "$1" in
             --hook)
-                _hookname="/$2";shift;;
+                _hookname="/$2"
+                shift
+                ;;
             --unique)
-                _unique="yes";;
+                _unique="yes"
+                ;;
             --name)
-                _name="$2";shift;;
+                _name="$2"
+                shift
+                ;;
             *)
-                break;;
+                break
+                ;;
         esac
         shift
     done
@@ -779,7 +816,7 @@ add_mount_point() {
     local _devname="dev-$(str_replace "$1" '/' '\\x2f')"
     echo "$_dev $_mp $_fs $_fsopts 0 0" >> /etc/fstab
 
-    exec 7>/etc/udev/rules.d/99-mount-${_devname}.rules
+    exec 7> /etc/udev/rules.d/99-mount-${_devname}.rules
     echo 'SUBSYSTEM!="block", GOTO="mount_end"' >&7
     echo 'ACTION!="add|change", GOTO="mount_end"' >&7
     if [ -n "$_dev" ]; then
@@ -804,8 +841,7 @@ add_mount_point() {
 # Installs a initqueue-finished script,
 # which will cause the main loop only to exit,
 # if <mountpoint> is mounted.
-wait_for_mount()
-{
+wait_for_mount() {
     local _name
     _name="$(str_replace "$1" '/' '\\x2f')"
     printf '. /lib/dracut-lib.sh\nismounted "%s"\n' $1 \
@@ -818,11 +854,10 @@ wait_for_mount()
 
 # get a systemd-compatible unit name from a path
 # (mimicks unit_name_from_path_instance())
-dev_unit_name()
-{
+dev_unit_name() {
     local dev="$1"
 
-    if command -v systemd-escape >/dev/null; then
+    if command -v systemd-escape > /dev/null; then
         systemd-escape -p -- "$dev"
         return
     fi
@@ -847,8 +882,7 @@ dev_unit_name()
 # set_systemd_timeout_for_dev <dev>
 # Set 'rd.timeout' as the systemd timeout for <dev>
 
-set_systemd_timeout_for_dev()
-{
+set_systemd_timeout_for_dev() {
     local _name
     local _needreload
     local _noreload
@@ -867,7 +901,7 @@ set_systemd_timeout_for_dev()
         if ! [ -L ${PREFIX}/etc/systemd/system/initrd.target.wants/${_name}.device ]; then
             [ -d ${PREFIX}/etc/systemd/system/initrd.target.wants ] || mkdir -p ${PREFIX}/etc/systemd/system/initrd.target.wants
             ln -s ../${_name}.device ${PREFIX}/etc/systemd/system/initrd.target.wants/${_name}.device
-            type mark_hostonly >/dev/null 2>&1 && mark_hostonly /etc/systemd/system/initrd.target.wants/${_name}.device
+            type mark_hostonly > /dev/null 2>&1 && mark_hostonly /etc/systemd/system/initrd.target.wants/${_name}.device
             _needreload=1
         fi
 
@@ -878,7 +912,7 @@ set_systemd_timeout_for_dev()
                 echo "JobTimeoutSec=$_timeout"
                 echo "JobRunningTimeoutSec=$_timeout"
             } > ${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf
-            type mark_hostonly >/dev/null 2>&1 && mark_hostonly /etc/systemd/system/${_name}.device.d/timeout.conf
+            type mark_hostonly > /dev/null 2>&1 && mark_hostonly /etc/systemd/system/${_name}.device.d/timeout.conf
             _needreload=1
         fi
 
@@ -892,8 +926,7 @@ set_systemd_timeout_for_dev()
 # Installs a initqueue-finished script,
 # which will cause the main loop only to exit,
 # if the device <dev> is recognized by the system.
-wait_for_dev()
-{
+wait_for_dev() {
     local _name
     local _noreload
 
@@ -904,7 +937,7 @@ wait_for_dev()
 
     _name="$(str_replace "$1" '/' '\x2f')"
 
-    type mark_hostonly >/dev/null 2>&1 && mark_hostonly "$hookdir/initqueue/finished/devexists-${_name}.sh"
+    type mark_hostonly > /dev/null 2>&1 && mark_hostonly "$hookdir/initqueue/finished/devexists-${_name}.sh"
 
     [ -e "${PREFIX}$hookdir/initqueue/finished/devexists-${_name}.sh" ] && return 0
 
@@ -918,8 +951,7 @@ wait_for_dev()
     set_systemd_timeout_for_dev $_noreload $1
 }
 
-cancel_wait_for_dev()
-{
+cancel_wait_for_dev() {
     local _name
     _name="$(str_replace "$1" '/' '\x2f')"
     rm -f -- "$hookdir/initqueue/finished/devexists-${_name}.sh"
@@ -940,7 +972,7 @@ killproc() {
     [ -x "$_exe" ] || return 1
     for _i in /proc/[0-9]*; do
         [ "$_i" = "/proc/1" ] && continue
-        if [ -e "$_i"/_exe ] && [  "$_i/_exe" -ef "$_exe" ] ; then
+        if [ -e "$_i"/_exe ] && [ "$_i/_exe" -ef "$_exe" ]; then
             kill $_sig ${_i##*/}
         fi
     done
@@ -948,17 +980,16 @@ killproc() {
 }
 
 need_shutdown() {
-    >/run/initramfs/.need_shutdown
+    > /run/initramfs/.need_shutdown
 }
 
-wait_for_loginit()
-{
+wait_for_loginit() {
     [ "$RD_DEBUG" = "yes" ] || return
     [ -e /run/initramfs/loginit.pipe ] || return
     debug_off
     echo "DRACUT_LOG_END"
-    exec 0<>/dev/console 1<>/dev/console 2<>/dev/console
-        # wait for loginit
+    exec 0<> /dev/console 1<> /dev/console 2<> /dev/console
+    # wait for loginit
     i=0
     while [ $i -lt 10 ]; do
         if [ ! -e /run/initramfs/loginit.pipe ]; then
@@ -967,12 +998,12 @@ wait_for_loginit()
             [ -z "${j##*Running*}" ] || break
         fi
         sleep 0.1
-        i=$(($i+1))
+        i=$(($i + 1))
     done
 
     if [ $i -eq 10 ]; then
-        kill %1 >/dev/null 2>&1
-        kill $(while read line || [ -n "$line" ];do echo $line;done</run/initramfs/loginit.pid)
+        kill %1 > /dev/null 2>&1
+        kill $(while read line || [ -n "$line" ]; do echo $line; done < /run/initramfs/loginit.pid)
     fi
 
     setdebug
@@ -980,7 +1011,7 @@ wait_for_loginit()
 }
 
 # pidof version for root
-if ! command -v pidof >/dev/null 2>/dev/null; then
+if ! command -v pidof > /dev/null 2> /dev/null; then
     pidof() {
         debug_off
         local _cmd
@@ -999,7 +1030,7 @@ if ! command -v pidof >/dev/null 2>/dev/null; then
             if [ -n "$_exe" ]; then
                 [ "$i" -ef "$_exe" ] || continue
             else
-                _rl=$(readlink -f "$i");
+                _rl=$(readlink -f "$i")
                 [ "${_rl%/$_cmd}" != "$_rl" ] || continue
             fi
             i=${i%/exe}
@@ -1011,12 +1042,11 @@ if ! command -v pidof >/dev/null 2>/dev/null; then
     }
 fi
 
-_emergency_shell()
-{
+_emergency_shell() {
     local _name="$1"
     if [ -n "$DRACUT_SYSTEMD" ]; then
         > /.console_lock
-        echo "PS1=\"$_name:\\\${PWD}# \"" >/etc/profile
+        echo "PS1=\"$_name:\\\${PWD}# \"" > /etc/profile
         systemctl start dracut-emergency.service
         rm -f -- /etc/profile
         rm -f -- /.console_lock
@@ -1036,7 +1066,7 @@ _emergency_shell()
         echo 'Dropping to debug shell.'
         echo
         export PS1="$_name:\${PWD}# "
-        [ -e /.profile ] || >/.profile
+        [ -e /.profile ] || > /.profile
 
         _ctty="$(RD_DEBUG= getarg rd.ctty=)" && _ctty="/dev/${_ctty##*/}"
         if [ -z "$_ctty" ]; then
@@ -1048,13 +1078,12 @@ _emergency_shell()
             _ctty=/dev/$_ctty
         fi
         [ -c "$_ctty" ] || _ctty=/dev/tty1
-        case "$(/usr/bin/setsid --help 2>&1)" in *--ctty*) CTTY="--ctty";; esac
-        setsid $CTTY /bin/sh -i -l 0<>$_ctty 1<>$_ctty 2<>$_ctty
+        case "$(/usr/bin/setsid --help 2>&1)" in *--ctty*) CTTY="--ctty" ;; esac
+        setsid $CTTY /bin/sh -i -l 0<> $_ctty 1<> $_ctty 2<> $_ctty
     fi
 }
 
-emergency_shell()
-{
+emergency_shell() {
     local _ctty
     set +e
     local _rdshell_name="dracut" action="Boot" hook="emergency"
@@ -1064,8 +1093,10 @@ emergency_shell()
         _rdshell_name=$2
         shift 2
     elif [ "$1" = "--shutdown" ]; then
-        _rdshell_name=$2; action="Shutdown"; hook="shutdown-emergency"
-        if type plymouth >/dev/null 2>&1; then
+        _rdshell_name=$2
+        action="Shutdown"
+        hook="shutdown-emergency"
+        if type plymouth > /dev/null 2>&1; then
             plymouth --hide-splash
         elif [ -x /oldroot/bin/plymouth ]; then
             /oldroot/bin/plymouth --hide-splash
@@ -1073,7 +1104,8 @@ emergency_shell()
         shift 2
     fi
 
-    echo ; echo
+    echo
+    echo
     warn "$*"
     echo
 
@@ -1092,18 +1124,20 @@ emergency_shell()
 
     case "$_emergency_action" in
         reboot)
-            reboot || exit 1;;
+            reboot || exit 1
+            ;;
         poweroff)
-            poweroff || exit 1;;
+            poweroff || exit 1
+            ;;
         halt)
-            halt || exit 1;;
+            halt || exit 1
+            ;;
     esac
 }
 
 # Retain the values of these variables but ensure that they are unexported
 # This is a POSIX-compliant equivalent of bash's "export -n"
-export_n()
-{
+export_n() {
     local var
     local val
     for var in "$@"; do
@@ -1131,8 +1165,7 @@ listlist() {
     [ "$_list" = "$_sublist" ] && return 0
 
     for _v in $_sublist; do
-        if [ -n "$_v" ] && ! ( [ -n "$_iglist" ] && strstr "$_iglist" "$_v" )
-        then
+        if [ -n "$_v" ] && ! ([ -n "$_iglist" ] && strstr "$_iglist" "$_v"); then
             strstr "$_list" "$_v" || return 1
         fi
     done
@@ -1160,8 +1193,7 @@ setmemdebug() {
 setmemdebug
 
 # parameters: func log_level prefix msg [trace_level:trace]...
-make_trace_mem()
-{
+make_trace_mem() {
     local log_level prefix msg msg_printed
     local trace trace_level trace_in_higher_levels insert_trace
 
@@ -1211,11 +1243,10 @@ make_trace_mem()
 }
 
 # parameters: type
-show_memstats()
-{
+show_memstats() {
     case $1 in
         shortmem)
-            cat /proc/meminfo  | grep -e "^MemFree" -e "^Cached" -e "^Slab"
+            cat /proc/meminfo | grep -e "^MemFree" -e "^Cached" -e "^Slab"
             ;;
         mem)
             cat /proc/meminfo
index 4f2857625e75ef2e9061dd2cdd1cdb5b53e83604..3f38d45258c5be4d826285c836a4adf4bf42fe39 100755 (executable)
@@ -16,16 +16,16 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
 export PATH
 
 # mount some important things
-[ ! -d /proc/self ] && \
-    mount -t proc -o nosuid,noexec,nodev proc /proc >/dev/null
+[ ! -d /proc/self ] \
+    && mount -t proc -o nosuid,noexec,nodev proc /proc > /dev/null
 
 if [ "$?" != "0" ]; then
     echo "Cannot mount proc on /proc! Compile the kernel with CONFIG_PROC_FS!"
     exit 1
 fi
 
-[ ! -d /sys/kernel ] && \
-    mount -t sysfs -o nosuid,noexec,nodev sysfs /sys >/dev/null
+[ ! -d /sys/kernel ] \
+    && mount -t sysfs -o nosuid,noexec,nodev sysfs /sys > /dev/null
 
 if [ "$?" != "0" ]; then
     echo "Cannot mount sysfs on /sys! Compile the kernel with CONFIG_SYSFS!"
@@ -38,7 +38,7 @@ RD_DEBUG=""
 setdebug
 
 if ! ismounted /dev; then
-    mount -t devtmpfs -o mode=0755,noexec,nosuid,strictatime devtmpfs /dev >/dev/null
+    mount -t devtmpfs -o mode=0755,noexec,nosuid,strictatime devtmpfs /dev > /dev/null
 fi
 
 if ! ismounted /dev; then
@@ -47,37 +47,37 @@ if ! ismounted /dev; then
 fi
 
 # prepare the /dev directory
-[ ! -h /dev/fd ] && ln -s /proc/self/fd /dev/fd >/dev/null 2>&1
-[ ! -h /dev/stdin ] && ln -s /proc/self/fd/0 /dev/stdin >/dev/null 2>&1
-[ ! -h /dev/stdout ] && ln -s /proc/self/fd/1 /dev/stdout >/dev/null 2>&1
-[ ! -h /dev/stderr ] && ln -s /proc/self/fd/2 /dev/stderr >/dev/null 2>&1
+[ ! -h /dev/fd ] && ln -s /proc/self/fd /dev/fd > /dev/null 2>&1
+[ ! -h /dev/stdin ] && ln -s /proc/self/fd/0 /dev/stdin > /dev/null 2>&1
+[ ! -h /dev/stdout ] && ln -s /proc/self/fd/1 /dev/stdout > /dev/null 2>&1
+[ ! -h /dev/stderr ] && ln -s /proc/self/fd/2 /dev/stderr > /dev/null 2>&1
 
 if ! ismounted /dev/pts; then
     mkdir -m 0755 -p /dev/pts
-    mount -t devpts -o gid=5,mode=620,noexec,nosuid devpts /dev/pts >/dev/null
+    mount -t devpts -o gid=5,mode=620,noexec,nosuid devpts /dev/pts > /dev/null
 fi
 
 if ! ismounted /dev/shm; then
     mkdir -m 0755 -p /dev/shm
-    mount -t tmpfs -o mode=1777,noexec,nosuid,nodev,strictatime tmpfs /dev/shm >/dev/null
+    mount -t tmpfs -o mode=1777,noexec,nosuid,nodev,strictatime tmpfs /dev/shm > /dev/null
 fi
 
 if ! ismounted /run; then
     mkdir -m 0755 -p /newrun
     if ! str_starts "$(readlink -f /bin/sh)" "/run/"; then
-        mount -t tmpfs -o mode=0755,noexec,nosuid,nodev,strictatime tmpfs /newrun >/dev/null
+        mount -t tmpfs -o mode=0755,noexec,nosuid,nodev,strictatime tmpfs /newrun > /dev/null
     else
         # the initramfs binaries are located in /run, so don't mount it with noexec
-        mount -t tmpfs -o mode=0755,nosuid,nodev,strictatime tmpfs /newrun >/dev/null
+        mount -t tmpfs -o mode=0755,nosuid,nodev,strictatime tmpfs /newrun > /dev/null
     fi
-    cp -a /run/* /newrun >/dev/null 2>&1
+    cp -a /run/* /newrun > /dev/null 2>&1
     mount --move /newrun /run
     rm -fr -- /newrun
 fi
 
-if command -v kmod >/dev/null 2>/dev/null; then
-    kmod static-nodes --format=tmpfiles 2>/dev/null | \
-        while read type file mode a a a majmin || [ -n "$type" ]; do
+if command -v kmod > /dev/null 2> /dev/null; then
+    kmod static-nodes --format=tmpfiles 2> /dev/null \
+        while read type file mode a a a majmin || [ -n "$type" ]; do
             type=${type%\!}
             case $type in
                 d)
@@ -105,10 +105,10 @@ fi
 
 if [ "$RD_DEBUG" = "yes" ]; then
     mkfifo /run/initramfs/loginit.pipe
-    loginit $DRACUT_QUIET </run/initramfs/loginit.pipe >/dev/console 2>&1 &
-    exec >/run/initramfs/loginit.pipe 2>&1
+    loginit $DRACUT_QUIET < /run/initramfs/loginit.pipe > /dev/console 2>&1 &
+    exec > /run/initramfs/loginit.pipe 2>&1
 else
-    exec 0<>/dev/console 1<>/dev/console 2<>/dev/console
+    exec 0<> /dev/console 1<> /dev/console 2<> /dev/console
 fi
 
 [ -f /usr/lib/initrd-release ] && . /usr/lib/initrd-release
@@ -164,17 +164,17 @@ make_trace_mem "hook pre-trigger" '1:shortmem' '2+:mem' '3+:slab'
 getarg 'rd.break=pre-trigger' -d 'rdbreak=pre-trigger' && emergency_shell -n pre-trigger "Break before pre-trigger"
 source_hook pre-trigger
 
-udevadm control --reload >/dev/null 2>&1 || :
+udevadm control --reload > /dev/null 2>&1 || :
 # then the rest
-udevadm trigger --type=subsystems --action=add >/dev/null 2>&1
-udevadm trigger --type=devices --action=add >/dev/null 2>&1
+udevadm trigger --type=subsystems --action=add > /dev/null 2>&1
+udevadm trigger --type=devices --action=add > /dev/null 2>&1
 
 make_trace_mem "hook initqueue" '1:shortmem' '2+:mem' '3+:slab'
 getarg 'rd.break=initqueue' -d 'rdbreak=initqueue' && emergency_shell -n initqueue "Break before initqueue"
 
 RDRETRY=$(getarg rd.retry -d 'rd_retry=')
 RDRETRY=${RDRETRY:-180}
-RDRETRY=$(($RDRETRY*2))
+RDRETRY=$(($RDRETRY * 2))
 export RDRETRY
 main_loop=0
 export main_loop
@@ -196,7 +196,7 @@ while :; do
         check_finished && break 2
     done
 
-    $UDEV_QUEUE_EMPTY >/dev/null 2>&1 || continue
+    $UDEV_QUEUE_EMPTY > /dev/null 2>&1 || continue
 
     for job in $hookdir/initqueue/settled/*.sh; do
         [ -e "$job" ] || break
@@ -204,24 +204,26 @@ while :; do
         check_finished && break 2
     done
 
-    $UDEV_QUEUE_EMPTY >/dev/null 2>&1 || continue
+    $UDEV_QUEUE_EMPTY > /dev/null 2>&1 || continue
 
     # 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
-            udevadm settle --timeout=0 >/dev/null 2>&1 || main_loop=0
+            udevadm settle --timeout=0 > /dev/null 2>&1 || main_loop=0
             [ -f $hookdir/initqueue/work ] && main_loop=0
         done
     fi
 
-    main_loop=$(($main_loop+1))
+    main_loop=$(($main_loop + 1))
     [ $main_loop -gt $RDRETRY ] \
-        && { flock -s 9 ; emergency_shell "Could not boot."; } 9>/.console_lock
+        && {
+            flock -s 9
+            emergency_shell "Could not boot."
+        } 9> /.console_lock
 done
 unset job
 unset queuetriggered
@@ -234,29 +236,31 @@ make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab'
 getarg 'rd.break=pre-mount' -d 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount"
 source_hook pre-mount
 
-
 getarg 'rd.break=mount' -d 'rdbreak=mount' && emergency_shell -n mount "Break mount"
 # mount scripts actually try to mount the root filesystem, and may
 # be sourced any number of times. As soon as one suceeds, no more are sourced.
 _i_mount=0
 while :; do
     if ismounted "$NEWROOT"; then
-        usable_root "$NEWROOT" && break;
+        usable_root "$NEWROOT" && break
         umount "$NEWROOT"
     fi
     for f in $hookdir/mount/*.sh; do
         [ -f "$f" ] && . "$f"
         if ismounted "$NEWROOT"; then
-            usable_root "$NEWROOT" && break;
+            usable_root "$NEWROOT" && break
             warn "$NEWROOT has no proper rootfs layout, ignoring and removing offending mount hook"
             umount "$NEWROOT"
             rm -f -- "$f"
         fi
     done
 
-    _i_mount=$(($_i_mount+1))
+    _i_mount=$(($_i_mount + 1))
     [ $_i_mount -gt 20 ] \
-        && { flock -s 9 ; emergency_shell "Can't mount root filesystem"; } 9>/.console_lock
+        && {
+            flock -s 9
+            emergency_shell "Can't mount root filesystem"
+        } 9> /.console_lock
 done
 
 {
@@ -304,9 +308,9 @@ if [ $UDEVVERSION -lt 168 ]; then
     udevadm control --stop-exec-queue
 
     HARD=""
-    while pidof udevd >/dev/null 2>&1; do
+    while pidof udevd > /dev/null 2>&1; do
         for pid in $(pidof udevd); do
-            kill $HARD $pid >/dev/null 2>&1
+            kill $HARD $pid > /dev/null 2>&1
         done
         HARD="-9"
     done
@@ -329,18 +333,20 @@ for i in $(export -p); do
     i=${i%%=*}
     [ -z "$i" ] && continue
     case $i in
-        root|PATH|HOME|TERM|PS4|RD_*)
-            :;;
+        root | PATH | HOME | TERM | PS4 | RD_*)
+            :
+            ;;
         *)
-            unset "$i";;
+            unset "$i"
+            ;;
     esac
 done
-. /tmp/export.orig 2>/dev/null || :
+. /tmp/export.orig 2> /dev/null || :
 rm -f -- /tmp/export.orig
 
 initargs=""
-read CLINE </proc/cmdline
-if getarg init= >/dev/null ; then
+read CLINE < /proc/cmdline
+if getarg init= > /dev/null; then
     ignoreargs="console BOOT_IMAGE"
     # only pass arguments after init= to the init
     CLINE=${CLINE#*init=}
@@ -358,7 +364,7 @@ else
     set -- $CLINE
     for x in "$@"; do
         case "$x" in
-            [0-9]|s|S|single|emergency|auto ) \
+            [0-9] | s | S | single | emergency | auto)
                 initargs="$initargs $x"
                 ;;
         esac
@@ -377,12 +383,11 @@ wait_for_loginit
 # remove helper symlink
 [ -h /dev/root ] && rm -f -- /dev/root
 
-bv=$(getarg rd.break -d rdbreak) && [ -z "$bv" ] &&
-    emergency_shell -n switch_root "Break before switch_root"
+bv=$(getarg rd.break -d rdbreak) && [ -z "$bv" ] \
+    && emergency_shell -n switch_root "Break before switch_root"
 unset bv
 info "Switching root"
 
-
 unset PS4
 
 CAPSH=$(command -v capsh)
@@ -395,18 +400,18 @@ if [ -f /etc/capsdrop ]; then
     info "Calling $INIT with capabilities $CAPS_INIT_DROP dropped."
     unset RD_DEBUG
     exec $CAPSH --drop="$CAPS_INIT_DROP" -- \
-        -c "exec switch_root \"$NEWROOT\" \"$INIT\" $initargs" || \
-    {
-       warn "Command:"
-       warn capsh --drop=$CAPS_INIT_DROP -- -c exec switch_root "$NEWROOT" "$INIT" $initargs
-       warn "failed."
-       emergency_shell
-    }
+        -c "exec switch_root \"$NEWROOT\" \"$INIT\" $initargs" \
+        || {
+            warn "Command:"
+            warn capsh --drop=$CAPS_INIT_DROP -- -c exec switch_root "$NEWROOT" "$INIT" $initargs
+            warn "failed."
+            emergency_shell
+        }
 else
     unset RD_DEBUG
     exec $SWITCH_ROOT "$NEWROOT" "$INIT" $initargs || {
-       warn "Something went very badly wrong in the initramfs.  Please "
-       warn "file a bug against dracut."
-       emergency_shell
+        warn "Something went very badly wrong in the initramfs.  Please "
+        warn "file a bug against dracut."
+        emergency_shell
     }
 fi
index c301638387993847aa9bf193e733c24c27394a44..22fe2d6f4e82a553a1713347a506a646cd013107 100755 (executable)
@@ -7,28 +7,39 @@
 
 PATH=/usr/sbin:/usr/bin:/sbin:/bin
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 while [ $# -gt 0 ]; do
     case "$1" in
         --onetime)
-            onetime="yes";;
+            onetime="yes"
+            ;;
         --online)
-            qname="/online";;
+            qname="/online"
+            ;;
         --settled)
-            qname="/settled";;
+            qname="/settled"
+            ;;
         --finished)
-            qname="/finished";;
+            qname="/finished"
+            ;;
         --timeout)
-            qname="/timeout";;
+            qname="/timeout"
+            ;;
         --unique)
-            unique="yes";;
+            unique="yes"
+            ;;
         --name)
-            name="$2";shift;;
+            name="$2"
+            shift
+            ;;
         --env)
-            env="$2"; shift;;
+            env="$2"
+            shift
+            ;;
         *)
-            break;;
+            break
+            ;;
     esac
     shift
 done
@@ -44,7 +55,7 @@ exe=$1
 shift
 
 [ -x "$exe" ] || exe=$(command -v $exe)
-if [ -z "$exe" ] ; then
+if [ -z "$exe" ]; then
     echo "Invalid command"
     exit 1
 fi
index aa8dcf3d4e32f0c7a90e6dfc6560377b461056c1..b94efd95ac9e3ca752d35bd5b08fe3e8f148fa63 100755 (executable)
@@ -7,8 +7,8 @@ QUIET=$1
 
 printf -- "$$" > /run/initramfs/loginit.pid
 
-[ -e /dev/kmsg ] && exec 5>/dev/kmsg || exec 5>/dev/null
-exec 6>/run/initramfs/init.log
+[ -e /dev/kmsg ] && exec 5> /dev/kmsg || exec 5> /dev/null
+exec 6> /run/initramfs/init.log
 
 while read line || [ -n "$line" ]; do
     if [ "$line" = "DRACUT_LOG_END" ]; then
index 76ab51f20812195a403e5d83429f29027ad73d84..8f02b2e535de6b73999778068397661af012161c 100755 (executable)
@@ -32,7 +32,7 @@ install() {
     # add common users in /etc/passwd, it will be used by nfs/ssh currently
     # use password for hostonly images to facilitate secure sulogin in emergency console
     [[ $hostonly ]] && pwshadow='x'
-    grep '^root:' "$initdir/etc/passwd" 2>/dev/null || echo  "root:$pwshadow:0:0::/root:/bin/sh" >> "$initdir/etc/passwd"
+    grep '^root:' "$initdir/etc/passwd" 2> /dev/null || echo "root:$pwshadow:0:0::/root:/bin/sh" >> "$initdir/etc/passwd"
     grep '^nobody:' "$dracutsysrootdir"/etc/passwd >> "$initdir/etc/passwd"
 
     [[ $hostonly ]] && grep '^root:' "$dracutsysrootdir"/etc/shadow >> "$initdir/etc/shadow"
@@ -76,7 +76,7 @@ install() {
     # Derive an os-release file from the host, if it exists
     if [[ -e $dracutsysrootdir/etc/os-release ]]; then
         . "$dracutsysrootdir"/etc/os-release
-        grep -hE -ve '^VERSION=' -ve '^PRETTY_NAME' "$dracutsysrootdir"/etc/os-release >"${initdir}"/usr/lib/initrd-release
+        grep -hE -ve '^VERSION=' -ve '^PRETTY_NAME' "$dracutsysrootdir"/etc/os-release > "${initdir}"/usr/lib/initrd-release
         [[ -n ${VERSION} ]] && VERSION+=" "
         [[ -n ${PRETTY_NAME} ]] && PRETTY_NAME+=" "
     else
@@ -87,7 +87,7 @@ install() {
             echo ID=dracut
             echo VERSION_ID=\"$DRACUT_VERSION\"
             echo ANSI_COLOR='"0;34"'
-        } >${initdir}/usr/lib/initrd-release
+        } > ${initdir}/usr/lib/initrd-release
     fi
     VERSION+="dracut-$DRACUT_VERSION"
     PRETTY_NAME+="dracut-$DRACUT_VERSION (Initramfs)"
@@ -127,13 +127,13 @@ install() {
                     # 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)
 
                     case "$_pdev" in
-                        /dev/?*) wait_for_dev $_pdev;;
+                        /dev/?*) wait_for_dev $_pdev ;;
                         *) ;;
                     esac
                 done
index 5b74ad25b1e813f144b96c98a9bb8ed24594acdc..2507a93deb73e3fd05e4a719252ccdd7c77c75f9 100755 (executable)
@@ -11,4 +11,3 @@ fstype="$(getarg rootfstype=)"
 if [ -z "$fstype" ]; then
     fstype="auto"
 fi
-
index 639b4e4bdff903e50edd39f1d0ea0f9cf4b582f2..1c6bad2c7b321f613fc85fa5047f41682dab99be 100755 (executable)
@@ -4,7 +4,7 @@ echo 'Generating "/run/initramfs/rdsosreport.txt"'
 
 [ -d /run/initramfs ] || mkdir -p /run/initramfs
 
-exec >/run/initramfs/rdsosreport.txt 2>&1
+exec > /run/initramfs/rdsosreport.txt 2>&1
 
 PWFILTER='s/\(ftp:\/\/.*\):.*@/\1:*******@/g;s/\(cifs:\/\/.*\):.*@/\1:*******@/g;s/cifspass=[^ ]*/cifspass=*******/g;s/iscsi:.*@/iscsi:******@/g;s/rd.iscsi.password=[^ ]*/rd.iscsi.password=******/g;s/rd.iscsi.in.password=[^ ]*/rd.iscsi.in.password=******/g'
 set -x
@@ -34,22 +34,21 @@ for _i in /etc/conf.d/*.conf; do
     cat $_i | sed -e "$PWFILTER"
 done
 
-if command -v lvm >/dev/null 2>/dev/null; then
+if command -v lvm > /dev/null 2> /dev/null; then
     lvm pvdisplay
     lvm vgdisplay
     lvm lvdisplay
 fi
 
-command -v dmsetup >/dev/null 2>/dev/null && dmsetup ls --tree
+command -v dmsetup > /dev/null 2> /dev/null && dmsetup ls --tree
 
 cat /proc/mdstat
 
-command -v ip >/dev/null 2>/dev/null && ip addr
+command -v ip > /dev/null 2> /dev/null && ip addr
 
-if command -v journalctl >/dev/null 2>/dev/null; then
+if command -v journalctl > /dev/null 2> /dev/null; then
     journalctl -ab --no-pager -o short-monotonic | sed -e "$PWFILTER"
 else
     dmesg | sed -e "$PWFILTER"
     [ -f /run/initramfs/init.log ] && cat /run/initramfs/init.log | sed -e "$PWFILTER"
 fi
-
index 987696debfb9d0b3848d5f5dfbf84ed73c2a53e4..d4179be07708c92e9b5453c98b454ff09f4c89e8 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 fsck_ask_reboot() {
     info "note - fsck suggests reboot, if you"
@@ -19,10 +19,10 @@ fsck_ask_err() {
 fsck_tail() {
     [ $_ret -gt 0 ] && warn "$_drv returned with $_ret"
     if [ $_ret -ge 4 ]; then
-        [ -n "$_out" ] && echo "$_out"|vwarn
+        [ -n "$_out" ] && echo "$_out" | vwarn
         fsck_ask_err
     else
-        [ -n "$_out" ] && echo "$_out"|vinfo
+        [ -n "$_out" ] && echo "$_out" | vinfo
         [ $_ret -ge 2 ] && fsck_ask_reboot
     fi
 }
@@ -43,24 +43,24 @@ fsck_able() {
             return 1
             ;;
         ext?)
-            type e2fsck >/dev/null 2>&1 &&
-            _drv="fsck_drv_com e2fsck" &&
-            return 0
+            type e2fsck > /dev/null 2>&1 \
+                && _drv="fsck_drv_com e2fsck" \
+                && return 0
             ;;
         f2fs)
-           type fsck.f2fs >/dev/null 2>&1 &&
-           _drv="fsck_drv_com fsck.f2fs" &&
-           return 0
-           ;;
+            type fsck.f2fs > /dev/null 2>&1 \
+                && _drv="fsck_drv_com fsck.f2fs" \
+                && return 0
+            ;;
         jfs)
-            type jfs_fsck >/dev/null 2>&1 &&
-            _drv="fsck_drv_com jfs_fsck" &&
-            return 0
+            type jfs_fsck > /dev/null 2>&1 \
+                && _drv="fsck_drv_com jfs_fsck" \
+                && return 0
             ;;
         reiserfs)
-            type reiserfsck >/dev/null 2>&1 &&
-            _drv="fsck_drv_com reiserfsck" &&
-            return 0
+            type reiserfsck > /dev/null 2>&1 \
+                && _drv="fsck_drv_com reiserfsck" \
+                && return 0
             ;;
         btrfs)
             # type btrfsck >/dev/null 2>&1 &&
@@ -70,13 +70,13 @@ fsck_able() {
             ;;
         nfs*)
             # nfs can be a nop, returning success
-            _drv=":" &&
-            return 0
+            _drv=":" \
+                && return 0
             ;;
         *)
-            type fsck >/dev/null 2>&1 &&
-            _drv="fsck_drv_std fsck" &&
-            return 0
+            type fsck > /dev/null 2>&1 \
+                && _drv="fsck_drv_std fsck" \
+                && return 0
             ;;
     esac
 
@@ -124,7 +124,7 @@ fsck_drv_std() {
     # note, we don't enforce -a here, thus fsck is being run (in theory)
     # interactively; otherwise some tool might complain about lack of terminal
     # (and using -a might not be safe)
-    fsck $_fop "$_dev" >/dev/console 2>&1
+    fsck $_fop "$_dev" > /dev/console 2>&1
     _ret=$?
     fsck_tail
 
@@ -147,7 +147,10 @@ fsck_single() {
 
     [ $# -lt 2 ] && return 255
     # if UUID= marks more than one device, take only the first one
-    [ -e "$_dev" ] || _dev=$(devnames "$_dev"| while read line || [ -n "$line" ]; do if [ -n "$line" ]; then echo $line; break;fi;done)
+    [ -e "$_dev" ] || _dev=$(devnames "$_dev" | while read line || [ -n "$line" ]; do if [ -n "$line" ]; then
+        echo $line
+        break
+    fi; done)
     [ -e "$_dev" ] || return 255
     _fs=$(det_fs "$_dev" "$_fs")
     fsck_able "$_fs" || return 255
@@ -167,7 +170,7 @@ fsck_batch() {
     local _ret
     local _out
 
-    [ $# -eq 0 ] || ! type fsck >/dev/null 2>&1 && return 255
+    [ $# -eq 0 ] || ! type fsck > /dev/null 2>&1 && return 255
 
     info "Checking filesystems (fsck -M -T -a):"
     for _dev in "$@"; do
@@ -191,13 +194,13 @@ det_fs() {
     local _orig="${2:-auto}"
     local _fs
 
-    _fs=$(udevadm info --query=env --name="$_dev" \
-    while read line || [ -n "$line" ]; do
-        if str_starts $line "ID_FS_TYPE="; then
-            echo ${line#ID_FS_TYPE=}
-            break
-        fi
-    done)
+    _fs=$(udevadm info --query=env --name="$_dev" \
+        | while read line || [ -n "$line" ]; do
+            if str_starts $line "ID_FS_TYPE="; then
+                echo ${line#ID_FS_TYPE=}
+                break
+            fi
+        done)
     _fs=${_fs:-auto}
 
     if [ "$_fs" = "auto" ]; then
@@ -235,9 +238,11 @@ write_fs_tab() {
     for _o in $CMDLINE; do
         case $_o in
             rw)
-                _rw=1;;
+                _rw=1
+                ;;
             ro)
-                _rw=0;;
+                _rw=0
+                ;;
         esac
     done
     if [ "$_rw" = "1" ]; then
@@ -253,7 +258,7 @@ write_fs_tab() {
         return
     fi
 
-    if type systemctl >/dev/null 2>/dev/null; then
+    if type systemctl > /dev/null 2> /dev/null; then
         systemctl daemon-reload
         systemctl --no-block start initrd-root-fs.target
     fi
index aae902395a46b319ddf396004d318a8784ba1d90..7448c2bded768d07ba1c34d8a3b9a1faa21e5778 100755 (executable)
@@ -10,7 +10,6 @@ depends() {
     return 0
 }
 
-
 echo_fs_helper() {
     local dev=$1 fs=$2
     case "$fs" in
@@ -38,7 +37,7 @@ echo_fs_helper() {
 include_fs_helper_modules() {
     local dev=$1 fs=$2
     case "$fs" in
-        xfs|btrfs|ext4)
+        xfs | btrfs | ext4)
             instmods crc32c
             ;;
         f2fs)
index f47741533e0fa5ce7754d8551ef07b0b49165070..79f42d77c3b0cd0d29a0eb08faf0ef8b5d72ba4f 100755 (executable)
@@ -3,13 +3,12 @@
 #
 # TODO: identify/unpack rpm, deb, maybe others?
 
-
 # super-simple "file" that only identifies archives.
 # works with stdin if $1 is not set.
 det_archive() {
     # NOTE: echo -e works in ash and bash, but not dash
     local bz="BZh" xz="$(echo -e '\xfd7zXZ')" gz="$(echo -e '\x1f\x8b')" zs="$(echo -e '\x28\xB5\x2F\xFD')"
-    local headerblock="$(dd ${1:+if=$1} bs=262 count=1 2>/dev/null)"
+    local headerblock="$(dd ${1:+if=$1} bs=262 count=1 2> /dev/null)"
     case "$headerblock" in
         $xz*) echo "xz" ;;
         $gz*) echo "gzip" ;;
@@ -23,7 +22,8 @@ det_archive() {
 # determine filesystem type for a filesystem image
 det_fs_img() {
     local dev=$(losetup --find --show "$1") rv=""
-    det_fs $dev; rv=$?
+    det_fs $dev
+    rv=$?
     losetup -d $dev
     return $rv
 }
@@ -34,8 +34,8 @@ unpack_archive() {
     local img="$1" outdir="$2" archiver="" decompr=""
     local ft="$(det_archive $img)"
     case "$ft" in
-        xz|gzip|bzip2|zstd) decompr="$ft -dc" ;;
-        cpio|tar) decompr="cat";;
+        xz | gzip | bzip2 | zstd) decompr="$ft -dc" ;;
+        cpio | tar) decompr="cat" ;;
         *) return 1 ;;
     esac
     ft="$($decompr $img | det_archive)"
@@ -45,15 +45,25 @@ unpack_archive() {
         *) return 2 ;;
     esac
     mkdir -p $outdir
-    ( cd $outdir; $decompr | $archiver 2>/dev/null ) < $img
+    (
+        cd $outdir
+        $decompr | $archiver 2> /dev/null
+    ) < $img
 }
 
 # unpack_fs FSIMAGE OUTDIR
 # unpack a filesystem image
 unpack_fs() {
     local img="$1" outdir="$2" mnt="$(mkuniqdir /tmp unpack_fs.)"
-    mount -o loop $img $mnt || { rmdir $mnt; return 1; }
-    mkdir -p $outdir; outdir="$(cd $outdir; pwd)"
+    mount -o loop $img $mnt || {
+        rmdir $mnt
+        return 1
+    }
+    mkdir -p $outdir
+    outdir="$(
+        cd $outdir
+        pwd
+    )"
     copytree $mnt $outdir
     umount $mnt
     rmdir $mnt
@@ -63,12 +73,24 @@ unpack_fs() {
 # unpack_img IMAGEFILE OUTDIR
 unpack_img() {
     local img="$1" outdir="$2"
-    [ -r "$img" ] || { warn "can't read img!"; return 1; }
-    [ -n "$outdir" ] || { warn "unpack_img: no output dir given"; return 1; }
+    [ -r "$img" ] || {
+        warn "can't read img!"
+        return 1
+    }
+    [ -n "$outdir" ] || {
+        warn "unpack_img: no output dir given"
+        return 1
+    }
 
     if [ "$(det_archive $img)" ]; then
-        unpack_archive "$@" || { warn "can't unpack archive file!"; return 1; }
+        unpack_archive "$@" || {
+            warn "can't unpack archive file!"
+            return 1
+        }
     else
-        unpack_fs "$@" || { warn "can't unpack filesystem image!"; return 1; }
+        unpack_fs "$@" || {
+            warn "can't unpack filesystem image!"
+            return 1
+        }
     fi
 }
index fe1eca1a69b865b1a0bd8f9c563812d81ef74cf4..e11c7ba96c185d99bffeb5eb4f994a757c28106e 100755 (executable)
@@ -19,4 +19,3 @@ install() {
     inst_multiple -o cpio xz bzip2 zstd
     inst_simple "$moddir/img-lib.sh" "/lib/img-lib.sh"
 }
-
index 0e7aa96d17b2c6eaebf4f5b3a3e38294dd65feb1..7679b7d0bce322acfd916601250a0c03ba4f6244 100755 (executable)
@@ -5,10 +5,10 @@ if ! [ "$DEBUG_MEM_LEVEL" -ge 4 ]; then
     return 0
 fi
 
-if type -P systemctl >/dev/null; then
+if type -P systemctl > /dev/null; then
     systemctl stop memstrack.service
 else
-    get_pid_of_tracer () {
+    get_pid_of_tracer() {
         local _user _pid _rest
         read _user _pid _rest <<< $(ps aux | grep [m]emstrack | head -1)
         echo $_pid
index 5aa73efea92615b543ec085c4fdf951d04d8f0f9..aedee54e89a05b3f9c72afc3ea35673400b00b26 100755 (executable)
@@ -3,7 +3,7 @@
 # memdebug=4 and memdebug=5 requires debug fs to be mounted.
 # And there is no need to umount it.
 
-type getargnum >/dev/null 2>&1 || . /lib/dracut-lib.sh
+type getargnum > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 # "sys/kernel/tracing" has the priority if exists.
 get_trace_base() {
@@ -37,7 +37,7 @@ prepare_debugfs() {
     fi
 }
 
-if ! is_debugfs_ready ; then
+if ! is_debugfs_ready; then
     prepare_debugfs
 fi
 
@@ -49,7 +49,7 @@ if [ -n "$DEBUG_MEM_LEVEL" ]; then
         echo "memstrack - will report memory usage summary"
         memstrack --report module_summary --notui --throttle 80 -o /.memstrack &
     else
-        exit 0;
+        exit 0
     fi
 fi
 
index b69a731323c75b37d9ee4c93ca02675b3d24243c..8a038718b8e3b2158ea9074369135a48037e94dc 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 check() {
-    if find_binary memstrack >/dev/null; then
+    if find_binary memstrack > /dev/null; then
         dinfo "memstrack is available"
         return 0
     fi
index ff9b7734befb91e927fe2452a74cdd23e32426f1..973ab5191fecc17291bd13e7baa74be58f2fe3f7 100755 (executable)
@@ -24,4 +24,3 @@ install() {
         mkdir -m 0755 -p ${initdir}/lib/dracut/hooks/$_d
     done
 }
-
index 2f06cada18dce3c60fee95f788b08841eefa54b8..cda291c9cb30c4f88910d569abcc6f4ff3fd7f03 100755 (executable)
@@ -10,9 +10,9 @@ ACTION="$1"
 # and that it can actually be used. When console=null is used,
 # echo will fail. We do the check in a subshell, because otherwise
 # the process will be killed when when running as PID 1.
-[ -w /dev/console ] && \
-    ( echo </dev/console &>/dev/null ) && \
-    exec </dev/console >>/dev/console 2>>/dev/console
+[ -w /dev/console ] \
+    && (echo < /dev/console &> /dev/null) \
+    && exec < /dev/console >> /dev/console 2>> /dev/console
 
 export TERM=linux
 export PATH=/usr/sbin:/usr/bin:/sbin:/bin
@@ -30,9 +30,9 @@ done
 
 # if "kexec" was installed after creating the initramfs, we try to copy it from the real root
 # libz normally is pulled in via kmod/modprobe and udevadm
-if [ "$ACTION" = "kexec" ] && ! command -v kexec >/dev/null 2>&1; then
+if [ "$ACTION" = "kexec" ] && ! command -v kexec > /dev/null 2>&1; then
     for p in /usr/sbin /usr/bin /sbin /bin; do
-        cp -a /oldroot/${p}/kexec $p >/dev/null 2>&1 && break
+        cp -a /oldroot/${p}/kexec $p > /dev/null 2>&1 && break
     done
     hash kexec
 fi
@@ -54,10 +54,11 @@ _timed_out_umounts=""
 umount_a() {
     local _verbose="n"
     if [ "$1" = "-v" ]; then
-        _verbose="y"; shift
+        _verbose="y"
+        shift
         exec 7>&2
     else
-        exec 7>/dev/null
+        exec 7> /dev/null
     fi
 
     local _did_umount="n"
@@ -69,7 +70,10 @@ umount_a() {
         # indefinitely if this is e.g. a stuck NFS mount. The command is
         # invoked in a subshell to silence also the "Killed" message that might
         # be produced by the shell.
-        (set +m; timeout --signal=KILL "$_umount_timeout" umount "$mp") 2>&7
+        (
+            set +m
+            timeout --signal=KILL "$_umount_timeout" umount "$mp"
+        ) 2>&7
         local ret=$?
         if [ $ret -eq 0 ]; then
             _did_umount="y"
@@ -80,7 +84,7 @@ umount_a() {
         elif [ "$_verbose" = "y" ]; then
             warn "Unmounting $mp failed with status $ret."
         fi
-    done </proc/mounts
+    done < /proc/mounts
 
     losetup -D 2>&7
 
@@ -92,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
@@ -102,14 +106,14 @@ if strstr "$(cat /proc/mounts)" "/oldroot"; then
     for _pid in /proc/*; do
         _pid=${_pid##/proc/}
         case $_pid in
-            *[!0-9]*) continue;;
+            *[!0-9]*) continue ;;
         esac
         [ $_pid -eq $$ ] && continue
 
         [ -e "/proc/$_pid/exe" ] || continue
         [ -e "/proc/$_pid/root" ] || continue
 
-        if strstr "$(ls -l /proc/$_pid /proc/$_pid/fd 2>/dev/null)" "oldroot"; then
+        if strstr "$(ls -l /proc/$_pid /proc/$_pid/fd 2> /dev/null)" "oldroot"; then
             warn "Blocking umount of /oldroot [$_pid] $(cat /proc/$_pid/cmdline)"
         else
             warn "Still running [$_pid] $(cat /proc/$_pid/cmdline)"
@@ -125,7 +129,7 @@ _check_shutdown() {
     local __s=0
     for __f in $hookdir/shutdown/*.sh; do
         [ -e "$__f" ] || continue
-        ( . "$__f" $1 )
+        (. "$__f" $1)
         if [ $? -eq 0 ]; then
             rm -f -- $__f
         else
@@ -138,14 +142,14 @@ _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
 
 getarg 'rd.break=shutdown' && emergency_shell --shutdown shutdown "Break before shutdown"
 
 case "$ACTION" in
-    reboot|poweroff|halt)
+    reboot | poweroff | halt)
         $ACTION -f -n
         warn "$ACTION failed!"
         ;;
index 72cc83ad5a1923a13cf72a748f2a81d2febd3c48..5fde9af77fdb028738e7ac7e8d7524576ccf24c6 100644 (file)
@@ -3,7 +3,7 @@
 check() {
     require_binaries mksquashfs unsquashfs || return 1
 
-    for i in CONFIG_SQUASHFS CONFIG_BLK_DEV_LOOP CONFIG_OVERLAY_FS ; do
+    for i in CONFIG_SQUASHFS CONFIG_BLK_DEV_LOOP CONFIG_OVERLAY_FS; do
         if ! check_kernel_config $i; then
             dinfo "dracut-squash module requires kernel configuration $i (y or m)"
             return 1
index 3dcff22856d6ce3204f7a45d6f66d431d73b6c77..6deeee85c779081d7bf8053f7cffd4270b7571c6 100755 (executable)
@@ -15,4 +15,3 @@ depends() {
 install() {
     inst_simple "$moddir/uefi-lib.sh" "/lib/uefi-lib.sh"
 }
-
index 3245db8d431f61a9c7e390a99bda6185318db82c..171a982111a63b32e8ff70cbd10d20d30ca5eb14 100755 (executable)
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
-getbyte () {
+getbyte() {
     local IFS= LC_CTYPE=C res c=0
     read -r -n 1 -d '' c
     res=$?
@@ -28,26 +28,25 @@ getbyte () {
     return $res
 }
 
-getword () {
+getword() {
     local b1=0 b2=0 val=0
     b1=$(getbyte)
     b2=$(getbyte)
-    (( val = b2 * 256 + b1 ))
+    ((val = b2 * 256 + b1))
     echo $val
     return 0
 }
 
 # Acpi(PNP0A08,0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)/MAC(90E2BA265ED4,0x0)/Vlan(172)/Fibre(0x4EA06104A0CC0050,0x0)
-uefi_device_path()
-{
+uefi_device_path() {
     data=${1:-/sys/firmware/efi/efivars/FcoeBootDevice-a0ebca23-5f9c-447a-a268-22b6c158c2ac}
     [ -f "$data" ] || return 1
 
     local IFS= LC_CTYPE=C res tt len type hextype first
     first=1
     {
-        getword >/dev/null
-        getword >/dev/null
+        getword > /dev/null
+        getword > /dev/null
         while :; do
             type=$(getbyte) || return 1
             subtype=$(getbyte) || return 1
@@ -70,19 +69,19 @@ uefi_device_path()
                     ;;
                 0303)
                     # FIBRE
-                    getword &>/dev/null
-                    getword &>/dev/null
+                    getword &> /dev/null
+                    getword &> /dev/null
                     printf "Fibre(0x%x%x%x%x%x%x%x%x,0x%x)" \
-                           $(getbyte) $(getbyte) $(getbyte) $(getbyte) \
-                           $(getbyte) $(getbyte) $(getbyte) $(getbyte) \
-                           $(( $(getword) + $(getword) * 65536 + 4294967296 * ( $(getword) + $(getword) * 65536 ) ))
+                        $(getbyte) $(getbyte) $(getbyte) $(getbyte) \
+                        $(getbyte) $(getbyte) $(getbyte) $(getbyte) \
+                        $(($(getword) + $(getword) * 65536 + 4294967296 * ($(getword) + $(getword) * 65536)))
                     ;;
                 030b)
                     # MAC
                     printf "MAC(%02x%02x%02x%02x%02x%02x," $(getbyte) $(getbyte) $(getbyte) $(getbyte) $(getbyte) $(getbyte)
-                    for((i=0; i<26; i++)); do tt=$(getbyte) || return 1; done
+                    for ((i = 0; i < 26; i++)); do tt=$(getbyte) || return 1; done
                     #read -r -d '' -n 26 tt || return 1
-                    printf "0x%x)"  $(getbyte)
+                    printf "0x%x)" $(getbyte)
                     ;;
                 0314)
                     # VLAN
@@ -95,7 +94,7 @@ uefi_device_path()
                     ;;
                 *)
                     #printf "Unknown(Type:0x%02x SubType:0x%02x len=%d)\n" "$type" "$subtype" "$len" >&2
-                    for((i=0; i<len-4; i++)); do tt=$(getbyte); done
+                    for ((i = 0; i < len - 4; i++)); do tt=$(getbyte); done
                     ;;
             esac
         done
@@ -104,14 +103,13 @@ uefi_device_path()
 
 # /home/harald/Downloads/FcoeBootDevice-80005007-4248-4e4b-8df4-93060220756f
 
-get_fcoe_boot_mac()
-{
+get_fcoe_boot_mac() {
     data=${1:-/sys/firmware/efi/efivars/FcoeBootDevice-a0ebca23-5f9c-447a-a268-22b6c158c2ac}
     [ -f "$data" ] || return 1
     local IFS= LC_CTYPE=C tt len type hextype
     {
-        getword >/dev/null
-        getword >/dev/null
+        getword > /dev/null
+        getword > /dev/null
         while :; do
             type=$(getbyte) || return 1
             subtype=$(getbyte) || return 1
@@ -121,7 +119,7 @@ get_fcoe_boot_mac()
                 030b)
                     # MAC
                     printf "%02x:%02x:%02x:%02x:%02x:%02x" $(getbyte) $(getbyte) $(getbyte) $(getbyte) $(getbyte) $(getbyte)
-                    for((i=0; i<27; i++)); do tt=$(getbyte) || return 1; done
+                    for ((i = 0; i < 27; i++)); do tt=$(getbyte) || return 1; done
                     ;;
                 7fff)
                     # END
@@ -129,21 +127,20 @@ get_fcoe_boot_mac()
                     ;;
                 *)
                     #printf "Unknown(Type:0x%02x SubType:0x%02x len=%d)\n" "$type" "$subtype" "$len" >&2
-                    for((i=0; i<len-4; i++)); do tt=$(getbyte); done
+                    for ((i = 0; i < len - 4; i++)); do tt=$(getbyte); done
                     ;;
             esac
         done
     } < "$data"
 }
 
-get_fcoe_boot_vlan()
-{
+get_fcoe_boot_vlan() {
     data=${1:-/sys/firmware/efi/efivars/FcoeBootDevice-a0ebca23-5f9c-447a-a268-22b6c158c2ac}
     [ -f "$data" ] || return 1
     local IFS= LC_CTYPE=C tt len type hextype
     {
-        getword >/dev/null
-        getword >/dev/null
+        getword > /dev/null
+        getword > /dev/null
         while :; do
             type=$(getbyte) || return 1
             subtype=$(getbyte) || return 1
@@ -160,7 +157,7 @@ get_fcoe_boot_vlan()
                     ;;
                 *)
                     #printf "Unknown(Type:0x%02x SubType:0x%02x len=%d)\n" "$type" "$subtype" "$len" >&2
-                    for((i=0; i<len; i++)); do tt=$(getbyte); done
+                    for ((i = 0; i < len; i++)); do tt=$(getbyte); done
                     ;;
             esac
         done
index 72c2d8be674eaf7258715e7b73c860141d37a836..d8c6e5d59b084ea1c40e3ec38888b357a62f358a 100755 (executable)
@@ -7,7 +7,7 @@ rm -f -- /etc/lvm/lvm.conf
 udevadm control --reload
 set -e
 # save a partition at the beginning for future flagging purposes
-sfdisk /dev/sda <<EOF
+sfdisk /dev/sda << EOF
 ,1M
 ,
 EOF
@@ -22,4 +22,3 @@ umount /root
 echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/sda1
 sync
 poweroff -f
-
index 07fd0ed488976fe5f5cc06f2d16a75ef9479edf4..7d4dd52a06b29754f34b392577a45147c0f952f6 100755 (executable)
@@ -1,9 +1,9 @@
 #!/bin/sh
->/dev/watchdog
+> /dev/watchdog
 getcmdline() {
     while read -r _line || [ -n "$_line" ]; do
         printf "%s" "$_line"
-    done </proc/cmdline;
+    done < /proc/cmdline
 }
 
 _dogetarg() {
@@ -18,7 +18,7 @@ _dogetarg() {
             if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
                 # if $1 has a "=<value>", we want the exact match
                 if [ "$_o" = "$1" ]; then
-                    _val="1";
+                    _val="1"
                     unset _doecho
                 fi
                 continue
@@ -26,7 +26,7 @@ _dogetarg() {
 
             if [ "${_o#*=}" = "$_o" ]; then
                 # if cmdline argument has no "=<value>", we assume "=1"
-                _val="1";
+                _val="1"
                 unset _doecho
                 continue
             fi
@@ -36,18 +36,22 @@ _dogetarg() {
         fi
     done
     if [ -n "$_val" ]; then
-        [ "x$_doecho" != "x" ] && echo "$_val";
-        return 0;
+        [ "x$_doecho" != "x" ] && echo "$_val"
+        return 0
     fi
-    return 1;
+    return 1
 }
 
 getarg() {
     local _deprecated _newoption
     while [ $# -gt 0 ]; do
         case $1 in
-            -d) _deprecated=1; shift;;
-            -y) if _dogetarg $2 >/dev/null; then
+            -d)
+                _deprecated=1
+                shift
+                ;;
+            -y)
+                if _dogetarg $2 > /dev/null; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
                     fi
@@ -55,27 +59,32 @@ getarg() {
                     return 0
                 fi
                 _deprecated=0
-                shift 2;;
-            -n) if _dogetarg $2 >/dev/null; then
-                    echo 0;
+                shift 2
+                ;;
+            -n)
+                if _dogetarg $2 > /dev/null; then
+                    echo 0
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
                     fi
                     return 1
                 fi
                 _deprecated=0
-                shift 2;;
-            *)  if [ -z "$_newoption" ]; then
+                shift 2
+                ;;
+            *)
+                if [ -z "$_newoption" ]; then
                     _newoption="$1"
                 fi
                 if _dogetarg $1; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
                     fi
-                    return 0;
+                    return 0
                 fi
                 _deprecated=0
-                shift;;
+                shift
+                ;;
         esac
     done
     return 1
@@ -85,7 +94,8 @@ getargbool() {
     local _b
     unset _b
     local _default
-    _default="$1"; shift
+    _default="$1"
+    shift
     _b=$(getarg "$@")
     [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
     if [ -n "$_b" ]; then
@@ -97,9 +107,9 @@ getargbool() {
 }
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
-CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
+CMDLINE=$(while read line || [ -n "$line" ]; do echo $line; done < /proc/cmdline)
 plymouth --quit
-exec >/dev/console 2>&1
+exec > /dev/console 2>&1
 echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/sdb
 export TERM=linux
 export PS1='initramfs-test:\w\$ '
@@ -108,8 +118,8 @@ export PS1='initramfs-test:\w\$ '
 stty sane
 echo "made it to the rootfs!"
 if getargbool 0 rd.shell; then
-       strstr "$(setsid --help)" "control" && CTTY="-c"
-       setsid $CTTY sh -i
+    strstr "$(setsid --help)" "control" && CTTY="-c"
+    setsid $CTTY sh -i
 fi
 echo "Powering down."
 mount -n -o remount,ro /
index 9bc01c84c90846f5d6d370e8890c257885e6474d..2d4d2da7c0691e4977d5af7f7997d61c5c204108 100755 (executable)
@@ -37,8 +37,8 @@ test_setup() {
             done
         )
         inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
-                      mount dmesg dhclient mkdir cp ping dhclient \
-                      umount strace less setsid dd
+            mount dmesg dhclient mkdir cp ping dhclient \
+            umount strace less setsid dd
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [ -f ${_terminfodir}/l/linux ] && break
         done
@@ -48,7 +48,7 @@ test_setup() {
         inst_multiple grep
         inst_simple /etc/os-release
         inst ./test-init.sh /sbin/init
-        find_binary plymouth >/dev/null && inst_multiple plymouth
+        find_binary plymouth > /dev/null && inst_multiple plymouth
         cp -a /etc/ld.so.conf* $initdir/etc
         ldconfig -r "$initdir"
     )
@@ -67,21 +67,20 @@ test_setup() {
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-                       -m "dash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
-                       -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
-                       --nomdadmconf \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
+        -m "dash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
+        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
+        --nomdadmconf \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
     rm -rf -- $TESTDIR/overlay
     # Invoke KVM and/or QEMU to actually create the target filesystem.
 
     $testdir/run-qemu \
         -drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext3 \
         -append "root=/dev/dracut/root rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
-        -initrd $TESTDIR/initramfs.makeroot  || return 1
+        -initrd $TESTDIR/initramfs.makeroot || return 1
     grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created $TESTDIR/root.ext3 || return 1
 
-
     (
         export initdir=$TESTDIR/overlay
         . $basedir/dracut-init.sh
@@ -91,10 +90,10 @@ test_setup() {
         inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
     )
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-         -a "debug watchdog" \
-         -d "piix ide-gd_mod ata_piix ext3 sd_mod i6300esb ib700wdt" \
-         --no-hostonly-cmdline -N \
-         -f $TESTDIR/initramfs.testing $KVERSION || return 1
+        -a "debug watchdog" \
+        -d "piix ide-gd_mod ata_piix ext3 sd_mod i6300esb ib700wdt" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.testing $KVERSION || return 1
 
     #       -o "plymouth network md dmraid multipath fips caps crypt btrfs resume dmsquash-live dm"
 }
index 457a74bb0c3cab093b1ba18d1e475ac9b68cefcc..3ed7520412c3e871acd542f3720867d44f1e15ab 100755 (executable)
@@ -7,7 +7,7 @@ rm -f -- /etc/lvm/lvm.conf
 udevadm control --reload
 set -e
 # save a partition at the beginning for future flagging purposes
-sfdisk /dev/sda <<EOF
+sfdisk /dev/sda << EOF
 ,1M
 ,
 EOF
@@ -21,4 +21,3 @@ mkdir -p /root/run
 umount /root
 echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/sda1
 poweroff -f
-
index 66bd1c3ad8de9548ed7637abb3f868dbd7bf2ab5..7cf8de8bacbbe039e0abe5100253c74a37ab57ee 100755 (executable)
@@ -3,7 +3,7 @@
 getcmdline() {
     while read -r _line || [ -n "$_line" ]; do
         printf "%s" "$_line"
-    done </proc/cmdline;
+    done < /proc/cmdline
 }
 
 _dogetarg() {
@@ -18,7 +18,7 @@ _dogetarg() {
             if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
                 # if $1 has a "=<value>", we want the exact match
                 if [ "$_o" = "$1" ]; then
-                    _val="1";
+                    _val="1"
                     unset _doecho
                 fi
                 continue
@@ -26,7 +26,7 @@ _dogetarg() {
 
             if [ "${_o#*=}" = "$_o" ]; then
                 # if cmdline argument has no "=<value>", we assume "=1"
-                _val="1";
+                _val="1"
                 unset _doecho
                 continue
             fi
@@ -36,18 +36,22 @@ _dogetarg() {
         fi
     done
     if [ -n "$_val" ]; then
-        [ "x$_doecho" != "x" ] && echo "$_val";
-        return 0;
+        [ "x$_doecho" != "x" ] && echo "$_val"
+        return 0
     fi
-    return 1;
+    return 1
 }
 
 getarg() {
     local _deprecated _newoption
     while [ $# -gt 0 ]; do
         case $1 in
-            -d) _deprecated=1; shift;;
-            -y) if _dogetarg $2 >/dev/null; then
+            -d)
+                _deprecated=1
+                shift
+                ;;
+            -y)
+                if _dogetarg $2 > /dev/null; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
                     fi
@@ -55,27 +59,32 @@ getarg() {
                     return 0
                 fi
                 _deprecated=0
-                shift 2;;
-            -n) if _dogetarg $2 >/dev/null; then
-                    echo 0;
+                shift 2
+                ;;
+            -n)
+                if _dogetarg $2 > /dev/null; then
+                    echo 0
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
                     fi
                     return 1
                 fi
                 _deprecated=0
-                shift 2;;
-            *)  if [ -z "$_newoption" ]; then
+                shift 2
+                ;;
+            *)
+                if [ -z "$_newoption" ]; then
                     _newoption="$1"
                 fi
                 if _dogetarg $1; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
                     fi
-                    return 0;
+                    return 0
                 fi
                 _deprecated=0
-                shift;;
+                shift
+                ;;
         esac
     done
     return 1
@@ -85,7 +94,8 @@ getargbool() {
     local _b
     unset _b
     local _default
-    _default="$1"; shift
+    _default="$1"
+    shift
     _b=$(getarg "$@")
     [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
     if [ -n "$_b" ]; then
@@ -96,12 +106,11 @@ getargbool() {
     return 0
 }
 
-
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
 
 plymouth --quit
-exec </dev/console >/dev/console 2>&1
+exec < /dev/console > /dev/console 2>&1
 echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/sda1
 export TERM=linux
 export PS1='initramfs-test:\w\$ '
@@ -110,8 +119,8 @@ export PS1='initramfs-test:\w\$ '
 stty sane
 echo "made it to the rootfs!"
 if getargbool 0 rd.shell; then
-       strstr "$(setsid --help)" "control" && CTTY="-c"
-       setsid $CTTY sh -i
+    strstr "$(setsid --help)" "control" && CTTY="-c"
+    setsid $CTTY sh -i
 fi
 echo "Powering down."
 mount -n -o remount,ro /
index 0405efd02dcf78ccc47dc2471d723cfa79ba4dcb..d8c7a82b4a3f8f33320f686d0bf02240bf5d8f0d 100755 (executable)
@@ -34,8 +34,8 @@ test_setup() {
             mkdir -p -- var/lib/nfs/rpc_pipefs
         )
         inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
-                      mount dmesg dhclient mkdir cp ping dhclient \
-                      umount strace less setsid systemd-analyze dd
+            mount dmesg dhclient mkdir cp ping dhclient \
+            umount strace less setsid systemd-analyze dd
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [ -f ${_terminfodir}/l/linux ] && break
         done
@@ -45,7 +45,7 @@ test_setup() {
         inst_multiple grep
         inst_simple /etc/os-release
         inst ./test-init.sh /sbin/init
-        find_binary plymouth >/dev/null && inst_multiple plymouth
+        find_binary plymouth > /dev/null && inst_multiple plymouth
         cp -a /etc/ld.so.conf* $initdir/etc
         ldconfig -r "$initdir"
     )
@@ -64,21 +64,20 @@ test_setup() {
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-                       -m "dash udev-rules base rootfs-block fs-lib kernel-modules qemu" \
-                       -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
-                       --nomdadmconf \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
+        -m "dash udev-rules base rootfs-block fs-lib kernel-modules qemu" \
+        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
+        --nomdadmconf \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
     rm -rf -- $TESTDIR/overlay
     # Invoke KVM and/or QEMU to actually create the target filesystem.
 
     $testdir/run-qemu \
         -drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext3 \
         -append "root=/dev/fakeroot rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
-        -initrd $TESTDIR/initramfs.makeroot  || return 1
+        -initrd $TESTDIR/initramfs.makeroot || return 1
     grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created $TESTDIR/root.ext3 || return 1
 
-
     (
         export initdir=$TESTDIR/overlay
         . $basedir/dracut-init.sh
@@ -89,11 +88,11 @@ test_setup() {
         inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
     )
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-         -a "debug systemd" \
-         -o "network kernel-network-modules" \
-         -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
-         --no-hostonly-cmdline -N \
-         -f $TESTDIR/initramfs.testing $KVERSION || return 1
+        -a "debug systemd" \
+        -o "network kernel-network-modules" \
+        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.testing $KVERSION || return 1
 
     #       -o "plymouth network md dmraid multipath fips caps crypt btrfs resume dmsquash-live dm"
 }
index 9a41f97300cecf3850ab81e62027dc71f5254188..84ed88fb6be604e6593849ef375104b721756a9f 100755 (executable)
@@ -9,12 +9,12 @@ udevadm control --reload
 udevadm settle
 set -e
 # save a partition at the beginning for future flagging purposes
-sfdisk /dev/sda <<EOF
+sfdisk /dev/sda << EOF
 ,1M
 ,
 EOF
 
-sfdisk /dev/sdb <<EOF
+sfdisk /dev/sdb << EOF
 ,1M
 ,
 EOF
index d49372f684d581d9ef04f1507768806d8c8eb26f..cdeb58592500ddcb52056a479d7f3e2847b3c8c3 100755 (executable)
@@ -1,9 +1,9 @@
 #!/bin/sh
->/dev/watchdog
+> /dev/watchdog
 getcmdline() {
     while read -r _line || [ -n "$_line" ]; do
         printf "%s" "$_line"
-    done </proc/cmdline;
+    done < /proc/cmdline
 }
 
 _dogetarg() {
@@ -18,7 +18,7 @@ _dogetarg() {
             if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
                 # if $1 has a "=<value>", we want the exact match
                 if [ "$_o" = "$1" ]; then
-                    _val="1";
+                    _val="1"
                     unset _doecho
                 fi
                 continue
@@ -26,7 +26,7 @@ _dogetarg() {
 
             if [ "${_o#*=}" = "$_o" ]; then
                 # if cmdline argument has no "=<value>", we assume "=1"
-                _val="1";
+                _val="1"
                 unset _doecho
                 continue
             fi
@@ -36,18 +36,22 @@ _dogetarg() {
         fi
     done
     if [ -n "$_val" ]; then
-        [ "x$_doecho" != "x" ] && echo "$_val";
-        return 0;
+        [ "x$_doecho" != "x" ] && echo "$_val"
+        return 0
     fi
-    return 1;
+    return 1
 }
 
 getarg() {
     local _deprecated _newoption
     while [ $# -gt 0 ]; do
         case $1 in
-            -d) _deprecated=1; shift;;
-            -y) if _dogetarg $2 >/dev/null; then
+            -d)
+                _deprecated=1
+                shift
+                ;;
+            -y)
+                if _dogetarg $2 > /dev/null; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
                     fi
@@ -55,27 +59,32 @@ getarg() {
                     return 0
                 fi
                 _deprecated=0
-                shift 2;;
-            -n) if _dogetarg $2 >/dev/null; then
-                    echo 0;
+                shift 2
+                ;;
+            -n)
+                if _dogetarg $2 > /dev/null; then
+                    echo 0
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
                     fi
                     return 1
                 fi
                 _deprecated=0
-                shift 2;;
-            *)  if [ -z "$_newoption" ]; then
+                shift 2
+                ;;
+            *)
+                if [ -z "$_newoption" ]; then
                     _newoption="$1"
                 fi
                 if _dogetarg $1; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
                     fi
-                    return 0;
+                    return 0
                 fi
                 _deprecated=0
-                shift;;
+                shift
+                ;;
         esac
     done
     return 1
@@ -85,7 +94,8 @@ getargbool() {
     local _b
     unset _b
     local _default
-    _default="$1"; shift
+    _default="$1"
+    shift
     _b=$(getarg "$@")
     [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
     if [ -n "$_b" ]; then
@@ -97,9 +107,9 @@ getargbool() {
 }
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
-CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
+CMDLINE=$(while read line || [ -n "$line" ]; do echo $line; done < /proc/cmdline)
 plymouth --quit
-exec </dev/console >/dev/console 2>&1
+exec < /dev/console > /dev/console 2>&1
 
 ismounted() {
     while read a m a || [ -n "$m" ]; do
@@ -118,8 +128,8 @@ export PS1='initramfs-test:\w\$ '
 stty sane
 echo "made it to the rootfs!"
 if getargbool 0 rd.shell; then
-       strstr "$(setsid --help)" "control" && CTTY="-c"
-       setsid $CTTY sh -i
+    strstr "$(setsid --help)" "control" && CTTY="-c"
+    setsid $CTTY sh -i
 fi
 echo "Powering down."
 mount -n -o remount,ro /
index bac6d86d0339c7ed734515fe8bdac6ab9f095e84..af7c3df486be0fc8916f62af03db6220317c0486 100755 (executable)
@@ -8,7 +8,8 @@ KVERSION=${KVERSION-$(uname -r)}
 #DEBUGFAIL="rd.shell rd.break"
 
 client_run() {
-    local test_name="$1"; shift
+    local test_name="$1"
+    shift
     local client_opts="$*"
 
     echo "CLIENT TEST START: $test_name"
@@ -59,8 +60,8 @@ test_setup() {
             done
         )
         inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
-                      mount dmesg dhclient mkdir cp ping dhclient \
-                      umount strace less setsid dd
+            mount dmesg dhclient mkdir cp ping dhclient \
+            umount strace less setsid dd
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [ -f ${_terminfodir}/l/linux ] && break
         done
@@ -71,7 +72,7 @@ test_setup() {
         inst_simple ./fstab /etc/fstab
         inst_simple /etc/os-release
         inst ./test-init.sh /sbin/init
-        find_binary plymouth >/dev/null && inst_multiple plymouth
+        find_binary plymouth > /dev/null && inst_multiple plymouth
         cp -a /etc/ld.so.conf* $initdir/etc
         ldconfig -r "$initdir"
     )
@@ -90,12 +91,12 @@ test_setup() {
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-                       -m "dash udev-rules btrfs base rootfs-block fs-lib kernel-modules qemu" \
-                       -d "piix ide-gd_mod ata_piix btrfs sd_mod" \
-                       --nomdadmconf \
-                       --nohardlink \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
+        -m "dash udev-rules btrfs base rootfs-block fs-lib kernel-modules qemu" \
+        -d "piix ide-gd_mod ata_piix btrfs sd_mod" \
+        --nomdadmconf \
+        --nohardlink \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
 
     # Invoke KVM and/or QEMU to actually create the target filesystem.
 
@@ -108,7 +109,7 @@ test_setup() {
         -drive format=raw,index=0,media=disk,file=$TESTDIR/root.btrfs \
         -drive format=raw,index=1,media=disk,file=$TESTDIR/usr.btrfs \
         -append "root=/dev/dracut/root rw rootfstype=btrfs quiet console=ttyS0,115200n81 selinux=0" \
-        -initrd $TESTDIR/initramfs.makeroot  || return 1
+        -initrd $TESTDIR/initramfs.makeroot || return 1
     if ! grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created $TESTDIR/root.btrfs; then
         echo "Could not create root filesystem"
         return 1
@@ -123,11 +124,11 @@ test_setup() {
         inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
     )
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-         -a "debug watchdog" \
-         -o "network kernel-network-modules" \
-         -d "piix ide-gd_mod ata_piix btrfs sd_mod i6300esb ib700wdt" \
-         --no-hostonly-cmdline -N \
-         -f $TESTDIR/initramfs.testing $KVERSION || return 1
+        -a "debug watchdog" \
+        -o "network kernel-network-modules" \
+        -d "piix ide-gd_mod ata_piix btrfs sd_mod i6300esb ib700wdt" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.testing $KVERSION || return 1
 
     rm -rf -- $TESTDIR/overlay
 
index 73b9c32f96870b16b1c5b26edcb8d06464cae5fa..5b2c94f8b551c9b497e60c6accf651f1211c5aee 100755 (executable)
@@ -10,12 +10,12 @@ udevadm control --reload
 udevadm settle
 set -e
 # save a partition at the beginning for future flagging purposes
-sfdisk /dev/sda <<EOF
+sfdisk /dev/sda << EOF
 ,1M
 ,
 EOF
 
-sfdisk /dev/sdb <<EOF
+sfdisk /dev/sdb << EOF
 ,1M
 ,
 EOF
index 80fecb9509d4b61a6166ed35e1066d6d8fed2dd2..44077ef3bc9e2cfe0f9b628c08db2a40b61770a5 100755 (executable)
@@ -1,9 +1,9 @@
 #!/bin/sh
->/dev/watchdog
+> /dev/watchdog
 getcmdline() {
     while read -r _line || [ -n "$_line" ]; do
         printf "%s" "$_line"
-    done </proc/cmdline;
+    done < /proc/cmdline
 }
 
 _dogetarg() {
@@ -18,7 +18,7 @@ _dogetarg() {
             if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
                 # if $1 has a "=<value>", we want the exact match
                 if [ "$_o" = "$1" ]; then
-                    _val="1";
+                    _val="1"
                     unset _doecho
                 fi
                 continue
@@ -26,7 +26,7 @@ _dogetarg() {
 
             if [ "${_o#*=}" = "$_o" ]; then
                 # if cmdline argument has no "=<value>", we assume "=1"
-                _val="1";
+                _val="1"
                 unset _doecho
                 continue
             fi
@@ -36,18 +36,22 @@ _dogetarg() {
         fi
     done
     if [ -n "$_val" ]; then
-        [ "x$_doecho" != "x" ] && echo "$_val";
-        return 0;
+        [ "x$_doecho" != "x" ] && echo "$_val"
+        return 0
     fi
-    return 1;
+    return 1
 }
 
 getarg() {
     local _deprecated _newoption
     while [ $# -gt 0 ]; do
         case $1 in
-            -d) _deprecated=1; shift;;
-            -y) if _dogetarg $2 >/dev/null; then
+            -d)
+                _deprecated=1
+                shift
+                ;;
+            -y)
+                if _dogetarg $2 > /dev/null; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
                     fi
@@ -55,27 +59,32 @@ getarg() {
                     return 0
                 fi
                 _deprecated=0
-                shift 2;;
-            -n) if _dogetarg $2 >/dev/null; then
-                    echo 0;
+                shift 2
+                ;;
+            -n)
+                if _dogetarg $2 > /dev/null; then
+                    echo 0
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
                     fi
                     return 1
                 fi
                 _deprecated=0
-                shift 2;;
-            *)  if [ -z "$_newoption" ]; then
+                shift 2
+                ;;
+            *)
+                if [ -z "$_newoption" ]; then
                     _newoption="$1"
                 fi
                 if _dogetarg $1; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
                     fi
-                    return 0;
+                    return 0
                 fi
                 _deprecated=0
-                shift;;
+                shift
+                ;;
         esac
     done
     return 1
@@ -85,7 +94,8 @@ getargbool() {
     local _b
     unset _b
     local _default
-    _default="$1"; shift
+    _default="$1"
+    shift
     _b=$(getarg "$@")
     [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
     if [ -n "$_b" ]; then
@@ -97,9 +107,9 @@ getargbool() {
 }
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
-CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
+CMDLINE=$(while read line || [ -n "$line" ]; do echo $line; done < /proc/cmdline)
 plymouth --quit
-exec </dev/console >/dev/console 2>&1
+exec < /dev/console > /dev/console 2>&1
 
 ismounted() {
     while read a m a || [ -n "$a" ]; do
@@ -134,9 +144,9 @@ export PS1='initramfs-test:\w\$ '
 stty sane
 echo "made it to the rootfs!"
 if getargbool 0 rd.shell; then
-#      while sleep 1; do sleep 1;done
-       strstr "$(setsid --help)" "control" && CTTY="-c"
-       setsid $CTTY sh -i
+    #  while sleep 1; do sleep 1;done
+    strstr "$(setsid --help)" "control" && CTTY="-c"
+    setsid $CTTY sh -i
 fi
 set -x
 /usr/bin/systemctl poweroff
index dcd6d0434b3c38e0c348323ff5ceec065b7df078..a6f198c758563e2c43d3c06e031e1e5c7b6e5514 100755 (executable)
@@ -10,7 +10,8 @@ export KVERSION=${KVERSION-$(uname -r)}
 #DEBUGOUT="quiet systemd.log_level=debug systemd.log_target=console loglevel=77  rd.info rd.debug"
 DEBUGOUT="loglevel=0 "
 client_run() {
-    local test_name="$1"; shift
+    local test_name="$1"
+    shift
     local client_opts="$*"
 
     echo "CLIENT TEST START: $test_name"
@@ -64,8 +65,8 @@ test_setup() {
         ln -sfn /run/lock "$initdir/var/lock"
 
         inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
-                      mount dmesg mkdir cp ping dd \
-                      umount strace less setsid tree systemctl reset
+            mount dmesg mkdir cp ping dd \
+            umount strace less setsid tree systemctl reset
 
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [ -f ${_terminfodir}/l/linux ] && break
@@ -86,25 +87,25 @@ test_setup() {
         mkdir -p $initdir/var/log/journal
 
         # install some basic config files
-        inst_multiple -o  \
-                      /etc/machine-id \
-                      /etc/adjtime \
-                      /etc/passwd \
-                      /etc/shadow \
-                      /etc/group \
-                      /etc/shells \
-                      /etc/nsswitch.conf \
-                      /etc/pam.conf \
-                      /etc/securetty \
-                      /etc/os-release \
-                      /etc/localtime
+        inst_multiple -o \
+            /etc/machine-id \
+            /etc/adjtime \
+            /etc/passwd \
+            /etc/shadow \
+            /etc/group \
+            /etc/shells \
+            /etc/nsswitch.conf \
+            /etc/pam.conf \
+            /etc/securetty \
+            /etc/os-release \
+            /etc/localtime
 
         # we want an empty environment
         > $initdir/etc/environment
 
         # setup the testsuite target
         mkdir -p $initdir/etc/systemd/system
-        cat >$initdir/etc/systemd/system/testsuite.target <<EOF
+        cat > $initdir/etc/systemd/system/testsuite.target << EOF
 [Unit]
 Description=Testsuite target
 Requires=basic.target
@@ -116,7 +117,7 @@ EOF
         inst ./test-init.sh /sbin/test-init
 
         # setup the testsuite service
-        cat >$initdir/etc/systemd/system/testsuite.service <<EOF
+        cat > $initdir/etc/systemd/system/testsuite.service << EOF
 [Unit]
 Description=Testsuite service
 After=basic.target
@@ -141,7 +142,7 @@ EOF
 
         # install basic tools needed
         inst_multiple sh bash setsid loadkeys setfont \
-                      login sushell sulogin gzip sleep echo mount umount
+            login sushell sulogin gzip sleep echo mount umount
         inst_multiple modprobe
 
         # install libnss_files for login
@@ -155,8 +156,8 @@ EOF
             /lib64/security \
             /lib/security -xtype f \
             | while read file || [ -n "$file" ]; do
-            inst_multiple -o $file
-        done
+                inst_multiple -o $file
+            done
 
         # install dbus socket and service file
         inst /usr/lib/systemd/system/dbus.socket
@@ -167,7 +168,7 @@ EOF
         (
             echo "FONT=eurlatgr"
             echo "KEYMAP=us"
-        ) >$initrd/etc/vconsole.conf
+        ) > $initrd/etc/vconsole.conf
 
         # install basic keyboard maps and fonts
         for i in \
@@ -192,9 +193,10 @@ EOF
         # install any Execs from the service files
         grep -Eho '^Exec[^ ]*=[^ ]+' $initdir/lib/systemd/system/*.service \
             | while read i || [ -n "$i" ]; do
-            i=${i##Exec*=}; i=${i##-}
-            inst_multiple -o $i
-        done
+                i=${i##Exec*=}
+                i=${i##-}
+                inst_multiple -o $i
+            done
 
         # some helper tools for debugging
         [[ $DEBUGTOOLS ]] && inst_multiple $DEBUGTOOLS
@@ -209,8 +211,8 @@ EOF
         inst /lib/modules/$kernel/modules.order
         inst /lib/modules/$kernel/modules.builtin
         # generate module dependencies
-        if [[ -d $initdir/lib/modules/$kernel ]] && \
-               ! depmod -a -b "$initdir" $kernel; then
+        if [[ -d $initdir/lib/modules/$kernel ]] \
+            && ! depmod -a -b "$initdir" $kernel; then
             dfatal "\"depmod -a $kernel\" failed."
             exit 1
         fi
@@ -233,12 +235,12 @@ EOF
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-                       -m "bash udev-rules btrfs base rootfs-block fs-lib kernel-modules qemu" \
-                       -d "piix ide-gd_mod ata_piix btrfs sd_mod" \
-                       --nomdadmconf \
-                       --nohardlink \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
+        -m "bash udev-rules btrfs base rootfs-block fs-lib kernel-modules qemu" \
+        -d "piix ide-gd_mod ata_piix btrfs sd_mod" \
+        --nomdadmconf \
+        --nohardlink \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
 
     # Invoke KVM and/or QEMU to actually create the target filesystem.
     rm -rf -- $TESTDIR/overlay
@@ -249,7 +251,7 @@ EOF
         -drive format=raw,index=1,media=disk,file=$TESTDIR/usr.btrfs \
         -drive format=raw,index=2,media=disk,file=$TESTDIR/result \
         -append "root=/dev/fakeroot rw rootfstype=btrfs quiet console=ttyS0,115200n81 selinux=0" \
-        -initrd $TESTDIR/initramfs.makeroot  || return 1
+        -initrd $TESTDIR/initramfs.makeroot || return 1
     if ! grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created $TESTDIR/result; then
         echo "Could not create root filesystem"
         return 1
@@ -268,12 +270,12 @@ EOF
     [ -e /etc/machine-info ] && EXTRA_MACHINE+=" /etc/machine-info"
 
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-         -a "debug systemd i18n qemu" \
-         ${EXTRA_MACHINE:+-I "$EXTRA_MACHINE"} \
-         -o "dash network plymouth lvm mdraid resume crypt caps dm terminfo usrmount kernel-network-modules rngd" \
-         -d "piix ide-gd_mod ata_piix btrfs sd_mod i6300esb ib700wdt" \
-         --no-hostonly-cmdline -N \
-         -f $TESTDIR/initramfs.testing $KVERSION || return 1
+        -a "debug systemd i18n qemu" \
+        ${EXTRA_MACHINE:+-I "$EXTRA_MACHINE"} \
+        -o "dash network plymouth lvm mdraid resume crypt caps dm terminfo usrmount kernel-network-modules rngd" \
+        -d "piix ide-gd_mod ata_piix btrfs sd_mod i6300esb ib700wdt" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.testing $KVERSION || return 1
 
     rm -rf -- $TESTDIR/overlay
 }
index 2f35e49070d26ec8ba2727a48566addd969047be..2af3c926701b5f54f23976947a44bd3fb99fc64c 100755 (executable)
@@ -7,7 +7,7 @@ rm -f -- /etc/lvm/lvm.conf
 udevadm control --reload
 udevadm settle
 # save a partition at the beginning for future flagging purposes
-sfdisk /dev/sda <<EOF
+sfdisk /dev/sda << EOF
 ,4M
 ,41M
 ,41M
@@ -19,14 +19,14 @@ mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/sda2 /d
 # randomly.
 mdadm -W /dev/md0
 set -e
-printf test >keyfile
+printf test > keyfile
 cryptsetup -q luksFormat /dev/md0 /keyfile
 echo "The passphrase is test"
-cryptsetup luksOpen /dev/md0 dracut_crypt_test </keyfile
-lvm pvcreate -ff  -y /dev/mapper/dracut_crypt_test
+cryptsetup luksOpen /dev/md0 dracut_crypt_test < /keyfile
+lvm pvcreate -ff -y /dev/mapper/dracut_crypt_test
 lvm vgcreate dracut /dev/mapper/dracut_crypt_test
-lvm lvcreate -l 100%FREE -n root dracut && \
-lvm vgchange -ay
+lvm lvcreate -l 100%FREE -n root dracut \
+    && lvm vgchange -ay
 mke2fs /dev/dracut/root
 mkdir -p /sysroot
 mount /dev/dracut/root /sysroot
@@ -36,7 +36,10 @@ lvm lvchange -a n /dev/dracut/root
 udevadm settle
 cryptsetup luksClose /dev/mapper/dracut_crypt_test
 udevadm settle
-eval $(udevadm info --query=env --name=/dev/md0|while read line || [ -n "$line" ]; do [ "$line" != "${line#*ID_FS_UUID*}" ] && echo $line; done;)
-{ echo "dracut-root-block-created"; echo "ID_FS_UUID=$ID_FS_UUID"; } | dd oflag=direct,dsync of=/dev/sda1
+eval $(udevadm info --query=env --name=/dev/md0 | while read line || [ -n "$line" ]; do [ "$line" != "${line#*ID_FS_UUID*}" ] && echo $line; done)
+{
+    echo "dracut-root-block-created"
+    echo "ID_FS_UUID=$ID_FS_UUID"
+} | dd oflag=direct,dsync of=/dev/sda1
 sync
 poweroff -f
index c39eff6e91d1880925dde919bc8dc67989d71a1a..7e956b38d4b86aa57f31083454f2bde2cc45c10d 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
 
 [ -b "/dev/mapper/$2" ] && exit 0
-printf test >/keyfile
-/sbin/cryptsetup luksOpen "$1" "$2" </keyfile
+printf test > /keyfile
+/sbin/cryptsetup luksOpen "$1" "$2" < /keyfile
index 1d9c9a8862d935ba6045aa77582b2b305c350253..8a26a1899fe8225c7fd5efd032a93acc9fe1bb86 100755 (executable)
@@ -3,7 +3,7 @@ export PATH=/sbin:/bin:/usr/sbin:/usr/bin
 getcmdline() {
     while read -r _line || [ -n "$_line" ]; do
         printf "%s" "$_line"
-    done </proc/cmdline;
+    done < /proc/cmdline
 }
 
 _dogetarg() {
@@ -18,7 +18,7 @@ _dogetarg() {
             if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
                 # if $1 has a "=<value>", we want the exact match
                 if [ "$_o" = "$1" ]; then
-                    _val="1";
+                    _val="1"
                     unset _doecho
                 fi
                 continue
@@ -26,7 +26,7 @@ _dogetarg() {
 
             if [ "${_o#*=}" = "$_o" ]; then
                 # if cmdline argument has no "=<value>", we assume "=1"
-                _val="1";
+                _val="1"
                 unset _doecho
                 continue
             fi
@@ -36,18 +36,22 @@ _dogetarg() {
         fi
     done
     if [ -n "$_val" ]; then
-        [ "x$_doecho" != "x" ] && echo "$_val";
-        return 0;
+        [ "x$_doecho" != "x" ] && echo "$_val"
+        return 0
     fi
-    return 1;
+    return 1
 }
 
 getarg() {
     local _deprecated _newoption
     while [ $# -gt 0 ]; do
         case $1 in
-            -d) _deprecated=1; shift;;
-            -y) if _dogetarg $2 >/dev/null; then
+            -d)
+                _deprecated=1
+                shift
+                ;;
+            -y)
+                if _dogetarg $2 > /dev/null; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
                     fi
@@ -55,27 +59,32 @@ getarg() {
                     return 0
                 fi
                 _deprecated=0
-                shift 2;;
-            -n) if _dogetarg $2 >/dev/null; then
-                    echo 0;
+                shift 2
+                ;;
+            -n)
+                if _dogetarg $2 > /dev/null; then
+                    echo 0
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
                     fi
                     return 1
                 fi
                 _deprecated=0
-                shift 2;;
-            *)  if [ -z "$_newoption" ]; then
+                shift 2
+                ;;
+            *)
+                if [ -z "$_newoption" ]; then
                     _newoption="$1"
                 fi
                 if _dogetarg $1; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
                     fi
-                    return 0;
+                    return 0
                 fi
                 _deprecated=0
-                shift;;
+                shift
+                ;;
         esac
     done
     return 1
@@ -85,7 +94,8 @@ getargbool() {
     local _b
     unset _b
     local _default
-    _default="$1"; shift
+    _default="$1"
+    shift
     _b=$(getarg "$@")
     [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
     if [ -n "$_b" ]; then
@@ -96,9 +106,9 @@ getargbool() {
     return 0
 }
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
-CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
-command -v plymouth >/dev/null && plymouth --quit
-exec >/dev/console 2>&1
+CMDLINE=$(while read line || [ -n "$line" ]; do echo $line; done < /proc/cmdline)
+command -v plymouth > /dev/null && plymouth --quit
+exec > /dev/console 2>&1
 echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/sda1
 export TERM=linux
 export PS1='initramfs-test:\w\$ '
index e0f0b2d9610919daca6ff9d6012b289e23977b8d..8bc84dbedc559e8bec7a40ac6e2d5038b0a6d773 100755 (executable)
@@ -35,7 +35,7 @@ test_setup() {
             done
         )
         inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
-                      mount dmesg dhclient mkdir cp ping dhclient dd
+            mount dmesg dhclient mkdir cp ping dhclient dd
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [ -f ${_terminfodir}/l/linux ] && break
         done
@@ -46,7 +46,7 @@ test_setup() {
         inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
         inst_multiple grep
         inst_multiple -o /lib/systemd/systemd-shutdown
-        find_binary plymouth >/dev/null && inst_multiple plymouth
+        find_binary plymouth > /dev/null && inst_multiple plymouth
         cp -a /etc/ld.so.conf* $initdir/etc
         ldconfig -r "$initdir"
     )
@@ -65,17 +65,17 @@ test_setup() {
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-                       -m "bash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
-                       -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
-                       --nomdadmconf \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
+        -m "bash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
+        -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
+        --nomdadmconf \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
     rm -rf -- $TESTDIR/overlay
     # Invoke KVM and/or QEMU to actually create the target filesystem.
     $testdir/run-qemu \
         -drive format=raw,index=0,media=disk,file=$DISKIMAGE \
         -append "root=/dev/cannotreach rw rootfstype=ext2 console=ttyS0,115200n81 selinux=0" \
-        -initrd $TESTDIR/initramfs.makeroot  || return 1
+        -initrd $TESTDIR/initramfs.makeroot || return 1
     grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created $DISKIMAGE || return 1
     eval $(grep -F -a -m 1 ID_FS_UUID $DISKIMAGE)
 
@@ -94,11 +94,11 @@ test_setup() {
     )
 
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-         -o "plymouth network kernel-network-modules" \
-         -a "debug" \
-         -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
-         --no-hostonly-cmdline -N \
-         -f $TESTDIR/initramfs.testing $KVERSION || return 1
+        -o "plymouth network kernel-network-modules" \
+        -a "debug" \
+        -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.testing $KVERSION || return 1
 }
 
 test_cleanup() {
index fecb494a6b9013b1880b89b63c10165fb8eaf354..ef2529954e537b051a99001f5db90c327b770d2c 100755 (executable)
@@ -7,7 +7,7 @@ rm -f -- /etc/lvm/lvm.conf
 udevadm control --reload
 udevadm settle
 # save a partition at the beginning for future flagging purposes
-sfdisk /dev/sda <<EOF
+sfdisk /dev/sda << EOF
 ,2M
 ,20M
 ,20M
@@ -15,19 +15,19 @@ sfdisk /dev/sda <<EOF
 EOF
 udevadm settle
 for i in sda2 sda3 sda4; do
-lvm pvcreate -ff  -y /dev/$i ;
-done && \
-lvm vgcreate dracut /dev/sda[234] && \
-lvm lvcreate -l 100%FREE -n root dracut && \
-lvm vgchange -ay && \
-mke2fs /dev/dracut/root && \
-mkdir -p /sysroot && \
-mount /dev/dracut/root /sysroot && \
-cp -a -t /sysroot /source/* && \
-umount /sysroot && \
-sleep 1 && \
-lvm lvchange -a n /dev/dracut/root && \
-sleep 1 && \
-echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/sda1
+    lvm pvcreate -ff -y /dev/$i
+done \
+    && lvm vgcreate dracut /dev/sda[234] \
+    && lvm lvcreate -l 100%FREE -n root dracut \
+    && lvm vgchange -ay \
+    && mke2fs /dev/dracut/root \
+    && mkdir -p /sysroot \
+    && mount /dev/dracut/root /sysroot \
+    && cp -a -t /sysroot /source/* \
+    && umount /sysroot \
+    && sleep 1 \
+    && lvm lvchange -a n /dev/dracut/root \
+    && sleep 1 \
+    && echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/sda1
 sync
 poweroff -f
index 975bfece3dc669c5c0031deaf5ff80a82aaca9f4..6f2941d72b79715c0f3411dc68c85efed19acc84 100755 (executable)
@@ -3,7 +3,7 @@ export PATH=/sbin:/bin:/usr/sbin:/usr/bin
 getcmdline() {
     while read -r _line || [ -n "$_line" ]; do
         printf "%s" "$_line"
-    done </proc/cmdline;
+    done < /proc/cmdline
 }
 
 _dogetarg() {
@@ -18,7 +18,7 @@ _dogetarg() {
             if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
                 # if $1 has a "=<value>", we want the exact match
                 if [ "$_o" = "$1" ]; then
-                    _val="1";
+                    _val="1"
                     unset _doecho
                 fi
                 continue
@@ -26,7 +26,7 @@ _dogetarg() {
 
             if [ "${_o#*=}" = "$_o" ]; then
                 # if cmdline argument has no "=<value>", we assume "=1"
-                _val="1";
+                _val="1"
                 unset _doecho
                 continue
             fi
@@ -36,18 +36,22 @@ _dogetarg() {
         fi
     done
     if [ -n "$_val" ]; then
-        [ "x$_doecho" != "x" ] && echo "$_val";
-        return 0;
+        [ "x$_doecho" != "x" ] && echo "$_val"
+        return 0
     fi
-    return 1;
+    return 1
 }
 
 getarg() {
     local _deprecated _newoption
     while [ $# -gt 0 ]; do
         case $1 in
-            -d) _deprecated=1; shift;;
-            -y) if _dogetarg $2 >/dev/null; then
+            -d)
+                _deprecated=1
+                shift
+                ;;
+            -y)
+                if _dogetarg $2 > /dev/null; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
                     fi
@@ -55,27 +59,32 @@ getarg() {
                     return 0
                 fi
                 _deprecated=0
-                shift 2;;
-            -n) if _dogetarg $2 >/dev/null; then
-                    echo 0;
+                shift 2
+                ;;
+            -n)
+                if _dogetarg $2 > /dev/null; then
+                    echo 0
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
                     fi
                     return 1
                 fi
                 _deprecated=0
-                shift 2;;
-            *)  if [ -z "$_newoption" ]; then
+                shift 2
+                ;;
+            *)
+                if [ -z "$_newoption" ]; then
                     _newoption="$1"
                 fi
                 if _dogetarg $1; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
                     fi
-                    return 0;
+                    return 0
                 fi
                 _deprecated=0
-                shift;;
+                shift
+                ;;
         esac
     done
     return 1
@@ -85,7 +94,8 @@ getargbool() {
     local _b
     unset _b
     local _default
-    _default="$1"; shift
+    _default="$1"
+    shift
     _b=$(getarg "$@")
     [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
     if [ -n "$_b" ]; then
@@ -96,9 +106,9 @@ getargbool() {
     return 0
 }
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
-CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
+CMDLINE=$(while read line || [ -n "$line" ]; do echo $line; done < /proc/cmdline)
 plymouth --quit
-exec >/dev/console 2>&1
+exec > /dev/console 2>&1
 echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/sda1
 export TERM=linux
 export PS1='initramfs-test:\w\$ '
index 775d57651b97b42e77c2f01202b3ab92b2409fdd..984518a35becafafb31ab6be1dd40215053b35e4 100755 (executable)
@@ -33,7 +33,7 @@ test_setup() {
             mkdir -p -- var/lib/nfs/rpc_pipefs
         )
         inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
-                      mount dmesg dhclient mkdir cp ping dhclient dd
+            mount dmesg dhclient mkdir cp ping dhclient dd
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [ -f ${_terminfodir}/l/linux ] && break
         done
@@ -43,7 +43,7 @@ test_setup() {
         inst_multiple grep
         inst_simple /etc/os-release
         inst ./test-init.sh /sbin/init
-        find_binary plymouth >/dev/null && inst_multiple plymouth
+        find_binary plymouth > /dev/null && inst_multiple plymouth
         cp -a /etc/ld.so.conf* $initdir/etc
         mkdir -p $initdir/run
         ldconfig -r "$initdir"
@@ -63,15 +63,15 @@ test_setup() {
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-                       -m "bash lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
-                       -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
+        -m "bash lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
+        -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
     rm -rf -- $TESTDIR/overlay
     # Invoke KVM and/or QEMU to actually create the target filesystem.
     $testdir/run-qemu -drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
-                      -append "root=/dev/fakeroot rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
-                      -initrd $TESTDIR/initramfs.makeroot  || return 1
+        -append "root=/dev/fakeroot rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
+        -initrd $TESTDIR/initramfs.makeroot || return 1
     grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1
     (
         export initdir=$TESTDIR/overlay
@@ -82,11 +82,11 @@ test_setup() {
         inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
     )
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-         -o "plymouth network kernel-network-modules" \
-         -a "debug" \
-         -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
-         --no-hostonly-cmdline -N \
-         -f $TESTDIR/initramfs.testing $KVERSION || return 1
+        -o "plymouth network kernel-network-modules" \
+        -a "debug" \
+        -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.testing $KVERSION || return 1
 }
 
 test_cleanup() {
index 6f3e61dbdfb6ae0cae6d69b948c4c36caadc3b04..77273411b94c1f2fc7da566ec921c62c7ed6024d 100755 (executable)
@@ -14,13 +14,13 @@ mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/sdb /de
 # wait for the array to finish initailizing, otherwise this sometimes fails
 # randomly.
 mdadm -W /dev/md0
-printf test >keyfile
+printf test > keyfile
 cryptsetup -q luksFormat /dev/md0 /keyfile
 echo "The passphrase is test"
 set -e
 set -x
-cryptsetup luksOpen /dev/md0 dracut_crypt_test </keyfile
-lvm pvcreate -ff  -y /dev/mapper/dracut_crypt_test
+cryptsetup luksOpen /dev/md0 dracut_crypt_test < /keyfile
+lvm pvcreate -ff -y /dev/mapper/dracut_crypt_test
 lvm vgcreate dracut /dev/mapper/dracut_crypt_test
 lvm lvcreate -l 100%FREE -n root dracut
 lvm vgchange -ay
@@ -36,10 +36,14 @@ cryptsetup luksClose /dev/mapper/dracut_crypt_test
 udevadm settle
 mdadm -W /dev/md0 || :
 udevadm settle
-mdadm --detail --export /dev/md0 |grep -F MD_UUID > /tmp/mduuid
+mdadm --detail --export /dev/md0 | grep -F MD_UUID > /tmp/mduuid
 . /tmp/mduuid
 udevadm settle
-eval $(udevadm info --query=env --name=/dev/md0|while read line || [ -n "$line" ]; do [ "$line" != "${line#*ID_FS_UUID*}" ] && echo $line; done;)
-{ echo "dracut-root-block-created"; echo MD_UUID=$MD_UUID;  echo "ID_FS_UUID=$ID_FS_UUID";} | dd oflag=direct,dsync of=/dev/sda
+eval $(udevadm info --query=env --name=/dev/md0 | while read line || [ -n "$line" ]; do [ "$line" != "${line#*ID_FS_UUID*}" ] && echo $line; done)
+{
+    echo "dracut-root-block-created"
+    echo MD_UUID=$MD_UUID
+    echo "ID_FS_UUID=$ID_FS_UUID"
+} | dd oflag=direct,dsync of=/dev/sda
 sync
 poweroff -f
index 78ed7f5f238a53c3ef9a37c74d66c45a0aaad6cd..7318fa7068f90c5957f13e7975f0dbd5b8ca9d86 100755 (executable)
@@ -1,6 +1,5 @@
 #!/bin/sh
 
 [ -b /dev/mapper/$2 ] && exit 0
-printf test >/keyfile
-/sbin/cryptsetup luksOpen $1 $2 </keyfile
-
+printf test > /keyfile
+/sbin/cryptsetup luksOpen $1 $2 < /keyfile
index 1e41a0a44ade3f42aa4afb163b4fa94cb16622b7..fe022db5ebe74776035185ba60c533dd865c48d1 100755 (executable)
@@ -3,7 +3,7 @@ export PATH=/sbin:/bin:/usr/sbin:/usr/bin
 getcmdline() {
     while read -r _line || [ -n "$_line" ]; do
         printf "%s" "$_line"
-    done </proc/cmdline;
+    done < /proc/cmdline
 }
 
 _dogetarg() {
@@ -18,7 +18,7 @@ _dogetarg() {
             if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
                 # if $1 has a "=<value>", we want the exact match
                 if [ "$_o" = "$1" ]; then
-                    _val="1";
+                    _val="1"
                     unset _doecho
                 fi
                 continue
@@ -26,7 +26,7 @@ _dogetarg() {
 
             if [ "${_o#*=}" = "$_o" ]; then
                 # if cmdline argument has no "=<value>", we assume "=1"
-                _val="1";
+                _val="1"
                 unset _doecho
                 continue
             fi
@@ -36,18 +36,22 @@ _dogetarg() {
         fi
     done
     if [ -n "$_val" ]; then
-        [ "x$_doecho" != "x" ] && echo "$_val";
-        return 0;
+        [ "x$_doecho" != "x" ] && echo "$_val"
+        return 0
     fi
-    return 1;
+    return 1
 }
 
 getarg() {
     local _deprecated _newoption
     while [ $# -gt 0 ]; do
         case $1 in
-            -d) _deprecated=1; shift;;
-            -y) if _dogetarg $2 >/dev/null; then
+            -d)
+                _deprecated=1
+                shift
+                ;;
+            -y)
+                if _dogetarg $2 > /dev/null; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
                     fi
@@ -55,27 +59,32 @@ getarg() {
                     return 0
                 fi
                 _deprecated=0
-                shift 2;;
-            -n) if _dogetarg $2 >/dev/null; then
-                    echo 0;
+                shift 2
+                ;;
+            -n)
+                if _dogetarg $2 > /dev/null; then
+                    echo 0
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
                     fi
                     return 1
                 fi
                 _deprecated=0
-                shift 2;;
-            *)  if [ -z "$_newoption" ]; then
+                shift 2
+                ;;
+            *)
+                if [ -z "$_newoption" ]; then
                     _newoption="$1"
                 fi
                 if _dogetarg $1; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
                     fi
-                    return 0;
+                    return 0
                 fi
                 _deprecated=0
-                shift;;
+                shift
+                ;;
         esac
     done
     return 1
@@ -85,7 +94,8 @@ getargbool() {
     local _b
     unset _b
     local _default
-    _default="$1"; shift
+    _default="$1"
+    shift
     _b=$(getarg "$@")
     [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
     if [ -n "$_b" ]; then
@@ -96,9 +106,9 @@ getargbool() {
     return 0
 }
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
-CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
-command -v plymouth >/dev/null && plymouth --quit
-exec >/dev/console 2>&1
+CMDLINE=$(while read line || [ -n "$line" ]; do echo $line; done < /proc/cmdline)
+command -v plymouth > /dev/null && plymouth --quit
+exec > /dev/console 2>&1
 echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/sda
 export TERM=linux
 export PS1='initramfs-test:\w\$ '
index 499a3bcda1e4493aefd4419b0b50f5097d295d61..3dbb0bb1d32ea67dd82b5f38ec28b9f3250d2c20 100755 (executable)
@@ -22,7 +22,7 @@ client_run() {
         -initrd $TESTDIR/initramfs.testing
     if ! grep -U --binary-files=binary -F -m 1 -q dracut-root-block-success $TESTDIR/marker.img; then
         echo "CLIENT TEST END: $@ [FAIL]"
-        return 1;
+        return 1
     fi
     rm -f -- $TESTDIR/marker.img
     dd if=/dev/zero of=$TESTDIR/marker.img bs=1M count=40
@@ -38,7 +38,6 @@ test_run() {
     client_run failme && return 1
     client_run rd.auto || return 1
 
-
     client_run rd.luks.uuid=$LUKS_UUID rd.md.uuid=$MD_UUID rd.md.conf=0 rd.lvm.vg=dracut || return 1
 
     client_run rd.luks.uuid=$LUKS_UUID rd.md.uuid=failme rd.md.conf=0 rd.lvm.vg=dracut failme && return 1
@@ -75,7 +74,7 @@ test_setup() {
             done
         )
         inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
-                      mount dmesg dhclient mkdir cp ping dhclient dd
+            mount dmesg dhclient mkdir cp ping dhclient dd
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [ -f ${_terminfodir}/l/linux ] && break
         done
@@ -85,7 +84,7 @@ test_setup() {
         inst_multiple grep
         inst_simple /etc/os-release
         inst ./test-init.sh /sbin/init
-        find_binary plymouth >/dev/null && inst_multiple plymouth
+        find_binary plymouth > /dev/null && inst_multiple plymouth
         cp -a /etc/ld.so.conf* $initdir/etc
         ldconfig -r "$initdir"
     )
@@ -104,10 +103,10 @@ test_setup() {
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-                       -m "bash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
-                       -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
+        -m "bash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
+        -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
     rm -rf -- $TESTDIR/overlay
     # Invoke KVM and/or QEMU to actually create the target filesystem.
     $testdir/run-qemu \
@@ -116,7 +115,7 @@ test_setup() {
         -drive format=raw,index=2,media=disk,file=$TESTDIR/disk2.img \
         -drive format=raw,index=3,media=disk,file=$TESTDIR/disk3.img \
         -append "root=/dev/fakeroot rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
-        -initrd $TESTDIR/initramfs.makeroot  || return 1
+        -initrd $TESTDIR/initramfs.makeroot || return 1
 
     grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created $TESTDIR/marker.img || return 1
     eval $(grep -F --binary-files=text -m 1 MD_UUID $TESTDIR/marker.img)
@@ -140,11 +139,11 @@ test_setup() {
     )
 
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-         -o "plymouth network kernel-network-modules" \
-         -a "debug" \
-         -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
-         --no-hostonly-cmdline -N \
-         -f $TESTDIR/initramfs.testing $KVERSION || return 1
+        -o "plymouth network kernel-network-modules" \
+        -a "debug" \
+        -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.testing $KVERSION || return 1
 }
 
 test_cleanup() {
index fae9956905309053061ae5eb95b0341c3d19cfd9..b09dd0fe9f8085bf6df142ce992b13e8bffdb4b8 100755 (executable)
@@ -8,50 +8,52 @@ rm -f -- /etc/lvm/lvm.conf
 udevadm control --reload
 udevadm settle
 # save a partition at the beginning for future flagging purposes
-sfdisk /dev/sda <<EOF
+sfdisk /dev/sda << EOF
 ,4M
 ,43M
 ,43M
 ,43M
 EOF
 udevadm settle
-printf test >keyfile
+printf test > keyfile
 cryptsetup -q luksFormat /dev/sda2 /keyfile
 cryptsetup -q luksFormat /dev/sda3 /keyfile
 cryptsetup -q luksFormat /dev/sda4 /keyfile
-cryptsetup luksOpen /dev/sda2 dracut_sda2 </keyfile
-cryptsetup luksOpen /dev/sda3 dracut_sda3 </keyfile
-cryptsetup luksOpen /dev/sda4 dracut_sda4 </keyfile
+cryptsetup luksOpen /dev/sda2 dracut_sda2 < /keyfile
+cryptsetup luksOpen /dev/sda3 dracut_sda3 < /keyfile
+cryptsetup luksOpen /dev/sda4 dracut_sda4 < /keyfile
 mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/mapper/dracut_sda2 /dev/mapper/dracut_sda3 /dev/mapper/dracut_sda4
 # wait for the array to finish initailizing, otherwise this sometimes fails
 # randomly.
 mdadm -W /dev/md0
-lvm pvcreate -ff  -y /dev/md0 && \
-lvm vgcreate dracut /dev/md0 && \
-lvm lvcreate -l 100%FREE -n root dracut && \
-lvm vgchange -ay && \
-mke2fs /dev/dracut/root && \
-mkdir -p /sysroot && \
-mount /dev/dracut/root /sysroot && \
-cp -a -t /sysroot /source/* && \
-umount /sysroot && \
-sleep 2 && \
-lvm lvchange -a n /dev/dracut/root && \
-sleep 2 && \
-lvm vgchange -a n dracut && \
-{
-lvm vgdisplay  && \
-{ mdadm -W /dev/md0 || :;} && \
-mdadm --stop /dev/md0 && \
-cryptsetup luksClose /dev/mapper/dracut_sda2 && \
-cryptsetup luksClose /dev/mapper/dracut_sda3 && \
-cryptsetup luksClose /dev/mapper/dracut_sda4 && \
-:; :;} && \
-{
-    echo "dracut-root-block-created"
-    for i in /dev/sda[234]; do
-       udevadm info --query=env --name=$i|grep -F 'ID_FS_UUID='
-    done
-} | dd oflag=direct,dsync of=/dev/sda1
+lvm pvcreate -ff -y /dev/md0 \
+    && lvm vgcreate dracut /dev/md0 \
+    && lvm lvcreate -l 100%FREE -n root dracut \
+    && lvm vgchange -ay \
+    && mke2fs /dev/dracut/root \
+    && mkdir -p /sysroot \
+    && mount /dev/dracut/root /sysroot \
+    && cp -a -t /sysroot /source/* \
+    && umount /sysroot \
+    && sleep 2 \
+    && lvm lvchange -a n /dev/dracut/root \
+    && sleep 2 \
+    && lvm vgchange -a n dracut \
+    && {
+        lvm vgdisplay \
+            && { mdadm -W /dev/md0 || :; } \
+            && mdadm --stop /dev/md0 \
+            && cryptsetup luksClose /dev/mapper/dracut_sda2 \
+            && cryptsetup luksClose /dev/mapper/dracut_sda3 \
+            && cryptsetup luksClose /dev/mapper/dracut_sda4 \
+            && :
+        :
+    } \
+    && {
+        echo "dracut-root-block-created"
+        for i in /dev/sda[234]; do
+            udevadm info --query=env --name=$i | grep -F 'ID_FS_UUID='
+        done
+    } | dd oflag=direct,dsync of=/dev/sda1
 sync
 poweroff -f
index 78ed7f5f238a53c3ef9a37c74d66c45a0aaad6cd..7318fa7068f90c5957f13e7975f0dbd5b8ca9d86 100755 (executable)
@@ -1,6 +1,5 @@
 #!/bin/sh
 
 [ -b /dev/mapper/$2 ] && exit 0
-printf test >/keyfile
-/sbin/cryptsetup luksOpen $1 $2 </keyfile
-
+printf test > /keyfile
+/sbin/cryptsetup luksOpen $1 $2 < /keyfile
index 07d245a73bdb32fcb5a20f31f7ea1df5fd4d1773..4ac913e6c948b8e0a3db8d6fe93ef8530881a194 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
-exec >/dev/console 2>&1
+exec > /dev/console 2>&1
 echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/sdb
 export TERM=linux
 export PS1='initramfs-test:\w\$ '
index 49910516815a2b630948459204cf5b8e8c04b9cd..c414e50e25b7082345de4d10a0862d06dab9bc1e 100755 (executable)
@@ -67,7 +67,7 @@ test_setup() {
             mkdir -p -- var/lib/nfs/rpc_pipefs
         )
         inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
-                      mount dmesg dhclient mkdir cp ping dhclient dd
+            mount dmesg dhclient mkdir cp ping dhclient dd
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [ -f ${_terminfodir}/l/linux ] && break
         done
@@ -77,7 +77,7 @@ test_setup() {
         inst_multiple grep
         inst_simple /etc/os-release
         inst ./test-init.sh /sbin/init
-        find_binary plymouth >/dev/null && inst_multiple plymouth
+        find_binary plymouth > /dev/null && inst_multiple plymouth
         cp -a /etc/ld.so.conf* $initdir/etc
         ldconfig -r "$initdir"
     )
@@ -96,23 +96,22 @@ test_setup() {
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-                       -m "bash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
-                       -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
+        -m "bash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
+        -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
     rm -rf -- $TESTDIR/overlay
     # Invoke KVM and/or QEMU to actually create the target filesystem.
     $testdir/run-qemu -drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
-                      -append "root=/dev/fakeroot rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
-                      -initrd $TESTDIR/initramfs.makeroot  || return 1
+        -append "root=/dev/fakeroot rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
+        -initrd $TESTDIR/initramfs.makeroot || return 1
     grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1
-    cryptoUUIDS=$(grep -F --binary-files=text  -m 3 ID_FS_UUID $TESTDIR/root.ext2)
+    cryptoUUIDS=$(grep -F --binary-files=text -m 3 ID_FS_UUID $TESTDIR/root.ext2)
     for uuid in $cryptoUUIDS; do
         eval $uuid
         printf ' rd.luks.uuid=luks-%s ' $ID_FS_UUID
     done > $TESTDIR/luks.txt
 
-
     (
         export initdir=$TESTDIR/overlay
         . $basedir/dracut-init.sh
@@ -126,16 +125,16 @@ test_setup() {
         for uuid in $cryptoUUIDS; do
             eval $uuid
             printf 'luks-%s /dev/sda%s /etc/key timeout=0\n' $ID_FS_UUID $i
-            ((i+=1))
+            ((i += 1))
         done > $initdir/etc/crypttab
         echo -n test > $initdir/etc/key
     )
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-         -o "plymouth network kernel-network-modules" \
-         -a "debug" \
-         -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
-         --no-hostonly-cmdline -N \
-         -f $TESTDIR/initramfs.testing $KVERSION || return 1
+        -o "plymouth network kernel-network-modules" \
+        -a "debug" \
+        -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.testing $KVERSION || return 1
 }
 
 test_cleanup() {
index e18084c72052b4de74e1909596a95397abe47c1b..a565a054184cc444e77aba023a3f6d03c6ac84c5 100755 (executable)
@@ -12,18 +12,18 @@ udevadm control --reload
 udevadm settle
 
 # dmraid does not want symlinks in --disk "..."
-if [ -e /dev/hda ] ; then
-    echo y|dmraid -f isw -C Test0 --type 1 --disk "/dev/hdb /dev/hdc"
+if [ -e /dev/hda ]; then
+    echo y | dmraid -f isw -C Test0 --type 1 --disk "/dev/hdb /dev/hdc"
 else
-    echo y|dmraid -f isw -C Test0 --type 1 --disk "/dev/sdb /dev/sdc"
+    echo y | dmraid -f isw -C Test0 --type 1 --disk "/dev/sdb /dev/sdc"
 fi
 udevadm settle
 
 SETS=$(dmraid -c -s)
 # scan and activate all DM RAIDS
 for s in $SETS; do
-   dmraid -ay -i -p --rm_partitions "$s"
-   [ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s"
+    dmraid -ay -i -p --rm_partitions "$s"
+    [ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s"
 done
 
 udevadm settle
@@ -32,7 +32,7 @@ udevadm settle
 
 sfdisk -g /dev/mapper/isw*Test0
 # save a partition at the beginning for future flagging purposes
-sfdisk --no-reread /dev/mapper/isw*Test0 <<EOF
+sfdisk --no-reread /dev/mapper/isw*Test0 << EOF
 ,4M
 ,28M
 ,28M
@@ -46,22 +46,22 @@ udevadm settle
 SETS=$(dmraid -c -s -i)
 # scan and activate all DM RAIDS
 for s in $SETS; do
-   dmraid -ay -i -p --rm_partitions "$s"
-   [ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s"
+    dmraid -ay -i -p --rm_partitions "$s"
+    [ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s"
 done
 
 udevadm settle
 
 mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 \
-       /dev/mapper/isw*p2 \
-       /dev/mapper/isw*p3 \
-       /dev/mapper/isw*p4
+    /dev/mapper/isw*p2 \
+    /dev/mapper/isw*p3 \
+    /dev/mapper/isw*p4
 
 # wait for the array to finish initailizing, otherwise this sometimes fails
 # randomly.
 mdadm -W /dev/md0
 set -e
-lvm pvcreate -ff  -y /dev/md0
+lvm pvcreate -ff -y /dev/md0
 lvm vgcreate dracut /dev/md0
 lvm lvcreate -l 100%FREE -n root dracut
 lvm vgchange -ay
@@ -72,10 +72,13 @@ cp -a -t /sysroot /source/*
 umount /sysroot
 lvm lvchange -a n /dev/dracut/root
 udevadm settle
-mdadm --detail --export /dev/md0 |grep -F MD_UUID > /tmp/mduuid
+mdadm --detail --export /dev/md0 | grep -F MD_UUID > /tmp/mduuid
 . /tmp/mduuid
 echo "MD_UUID=$MD_UUID"
-{ echo "dracut-root-block-created"; echo MD_UUID=$MD_UUID;} | dd oflag=direct,dsync of=/dev/sda
+{
+    echo "dracut-root-block-created"
+    echo MD_UUID=$MD_UUID
+} | dd oflag=direct,dsync of=/dev/sda
 mdadm --wait-clean /dev/md0
 sync
 poweroff -f
index 78ed7f5f238a53c3ef9a37c74d66c45a0aaad6cd..7318fa7068f90c5957f13e7975f0dbd5b8ca9d86 100755 (executable)
@@ -1,6 +1,5 @@
 #!/bin/sh
 
 [ -b /dev/mapper/$2 ] && exit 0
-printf test >/keyfile
-/sbin/cryptsetup luksOpen $1 $2 </keyfile
-
+printf test > /keyfile
+/sbin/cryptsetup luksOpen $1 $2 < /keyfile
index 780a0b2d55534a2e7356a683a2b5de763ff71845..01acb195859b7c5a2c06520fd705104e44b8d4c4 100755 (executable)
@@ -1,3 +1,3 @@
 #!/bin/sh
-getargbool 0 rd.shell || poweroff -f 
-getargbool 0 failme && poweroff -f 
+getargbool 0 rd.shell || poweroff -f
+getargbool 0 failme && poweroff -f
index d82657ad2c7b8ec4eff6ec9cb2035f126056ead2..1f91210e15e6aec41b6665b1361e9246fe1e977c 100755 (executable)
@@ -2,7 +2,7 @@
 getcmdline() {
     while read -r _line || [ -n "$_line" ]; do
         printf "%s" "$_line"
-    done </proc/cmdline;
+    done < /proc/cmdline
 }
 
 _dogetarg() {
@@ -17,7 +17,7 @@ _dogetarg() {
             if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
                 # if $1 has a "=<value>", we want the exact match
                 if [ "$_o" = "$1" ]; then
-                    _val="1";
+                    _val="1"
                     unset _doecho
                 fi
                 continue
@@ -25,7 +25,7 @@ _dogetarg() {
 
             if [ "${_o#*=}" = "$_o" ]; then
                 # if cmdline argument has no "=<value>", we assume "=1"
-                _val="1";
+                _val="1"
                 unset _doecho
                 continue
             fi
@@ -35,18 +35,22 @@ _dogetarg() {
         fi
     done
     if [ -n "$_val" ]; then
-        [ "x$_doecho" != "x" ] && echo "$_val";
-        return 0;
+        [ "x$_doecho" != "x" ] && echo "$_val"
+        return 0
     fi
-    return 1;
+    return 1
 }
 
 getarg() {
     local _deprecated _newoption
     while [ $# -gt 0 ]; do
         case $1 in
-            -d) _deprecated=1; shift;;
-            -y) if _dogetarg $2 >/dev/null; then
+            -d)
+                _deprecated=1
+                shift
+                ;;
+            -y)
+                if _dogetarg $2 > /dev/null; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
                     fi
@@ -54,27 +58,32 @@ getarg() {
                     return 0
                 fi
                 _deprecated=0
-                shift 2;;
-            -n) if _dogetarg $2 >/dev/null; then
-                    echo 0;
+                shift 2
+                ;;
+            -n)
+                if _dogetarg $2 > /dev/null; then
+                    echo 0
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
                     fi
                     return 1
                 fi
                 _deprecated=0
-                shift 2;;
-            *)  if [ -z "$_newoption" ]; then
+                shift 2
+                ;;
+            *)
+                if [ -z "$_newoption" ]; then
                     _newoption="$1"
                 fi
                 if _dogetarg $1; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
                     fi
-                    return 0;
+                    return 0
                 fi
                 _deprecated=0
-                shift;;
+                shift
+                ;;
         esac
     done
     return 1
@@ -84,7 +93,8 @@ getargbool() {
     local _b
     unset _b
     local _default
-    _default="$1"; shift
+    _default="$1"
+    shift
     _b=$(getarg "$@")
     [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
     if [ -n "$_b" ]; then
@@ -96,9 +106,9 @@ getargbool() {
 }
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
-CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
+CMDLINE=$(while read line || [ -n "$line" ]; do echo $line; done < /proc/cmdline)
 plymouth --quit
-exec >/dev/console 2>&1
+exec > /dev/console 2>&1
 echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/sda
 export TERM=linux
 export PS1='initramfs-test:\w\$ '
index 3c2bdee6dd61c8b1e69bf590b8ac3fb0366f1300..f228bdca2f59f70b12a3ac40ea299e0b1ed22de7 100755 (executable)
@@ -22,7 +22,7 @@ client_run() {
 
     if ! grep -U --binary-files=binary -F -m 1 -q dracut-root-block-success $TESTDIR/marker.img; then
         echo "CLIENT TEST END: $@ [FAIL]"
-        return 1;
+        return 1
     fi
 
     echo "CLIENT TEST END: $@ [OK]"
@@ -71,7 +71,7 @@ test_setup() {
             done
         )
         inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
-                      mount dmesg dhclient mkdir cp ping dhclient dd
+            mount dmesg dhclient mkdir cp ping dhclient dd
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [ -f ${_terminfodir}/l/linux ] && break
         done
@@ -81,7 +81,7 @@ test_setup() {
         inst "$basedir/modules.d/35network-legacy/ifup.sh" "/sbin/ifup"
         inst_multiple grep
         inst ./test-init.sh /sbin/init
-        find_binary plymouth >/dev/null && inst_multiple plymouth
+        find_binary plymouth > /dev/null && inst_multiple plymouth
         cp -a /etc/ld.so.conf* $initdir/etc
         mkdir -p $initdir/run
         ldconfig -r "$initdir"
@@ -100,10 +100,10 @@ test_setup() {
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-                       -m "bash lvm mdraid dmraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
-                       -d "piix ide-gd_mod ata_piix ext2 sd_mod dm-multipath dm-crypt dm-round-robin faulty linear multipath raid0 raid10 raid1 raid456" \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
+        -m "bash lvm mdraid dmraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
+        -d "piix ide-gd_mod ata_piix ext2 sd_mod dm-multipath dm-crypt dm-round-robin faulty linear multipath raid0 raid10 raid1 raid456" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
     rm -rf -- $TESTDIR/overlay
     # Invoke KVM and/or QEMU to actually create the target filesystem.
     $testdir/run-qemu \
@@ -111,7 +111,7 @@ test_setup() {
         -drive format=raw,index=1,media=disk,file=$TESTDIR/disk1 \
         -drive format=raw,index=2,media=disk,file=$TESTDIR/disk2 \
         -append "root=/dev/dracut/root rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
-        -initrd $TESTDIR/initramfs.makeroot  || return 1
+        -initrd $TESTDIR/initramfs.makeroot || return 1
     grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created $TESTDIR/marker.img || return 1
     eval $(grep -F --binary-files=text -m 1 MD_UUID $TESTDIR/marker.img)
 
@@ -130,11 +130,11 @@ test_setup() {
         inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
     )
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-         -o "plymouth network kernel-network-modules" \
-         -a "debug" \
-         -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
-         --no-hostonly-cmdline -N \
-         -f $TESTDIR/initramfs.testing $KVERSION || return 1
+        -o "plymouth network kernel-network-modules" \
+        -a "debug" \
+        -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.testing $KVERSION || return 1
 }
 
 test_cleanup() {
index 6a309ea98bb2d8727642c2d0c54f7c1d344d3509..0e3336e2634c507ee916c890c1ca1268aeb04936 100755 (executable)
@@ -7,7 +7,7 @@ modprobe btrfs
 udevadm control --reload
 udevadm settle
 # save a partition at the beginning for future flagging purposes
-sfdisk -X gpt /dev/sda <<EOF
+sfdisk -X gpt /dev/sda << EOF
 ,10M
 ,200M
 ,200M
index 5632872779a761d2363f63c748e4a6af5f7be59c..119e4876e1f117763377f11d3b7bc142f1ee16b8 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
-exec >/dev/console 2>&1
+exec > /dev/console 2>&1
 echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/sda
 sync
 export TERM=linux
index 8084e3e5f31e4b72783512976031735462af7f85..43573a0befd99d3020f5c55a2143def8fb3bc06c 100755 (executable)
@@ -38,7 +38,7 @@ test_setup() {
             mkdir -p -- var/lib/nfs/rpc_pipefs
         )
         inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
-                      mount dmesg dhclient mkdir cp ping dhclient sync dd
+            mount dmesg dhclient mkdir cp ping dhclient sync dd
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [ -f ${_terminfodir}/l/linux ] && break
         done
@@ -48,7 +48,7 @@ test_setup() {
         inst_multiple grep
         inst ./test-init.sh /sbin/init
         inst_simple /etc/os-release
-        find_binary plymouth >/dev/null && inst_multiple plymouth
+        find_binary plymouth > /dev/null && inst_multiple plymouth
         cp -a /etc/ld.so.conf* $initdir/etc
         ldconfig -r "$initdir"
     )
@@ -67,11 +67,11 @@ test_setup() {
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-                       -m "bash btrfs udev-rules base rootfs-block fs-lib kernel-modules qemu" \
-                       -d "piix ide-gd_mod ata_piix btrfs sd_mod" \
-                       --nomdadmconf \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
+        -m "bash btrfs udev-rules base rootfs-block fs-lib kernel-modules qemu" \
+        -d "piix ide-gd_mod ata_piix btrfs sd_mod" \
+        --nomdadmconf \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
 
     rm -rf -- $TESTDIR/overlay
 
@@ -79,7 +79,7 @@ test_setup() {
     $testdir/run-qemu \
         -drive format=raw,index=0,media=disk,file=$DISKIMAGE \
         -append "root=/dev/fakeroot rw quiet console=ttyS0,115200n81 selinux=0" \
-        -initrd $TESTDIR/initramfs.makeroot  || return 1
+        -initrd $TESTDIR/initramfs.makeroot || return 1
 
     dd if=$DISKIMAGE bs=512 count=4 skip=2048 | grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created || return 1
 
@@ -92,11 +92,11 @@ test_setup() {
         inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
     )
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-         -o "plymouth network kernel-network-modules" \
-         -a "debug" \
-         -d "piix ide-gd_mod ata_piix btrfs sd_mod" \
-         --no-hostonly-cmdline -N \
-         -f $TESTDIR/initramfs.testing $KVERSION || return 1
+        -o "plymouth network kernel-network-modules" \
+        -a "debug" \
+        -d "piix ide-gd_mod ata_piix btrfs sd_mod" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.testing $KVERSION || return 1
 }
 
 test_cleanup() {
index 4a9c814b81838888878a76b235111e1188b9a935..72c1807e6764c10ed6cb5ac69ebecf59cf6dfab8 100755 (executable)
@@ -2,7 +2,7 @@
 getcmdline() {
     while read -r _line || [ -n "$_line" ]; do
         printf "%s" "$_line"
-    done </proc/cmdline;
+    done < /proc/cmdline
 }
 
 _dogetarg() {
@@ -17,7 +17,7 @@ _dogetarg() {
             if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
                 # if $1 has a "=<value>", we want the exact match
                 if [ "$_o" = "$1" ]; then
-                    _val="1";
+                    _val="1"
                     unset _doecho
                 fi
                 continue
@@ -25,7 +25,7 @@ _dogetarg() {
 
             if [ "${_o#*=}" = "$_o" ]; then
                 # if cmdline argument has no "=<value>", we assume "=1"
-                _val="1";
+                _val="1"
                 unset _doecho
                 continue
             fi
@@ -35,18 +35,22 @@ _dogetarg() {
         fi
     done
     if [ -n "$_val" ]; then
-        [ "x$_doecho" != "x" ] && echo "$_val";
-        return 0;
+        [ "x$_doecho" != "x" ] && echo "$_val"
+        return 0
     fi
-    return 1;
+    return 1
 }
 
 getarg() {
     local _deprecated _newoption
     while [ $# -gt 0 ]; do
         case $1 in
-            -d) _deprecated=1; shift;;
-            -y) if _dogetarg $2 >/dev/null; then
+            -d)
+                _deprecated=1
+                shift
+                ;;
+            -y)
+                if _dogetarg $2 > /dev/null; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
                     fi
@@ -54,27 +58,32 @@ getarg() {
                     return 0
                 fi
                 _deprecated=0
-                shift 2;;
-            -n) if _dogetarg $2 >/dev/null; then
-                    echo 0;
+                shift 2
+                ;;
+            -n)
+                if _dogetarg $2 > /dev/null; then
+                    echo 0
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
                     fi
                     return 1
                 fi
                 _deprecated=0
-                shift 2;;
-            *)  if [ -z "$_newoption" ]; then
+                shift 2
+                ;;
+            *)
+                if [ -z "$_newoption" ]; then
                     _newoption="$1"
                 fi
                 if _dogetarg $1; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
                     fi
-                    return 0;
+                    return 0
                 fi
                 _deprecated=0
-                shift;;
+                shift
+                ;;
         esac
     done
     return 1
@@ -84,7 +93,8 @@ getargbool() {
     local _b
     unset _b
     local _default
-    _default="$1"; shift
+    _default="$1"
+    shift
     _b=$(getarg "$@")
     [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
     if [ -n "$_b" ]; then
@@ -96,9 +106,9 @@ getargbool() {
 }
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
-CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
+CMDLINE=$(while read line || [ -n "$line" ]; do echo $line; done < /proc/cmdline)
 plymouth --quit
-exec >/dev/console 2>&1
+exec > /dev/console 2>&1
 echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/sdb
 export TERM=linux
 export PS1='initramfs-test:\w\$ '
index f46cdd6b65142a5f7a27bbaea842ed2768175205..095127647adbf690e72eebb82542b39b4362fb85 100755 (executable)
@@ -7,7 +7,7 @@ KVERSION="${KVERSION-$(uname -r)}"
 #DEBUGFAIL="rd.shell rd.break rd.debug systemd.log_level=debug systemd.log_target=console"
 
 test_check() {
-    for pdir in $(python -c "import site; print(site.getsitepackages())" | sed -e 's/\[\(.*\)\]/\1/' -e "s/', /' /g") ; do
+    for pdir in $(python -c "import site; print(site.getsitepackages())" | sed -e 's/\[\(.*\)\]/\1/' -e "s/', /' /g"); do
         pdir1=$(echo $pdir | sed "s/^'\(.*\)'$/\1/")
         if [[ -d $pdir1/imgcreate ]]; then
             return 0
@@ -19,20 +19,20 @@ test_check() {
 
 test_run() {
     "$testdir"/run-qemu \
-              -boot order=d \
-              -drive format=raw,bps=1000000,index=0,media=disk,file="$TESTDIR"/livecd.iso \
-              -drive format=raw,index=1,media=disk,file="$TESTDIR"/root.img \
-              -append "panic=1 systemd.crash_reboot root=live:CDLABEL=LiveCD live rw quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.shell=0 $DEBUGFAIL" \
-              -initrd "$TESTDIR"/initramfs.testing
+        -boot order=d \
+        -drive format=raw,bps=1000000,index=0,media=disk,file="$TESTDIR"/livecd.iso \
+        -drive format=raw,index=1,media=disk,file="$TESTDIR"/root.img \
+        -append "panic=1 systemd.crash_reboot root=live:CDLABEL=LiveCD live rw quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.shell=0 $DEBUGFAIL" \
+        -initrd "$TESTDIR"/initramfs.testing
 
     # mediacheck test with qemu GUI
     # "$testdir"/run-qemu \
-        #     -drive format=raw,bps=1000000,index=0,media=disk,file="$TESTDIR"/livecd.iso \
-        #     -drive format=raw,index=1,media=disk,file="$TESTDIR"/root.img \
-        #     -m 512M  -smp 2 \
-        #     -net none \
-        #     -append "root=live:CDLABEL=LiveCD live quiet rhgb selinux=0 rd.live.check" \
-        #     -initrd "$TESTDIR"/initramfs.testing
+    #     -drive format=raw,bps=1000000,index=0,media=disk,file="$TESTDIR"/livecd.iso \
+    #     -drive format=raw,index=1,media=disk,file="$TESTDIR"/root.img \
+    #     -m 512M  -smp 2 \
+    #     -net none \
+    #     -append "root=live:CDLABEL=LiveCD live quiet rhgb selinux=0 rd.live.check" \
+    #     -initrd "$TESTDIR"/initramfs.testing
 
     grep -U --binary-files=binary -F -m 1 -q dracut-root-block-success -- "$TESTDIR"/root.img || return 1
 }
@@ -51,11 +51,11 @@ test_setup() {
     dd if=/dev/zero of="$TESTDIR"/root.img count=100
 
     $basedir/dracut.sh -l -i "$TESTDIR"/overlay / \
-         -a "debug dmsquash-live qemu" \
-         -o "rngd" \
-         -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
-         --no-hostonly-cmdline -N \
-         -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1
+        -a "debug dmsquash-live qemu" \
+        -o "rngd" \
+        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
+        --no-hostonly-cmdline -N \
+        -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1
 
     mkdir -p -- "$TESTDIR"/root-source
     kernel="$KVERSION"
@@ -72,8 +72,8 @@ test_setup() {
             done
         )
         inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
-                      mount dmesg dhclient mkdir cp ping dhclient \
-                      umount strace less dd
+            mount dmesg dhclient mkdir cp ping dhclient \
+            umount strace less dd
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [[ -f ${_terminfodir}/l/linux ]] && break
         done
@@ -91,14 +91,14 @@ test_setup() {
 
         VMLINUZ="/lib/modules/${KVERSION}/vmlinuz"
         if ! [[ -e $VMLINUZ ]]; then
-            if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
+            if [[ $MACHINE_ID ]] && ([[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]]); then
                 VMLINUZ="/boot/${MACHINE_ID}/$KVERSION/linux"
             fi
         fi
         [[ -e $VMLINUZ ]] || VMLINUZ="/boot/vmlinuz-${KVERSION}"
 
         inst "$VMLINUZ" "/boot/vmlinuz-${KVERSION}"
-        find_binary plymouth >/dev/null && inst_multiple plymouth
+        find_binary plymouth > /dev/null && inst_multiple plymouth
         cp -a -- /etc/ld.so.conf* "$initdir"/etc
         ldconfig -r "$initdir"
     )
index 23629e6593d67f1dc7743797523f87aa3db22649..5c45a5a238859994882d4c5772262e2659bff5fa 100755 (executable)
@@ -7,7 +7,7 @@ rm -f -- /etc/lvm/lvm.conf
 udevadm control --reload
 udevadm settle
 # save a partition at the beginning for future flagging purposes
-sfdisk /dev/sda <<EOF
+sfdisk /dev/sda << EOF
 ,4M
 ,29M
 ,29M
@@ -15,21 +15,21 @@ sfdisk /dev/sda <<EOF
 EOF
 udevadm settle
 for i in sda2 sda3 sda4; do
-lvm pvcreate -ff  -y /dev/$i ;
-done && \
-lvm vgcreate dracut /dev/sda[234] && \
-lvm lvcreate -l 17  -T dracut/mythinpool && \
-lvm lvcreate -V1G -T dracut/mythinpool -n root && \
-lvm vgchange -ay && \
-mke2fs /dev/dracut/root && \
-mkdir -p /sysroot && \
-mount /dev/dracut/root /sysroot && \
-cp -a -t /sysroot /source/* && \
-umount /sysroot && \
-sleep 1 && \
-lvm lvchange -a n /dev/dracut/root && \
-sleep 1
-dmsetup status |grep out_of_data_space || \
-    echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/sda1
+    lvm pvcreate -ff -y /dev/$i
+done \
+    && lvm vgcreate dracut /dev/sda[234] \
+    && lvm lvcreate -l 17 -T dracut/mythinpool \
+    && lvm lvcreate -V1G -T dracut/mythinpool -n root \
+    && lvm vgchange -ay \
+    && mke2fs /dev/dracut/root \
+    && mkdir -p /sysroot \
+    && mount /dev/dracut/root /sysroot \
+    && cp -a -t /sysroot /source/* \
+    && umount /sysroot \
+    && sleep 1 \
+    && lvm lvchange -a n /dev/dracut/root \
+    && sleep 1
+dmsetup status | grep out_of_data_space \
+    || echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/sda1
 sync
 poweroff -f
index ef867ab925de8131bd11b0aed7346139006a6ead..3e7cbb34264bcff9d627c7fdb95fe7285a487222 100755 (executable)
@@ -2,7 +2,7 @@
 getcmdline() {
     while read -r _line || [ -n "$_line" ]; do
         printf "%s" "$_line"
-    done </proc/cmdline;
+    done < /proc/cmdline
 }
 
 _dogetarg() {
@@ -17,7 +17,7 @@ _dogetarg() {
             if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
                 # if $1 has a "=<value>", we want the exact match
                 if [ "$_o" = "$1" ]; then
-                    _val="1";
+                    _val="1"
                     unset _doecho
                 fi
                 continue
@@ -25,7 +25,7 @@ _dogetarg() {
 
             if [ "${_o#*=}" = "$_o" ]; then
                 # if cmdline argument has no "=<value>", we assume "=1"
-                _val="1";
+                _val="1"
                 unset _doecho
                 continue
             fi
@@ -35,18 +35,22 @@ _dogetarg() {
         fi
     done
     if [ -n "$_val" ]; then
-        [ "x$_doecho" != "x" ] && echo "$_val";
-        return 0;
+        [ "x$_doecho" != "x" ] && echo "$_val"
+        return 0
     fi
-    return 1;
+    return 1
 }
 
 getarg() {
     local _deprecated _newoption
     while [ $# -gt 0 ]; do
         case $1 in
-            -d) _deprecated=1; shift;;
-            -y) if _dogetarg $2 >/dev/null; then
+            -d)
+                _deprecated=1
+                shift
+                ;;
+            -y)
+                if _dogetarg $2 > /dev/null; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
                     fi
@@ -54,27 +58,32 @@ getarg() {
                     return 0
                 fi
                 _deprecated=0
-                shift 2;;
-            -n) if _dogetarg $2 >/dev/null; then
-                    echo 0;
+                shift 2
+                ;;
+            -n)
+                if _dogetarg $2 > /dev/null; then
+                    echo 0
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
                     fi
                     return 1
                 fi
                 _deprecated=0
-                shift 2;;
-            *)  if [ -z "$_newoption" ]; then
+                shift 2
+                ;;
+            *)
+                if [ -z "$_newoption" ]; then
                     _newoption="$1"
                 fi
                 if _dogetarg $1; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
                     fi
-                    return 0;
+                    return 0
                 fi
                 _deprecated=0
-                shift;;
+                shift
+                ;;
         esac
     done
     return 1
@@ -84,7 +93,8 @@ getargbool() {
     local _b
     unset _b
     local _default
-    _default="$1"; shift
+    _default="$1"
+    shift
     _b=$(getarg "$@")
     [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
     if [ -n "$_b" ]; then
@@ -96,9 +106,9 @@ getargbool() {
 }
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
-CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
+CMDLINE=$(while read line || [ -n "$line" ]; do echo $line; done < /proc/cmdline)
 plymouth --quit
-exec >/dev/console 2>&1
+exec > /dev/console 2>&1
 echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/sda1
 export TERM=linux
 export PS1='initramfs-test:\w\$ '
index 94931e8b15bae67a3209459395294df744360519..883cbe04e383e8bf762483dc4fcbcaf6cd7f722b 100755 (executable)
@@ -33,7 +33,7 @@ test_setup() {
             mkdir -p -- var/lib/nfs/rpc_pipefs
         )
         inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
-                      mount dmesg dhclient mkdir cp ping dhclient dd
+            mount dmesg dhclient mkdir cp ping dhclient dd
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [ -f ${_terminfodir}/l/linux ] && break
         done
@@ -43,7 +43,7 @@ test_setup() {
         inst_multiple grep
         inst_simple /etc/os-release
         inst ./test-init.sh /sbin/init
-        find_binary plymouth >/dev/null && inst_multiple plymouth
+        find_binary plymouth > /dev/null && inst_multiple plymouth
         cp -a /etc/ld.so.conf* $initdir/etc
         mkdir -p $initdir/run
         ldconfig -r "$initdir"
@@ -63,15 +63,15 @@ test_setup() {
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-                       -m "bash lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
-                       -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
+        -m "bash lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
+        -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
     rm -rf -- $TESTDIR/overlay
     # Invoke KVM and/or QEMU to actually create the target filesystem.
     $testdir/run-qemu -drive format=raw,index=0,media=disk,file=$TESTDIR/root.ext2 \
-                      -append "root=/dev/fakeroot rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
-                      -initrd $TESTDIR/initramfs.makeroot  || return 1
+        -append "root=/dev/fakeroot rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
+        -initrd $TESTDIR/initramfs.makeroot || return 1
     grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created $TESTDIR/root.ext2 || return 1
     (
         export initdir=$TESTDIR/overlay
@@ -82,11 +82,11 @@ test_setup() {
         inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
     )
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-         -o "plymouth network kernel-network-modules" \
-         -a "debug" -I lvs \
-         -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
-         --no-hostonly-cmdline -N \
-         -f $TESTDIR/initramfs.testing $KVERSION || return 1
+        -o "plymouth network kernel-network-modules" \
+        -a "debug" -I lvs \
+        -d "piix ide-gd_mod ata_piix ext2 sd_mod" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.testing $KVERSION || return 1
 }
 
 test_cleanup() {
index 127555a991ca52dccb0cb3133f08a4a1bdb14c3d..8062d534f675171a5026c93e50a83dc6f3393685 100755 (executable)
@@ -2,7 +2,7 @@
 getcmdline() {
     while read -r _line || [ -n "$_line" ]; do
         printf "%s" "$_line"
-    done </proc/cmdline;
+    done < /proc/cmdline
 }
 
 _dogetarg() {
@@ -17,7 +17,7 @@ _dogetarg() {
             if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
                 # if $1 has a "=<value>", we want the exact match
                 if [ "$_o" = "$1" ]; then
-                    _val="1";
+                    _val="1"
                     unset _doecho
                 fi
                 continue
@@ -25,7 +25,7 @@ _dogetarg() {
 
             if [ "${_o#*=}" = "$_o" ]; then
                 # if cmdline argument has no "=<value>", we assume "=1"
-                _val="1";
+                _val="1"
                 unset _doecho
                 continue
             fi
@@ -35,18 +35,22 @@ _dogetarg() {
         fi
     done
     if [ -n "$_val" ]; then
-        [ "x$_doecho" != "x" ] && echo "$_val";
-        return 0;
+        [ "x$_doecho" != "x" ] && echo "$_val"
+        return 0
     fi
-    return 1;
+    return 1
 }
 
 getarg() {
     local _deprecated _newoption
     while [ $# -gt 0 ]; do
         case $1 in
-            -d) _deprecated=1; shift;;
-            -y) if _dogetarg $2 >/dev/null; then
+            -d)
+                _deprecated=1
+                shift
+                ;;
+            -y)
+                if _dogetarg $2 > /dev/null; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
                     fi
@@ -54,27 +58,32 @@ getarg() {
                     return 0
                 fi
                 _deprecated=0
-                shift 2;;
-            -n) if _dogetarg $2 >/dev/null; then
-                    echo 0;
+                shift 2
+                ;;
+            -n)
+                if _dogetarg $2 > /dev/null; then
+                    echo 0
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
                     fi
                     return 1
                 fi
                 _deprecated=0
-                shift 2;;
-            *)  if [ -z "$_newoption" ]; then
+                shift 2
+                ;;
+            *)
+                if [ -z "$_newoption" ]; then
                     _newoption="$1"
                 fi
                 if _dogetarg $1; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
                     fi
-                    return 0;
+                    return 0
                 fi
                 _deprecated=0
-                shift;;
+                shift
+                ;;
         esac
     done
     return 1
@@ -84,7 +93,8 @@ getargbool() {
     local _b
     unset _b
     local _default
-    _default="$1"; shift
+    _default="$1"
+    shift
     _b=$(getarg "$@")
     [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
     if [ -n "$_b" ]; then
@@ -95,17 +105,17 @@ getargbool() {
     return 0
 }
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
-exec >/dev/console 2>&1
+exec > /dev/console 2>&1
 export TERM=linux
 export PS1='initramfs-test:\w\$ '
-CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
+CMDLINE=$(while read line || [ -n "$line" ]; do echo $line; done < /proc/cmdline)
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
 
 stty sane
 if getargbool 0 rd.shell; then
     [ -c /dev/watchdog ] && printf 'V' > /dev/watchdog
-       strstr "$(setsid --help)" "control" && CTTY="-c"
-       setsid $CTTY sh -i
+    strstr "$(setsid --help)" "control" && CTTY="-c"
+    setsid $CTTY sh -i
 fi
 
 echo "made it to the rootfs! Powering down."
@@ -115,5 +125,5 @@ while read dev fs fstype opts rest || [ -n "$dev" ]; do
     echo "nfs-OK $dev $fstype $opts" | dd oflag=direct,dsync of=/dev/sda
     break
 done < /proc/mounts
->/dev/watchdog
+> /dev/watchdog
 poweroff -f
index 05b2ae4b287984d95f6c0ca5832fc478acbe7ba7..3366d2f84751ab0dfc3111e66ff51daa97f571d3 100755 (executable)
@@ -9,7 +9,7 @@ udevadm settle
 
 set -e
 # save a partition at the beginning for future flagging purposes
-sfdisk /dev/sda <<EOF
+sfdisk /dev/sda << EOF
 ,1M
 ,
 EOF
@@ -24,4 +24,3 @@ umount /root
 echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/sda1
 sync
 poweroff -f
-
index 166b9e117333f6230e5b0b7fdf120fefbd59bd0c..c5ddb7362d62fab5fc990672e6a5600fe124e4d9 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-exec </dev/console >/dev/console 2>&1
+exec < /dev/console > /dev/console 2>&1
 set -x
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
 export TERM=linux
@@ -13,14 +13,14 @@ wait_for_if_link() {
     local cnt=0
     local li
     while [ $cnt -lt 600 ]; do
-        li=$(ip -o link show dev $1 2>/dev/null)
-       [ -n "$li" ] && return 0
+        li=$(ip -o link show dev $1 2> /dev/null)
+        [ -n "$li" ] && return 0
         if [[ $2 ]]; then
-           li=$(ip -o link show dev $2 2>/dev/null)
-           [ -n "$li" ] && return 0
+            li=$(ip -o link show dev $2 2> /dev/null)
+            [ -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,15 +43,13 @@ 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
 }
 
 linkup() {
-    wait_for_if_link $1 2>/dev/null\
-     && ip link set $1 up 2>/dev/null\
-     && wait_for_if_up $1 2>/dev/null
+    wait_for_if_link $1 2> /dev/null && ip link set $1 up 2> /dev/null && wait_for_if_up $1 2> /dev/null
 }
 
 wait_for_if_link eth0 ens2
@@ -97,7 +95,7 @@ echo > /dev/watchdog
 exportfs -r
 echo > /dev/watchdog
 mkdir -p /var/lib/dhcpd
->/var/lib/dhcpd/dhcpd.leases
+> /var/lib/dhcpd/dhcpd.leases
 echo > /dev/watchdog
 chmod 777 /var/lib/dhcpd/dhcpd.leases
 echo > /dev/watchdog
@@ -105,8 +103,8 @@ rm -f /var/run/dhcpd.pid
 dhcpd -d -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases &
 echo "Serving NFS mounts"
 while :; do
-       [ -n "$(jobs -rp)" ] && echo > /dev/watchdog
-       sleep 10
+    [ -n "$(jobs -rp)" ] && echo > /dev/watchdog
+    sleep 10
 done
 mount -n -o remount,ro /
 poweroff -f
index 648fe68a15c73839837e3877fe3af5d84dc8b58c..be299e953fa70652e9a7ab1894c27afc18308616 100755 (executable)
@@ -39,7 +39,7 @@ run_server() {
     tty -s && stty sane
 
     if ! [[ $SERIAL ]]; then
-        while : ; do
+        while :; do
             grep Serving "$TESTDIR"/server.log && break
             echo "Waiting for the server to startup"
             sleep 1
@@ -61,7 +61,7 @@ client_test() {
     echo "CLIENT TEST START: $test_name"
 
     # Need this so kvm-qemu will boot (needs non-/dev/zero local disk)
-    if ! dd if=/dev/zero of=$TESTDIR/client.img bs=1M count=1 &>/dev/null; then
+    if ! dd if=/dev/zero of=$TESTDIR/client.img bs=1M count=1 &> /dev/null; then
         echo "Unable to make client sda image" 1>&2
         return 1
     fi
@@ -127,52 +127,52 @@ test_nfsv3() {
     # NFSv4: last octect starts at 0x80 and works up
 
     client_test "NFSv3 root=dhcp DHCP path only" 52:54:00:12:34:00 \
-                "root=dhcp" 192.168.50.1 -wsize=4096 || return 1
+        "root=dhcp" 192.168.50.1 -wsize=4096 || return 1
 
-    if [[ "$(systemctl --version)" != *"systemd 230"* ]] 2>/dev/null; then
+    if [[ "$(systemctl --version)" != *"systemd 230"* ]] 2> /dev/null; then
         client_test "NFSv3 Legacy root=/dev/nfs nfsroot=IP:path" 52:54:00:12:34:01 \
-                    "root=/dev/nfs nfsroot=192.168.50.1:/nfs/client" 192.168.50.1 -wsize=4096 || return 1
+            "root=/dev/nfs nfsroot=192.168.50.1:/nfs/client" 192.168.50.1 -wsize=4096 || return 1
 
         client_test "NFSv3 Legacy root=/dev/nfs DHCP path only" 52:54:00:12:34:00 \
-                    "root=/dev/nfs" 192.168.50.1 -wsize=4096 || return 1
+            "root=/dev/nfs" 192.168.50.1 -wsize=4096 || return 1
 
         client_test "NFSv3 Legacy root=/dev/nfs DHCP IP:path" 52:54:00:12:34:01 \
-                    "root=/dev/nfs" 192.168.50.2 -wsize=4096 || return 1
+            "root=/dev/nfs" 192.168.50.2 -wsize=4096 || return 1
     fi
 
     client_test "NFSv3 root=dhcp DHCP IP:path" 52:54:00:12:34:01 \
-                "root=dhcp" 192.168.50.2 -wsize=4096 || return 1
+        "root=dhcp" 192.168.50.2 -wsize=4096 || return 1
 
     client_test "NFSv3 root=dhcp DHCP proto:IP:path" 52:54:00:12:34:02 \
-                "root=dhcp" 192.168.50.3 -wsize=4096 || return 1
+        "root=dhcp" 192.168.50.3 -wsize=4096 || return 1
 
     client_test "NFSv3 root=dhcp DHCP proto:IP:path:options" 52:54:00:12:34:03 \
-                "root=dhcp" 192.168.50.3 wsize=4096 || return 1
+        "root=dhcp" 192.168.50.3 wsize=4096 || return 1
 
     client_test "NFSv3 root=nfs:..." 52:54:00:12:34:04 \
-                "root=nfs:192.168.50.1:/nfs/client" 192.168.50.1 -wsize=4096 || return 1
+        "root=nfs:192.168.50.1:/nfs/client" 192.168.50.1 -wsize=4096 || return 1
 
     client_test "NFSv3 Bridge root=nfs:..." 52:54:00:12:34:04 \
-                "root=nfs:192.168.50.1:/nfs/client bridge net.ifnames=0" 192.168.50.1 -wsize=4096 || return 1
+        "root=nfs:192.168.50.1:/nfs/client bridge net.ifnames=0" 192.168.50.1 -wsize=4096 || return 1
 
     client_test "NFSv3 Legacy root=IP:path" 52:54:00:12:34:04 \
-                "root=192.168.50.1:/nfs/client" 192.168.50.1 -wsize=4096 || return 1
+        "root=192.168.50.1:/nfs/client" 192.168.50.1 -wsize=4096 || return 1
 
     # This test must fail: nfsroot= requires root=/dev/nfs
     client_test "NFSv3 Invalid root=dhcp nfsroot=/nfs/client" 52:54:00:12:34:04 \
-                "root=dhcp nfsroot=/nfs/client failme rd.debug" 192.168.50.1 -wsize=4096 && return 1
+        "root=dhcp nfsroot=/nfs/client failme rd.debug" 192.168.50.1 -wsize=4096 && return 1
 
     client_test "NFSv3 root=dhcp DHCP path,options" \
-                52:54:00:12:34:05 "root=dhcp" 192.168.50.1 wsize=4096 || return 1
+        52:54:00:12:34:05 "root=dhcp" 192.168.50.1 wsize=4096 || return 1
 
     client_test "NFSv3 Bridge Customized root=dhcp DHCP path,options" \
-                52:54:00:12:34:05 "root=dhcp bridge=foobr0:ens2" 192.168.50.1 wsize=4096 || return 1
+        52:54:00:12:34:05 "root=dhcp bridge=foobr0:ens2" 192.168.50.1 wsize=4096 || return 1
 
     client_test "NFSv3 root=dhcp DHCP IP:path,options" \
-                52:54:00:12:34:06 "root=dhcp" 192.168.50.2 wsize=4096 || return 1
+        52:54:00:12:34:06 "root=dhcp" 192.168.50.2 wsize=4096 || return 1
 
     client_test "NFSv3 root=dhcp DHCP proto:IP:path,options" \
-                52:54:00:12:34:07 "root=dhcp" 192.168.50.3 wsize=4096 || return 1
+        52:54:00:12:34:07 "root=dhcp" 192.168.50.3 wsize=4096 || return 1
 
     return 0
 }
@@ -183,17 +183,17 @@ test_nfsv4() {
     # switch_root
 
     client_test "NFSv4 root=dhcp DHCP proto:IP:path" 52:54:00:12:34:82 \
-                "root=dhcp" 192.168.50.3 -wsize=4096 || return 1
+        "root=dhcp" 192.168.50.3 -wsize=4096 || return 1
 
     client_test "NFSv4 root=dhcp DHCP proto:IP:path:options" 52:54:00:12:34:83 \
-                "root=dhcp" 192.168.50.3 wsize=4096 || return 1
+        "root=dhcp" 192.168.50.3 wsize=4096 || return 1
 
     client_test "NFSv4 root=nfs4:..." 52:54:00:12:34:84 \
-                "root=nfs4:192.168.50.1:/client" 192.168.50.1 \
-                -wsize=4096 || return 1
+        "root=nfs4:192.168.50.1:/client" 192.168.50.1 \
+        -wsize=4096 || return 1
 
     client_test "NFSv4 root=dhcp DHCP proto:IP:path,options" \
-                52:54:00:12:34:87 "root=dhcp" 192.168.50.3 wsize=4096 || return 1
+        52:54:00:12:34:87 "root=dhcp" 192.168.50.3 wsize=4096 || return 1
 
     return 0
 }
@@ -209,8 +209,8 @@ test_run() {
         return 1
     fi
 
-    test_nfsv3 && \
-        test_nfsv4
+    test_nfsv3 \
+        && test_nfsv4
 
     ret=$?
 
@@ -247,17 +247,17 @@ test_setup() {
         done
 
         inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
-                      dmesg mkdir cp ping exportfs \
-                      modprobe rpc.nfsd rpc.mountd showmount tcpdump \
-                      /etc/services sleep mount chmod rm
+            dmesg mkdir cp ping exportfs \
+            modprobe rpc.nfsd rpc.mountd showmount tcpdump \
+            /etc/services sleep mount chmod rm
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [ -f ${_terminfodir}/l/linux ] && break
         done
         inst_multiple -o ${_terminfodir}/l/linux
-        type -P portmap >/dev/null && inst_multiple portmap
-        type -P rpcbind >/dev/null && inst_multiple rpcbind
+        type -P portmap > /dev/null && inst_multiple portmap
+        type -P rpcbind > /dev/null && inst_multiple rpcbind
         [ -f /etc/netconfig ] && inst_multiple /etc/netconfig
-        type -P dhcpd >/dev/null && inst_multiple dhcpd
+        type -P dhcpd > /dev/null && inst_multiple dhcpd
         [ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
         instmods nfsd sunrpc ipv6 lockd af_packet
         inst ./server-init.sh /sbin/init
@@ -273,14 +273,14 @@ test_setup() {
         inst_libdir_file 'libnfsidmap*.so*'
 
         _nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \
-                       |  tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
+            | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
         _nsslibs=${_nsslibs#|}
         _nsslibs=${_nsslibs%|}
 
         inst_libdir_file -n "$_nsslibs" 'libnss_*.so*'
 
         (
-            cd "$initdir";
+            cd "$initdir"
             mkdir -p dev sys proc run etc var/run tmp var/lib/{dhcpd,rpcbind}
             mkdir -p var/lib/nfs/{v4recovery,rpc_pipefs}
             chmod 777 var/lib/rpcbind var/lib/nfs
@@ -296,14 +296,13 @@ test_setup() {
 
     )
 
-
     # Make client root inside server root
     (
         export initdir=$TESTDIR/server/overlay/source/nfs/client
         . $basedir/dracut-init.sh
 
         inst_multiple sh shutdown poweroff stty cat ps ln ip dd \
-                      mount dmesg mkdir cp ping grep setsid ls vi /etc/virc less cat
+            mount dmesg mkdir cp ping grep setsid ls vi /etc/virc less cat
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [ -f ${_terminfodir}/l/linux ] && break
         done
@@ -328,7 +327,7 @@ test_setup() {
         inst_libdir_file 'libnfsidmap*.so*'
 
         _nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \
-                       |  tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
+            | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
         _nsslibs=${_nsslibs#|}
         _nsslibs=${_nsslibs%|}
 
@@ -352,22 +351,20 @@ test_setup() {
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
     $basedir/dracut.sh -l -i $TESTDIR/server/overlay / \
-                       -m "bash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
-                       -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
-                       --nomdadmconf \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
+        -m "bash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
+        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
+        --nomdadmconf \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
     rm -rf -- $TESTDIR/server
     # Invoke KVM and/or QEMU to actually create the target filesystem.
 
     $testdir/run-qemu \
         -drive format=raw,index=0,media=disk,file=$TESTDIR/server.ext3 \
         -append "root=/dev/dracut/root rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
-        -initrd $TESTDIR/initramfs.makeroot  || return 1
+        -initrd $TESTDIR/initramfs.makeroot || return 1
     grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created $TESTDIR/server.ext3 || return 1
 
-
-
     # Make an overlay with needed tools for the test harness
     (
         export initdir=$TESTDIR/overlay
@@ -382,18 +379,18 @@ test_setup() {
 
     # Make server's dracut image
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-                       -m "dash udev-rules base rootfs-block fs-lib debug kernel-modules watchdog qemu" \
-                       -d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod e1000 i6300esb" \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.server $KVERSION || return 1
+        -m "dash udev-rules base rootfs-block fs-lib debug kernel-modules watchdog qemu" \
+        -d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod e1000 i6300esb" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.server $KVERSION || return 1
 
     # Make client's dracut image
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-                       -o "plymouth dash ${OMIT_NETWORK}" \
-                       -a "debug watchdog ${USE_NETWORK}" \
-                       -d "af_packet piix ide-gd_mod ata_piix sd_mod e1000 nfs sunrpc i6300esb" \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.testing $KVERSION || return 1
+        -o "plymouth dash ${OMIT_NETWORK}" \
+        -a "debug watchdog ${USE_NETWORK}" \
+        -d "af_packet piix ide-gd_mod ata_piix sd_mod e1000 nfs sunrpc i6300esb" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.testing $KVERSION || return 1
 }
 
 test_cleanup() {
index a659f148e02f8ba4cd58a322716ed07d2650cabd..5fda27cd74acd10460e2f8828db5399da377d004 100755 (executable)
@@ -2,7 +2,7 @@
 getcmdline() {
     while read -r _line || [ -n "$_line" ]; do
         printf "%s" "$_line"
-    done </proc/cmdline;
+    done < /proc/cmdline
 }
 
 _dogetarg() {
@@ -17,7 +17,7 @@ _dogetarg() {
             if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
                 # if $1 has a "=<value>", we want the exact match
                 if [ "$_o" = "$1" ]; then
-                    _val="1";
+                    _val="1"
                     unset _doecho
                 fi
                 continue
@@ -25,7 +25,7 @@ _dogetarg() {
 
             if [ "${_o#*=}" = "$_o" ]; then
                 # if cmdline argument has no "=<value>", we assume "=1"
-                _val="1";
+                _val="1"
                 unset _doecho
                 continue
             fi
@@ -35,18 +35,22 @@ _dogetarg() {
         fi
     done
     if [ -n "$_val" ]; then
-        [ "x$_doecho" != "x" ] && echo "$_val";
-        return 0;
+        [ "x$_doecho" != "x" ] && echo "$_val"
+        return 0
     fi
-    return 1;
+    return 1
 }
 
 getarg() {
     local _deprecated _newoption
     while [ $# -gt 0 ]; do
         case $1 in
-            -d) _deprecated=1; shift;;
-            -y) if _dogetarg $2 >/dev/null; then
+            -d)
+                _deprecated=1
+                shift
+                ;;
+            -y)
+                if _dogetarg $2 > /dev/null; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
                     fi
@@ -54,27 +58,32 @@ getarg() {
                     return 0
                 fi
                 _deprecated=0
-                shift 2;;
-            -n) if _dogetarg $2 >/dev/null; then
-                    echo 0;
+                shift 2
+                ;;
+            -n)
+                if _dogetarg $2 > /dev/null; then
+                    echo 0
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
                     fi
                     return 1
                 fi
                 _deprecated=0
-                shift 2;;
-            *)  if [ -z "$_newoption" ]; then
+                shift 2
+                ;;
+            *)
+                if [ -z "$_newoption" ]; then
                     _newoption="$1"
                 fi
                 if _dogetarg $1; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
                     fi
-                    return 0;
+                    return 0
                 fi
                 _deprecated=0
-                shift;;
+                shift
+                ;;
         esac
     done
     return 1
@@ -84,7 +93,8 @@ getargbool() {
     local _b
     unset _b
     local _default
-    _default="$1"; shift
+    _default="$1"
+    shift
     _b=$(getarg "$@")
     [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
     if [ -n "$_b" ]; then
@@ -95,9 +105,9 @@ getargbool() {
     return 0
 }
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
-exec >/dev/console 2>&1
+exec > /dev/console 2>&1
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
-CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
+CMDLINE=$(while read line || [ -n "$line" ]; do echo $line; done < /proc/cmdline)
 export TERM=linux
 export PS1='initramfs-test:\w\$ '
 stty sane
@@ -109,7 +119,7 @@ while read dev fs fstype opts rest || [ -n "$dev" ]; do
 done < /proc/mounts
 #sh -i
 if getargbool 0 rd.shell; then
-       strstr "$(setsid --help)" "control" && CTTY="-c"
-       setsid $CTTY sh -i
+    strstr "$(setsid --help)" "control" && CTTY="-c"
+    setsid $CTTY sh -i
 fi
 poweroff -f
index efd8204cb647d8293137509cfaaf48c299b9a057..228ccbd919ce81fb5878feec5d2caa49b452f064 100755 (executable)
@@ -7,22 +7,22 @@ rm -f -- /etc/lvm/lvm.conf
 udevadm control --reload
 udevadm settle
 
-mkfs.ext3 -j -L singleroot -F /dev/sda && \
-mkdir -p /sysroot && \
-mount /dev/sda /sysroot && \
-cp -a -t /sysroot /source/* && \
-umount /sysroot && \
-mdadm --create /dev/md0 --run --auto=yes --level=stripe --raid-devices=2 /dev/sdc /dev/sdd && \
-mdadm -W /dev/md0 || : && \
-lvm pvcreate -ff  -y /dev/md0 && \
-lvm vgcreate dracut /dev/md0 && \
-lvm lvcreate -l 100%FREE -n root dracut && \
-lvm vgchange -ay && \
-mkfs.ext3 -j -L sysroot /dev/dracut/root && \
-mount /dev/dracut/root /sysroot && \
-cp -a -t /sysroot /source/* && \
-umount /sysroot && \
-lvm lvchange -a n /dev/dracut/root && \
-echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/sdb
+mkfs.ext3 -j -L singleroot -F /dev/sda \
+    && mkdir -p /sysroot \
+    && mount /dev/sda /sysroot \
+    && cp -a -t /sysroot /source/* \
+    && umount /sysroot \
+    && mdadm --create /dev/md0 --run --auto=yes --level=stripe --raid-devices=2 /dev/sdc /dev/sdd \
+    && mdadm -W /dev/md0 || : \
+    && lvm pvcreate -ff -y /dev/md0 \
+    && lvm vgcreate dracut /dev/md0 \
+    && lvm lvcreate -l 100%FREE -n root dracut \
+    && lvm vgchange -ay \
+    && mkfs.ext3 -j -L sysroot /dev/dracut/root \
+    && mount /dev/dracut/root /sysroot \
+    && cp -a -t /sysroot /source/* \
+    && umount /sysroot \
+    && lvm lvchange -a n /dev/dracut/root \
+    && echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/sdb
 sync
 poweroff -f
index b15110f792fe8cf0bf3e6db63f63abf32b2a9b77..40e8421559f0f30fcacb2717d4fb1227f1c9cd10 100755 (executable)
@@ -8,7 +8,7 @@ udevadm control --reload
 udevadm settle
 set -e
 # save a partition at the beginning for future flagging purposes
-sfdisk /dev/sda <<EOF
+sfdisk /dev/sda << EOF
 ,1M
 ,
 EOF
index 63d6295edbe2cc8060dd60e002f3724dd23dc90d..163e484267c619a8beeb9753a4dbab94fc08d8b5 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-exec </dev/console >/dev/console 2>&1
+exec < /dev/console > /dev/console 2>&1
 set -x
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
 export TERM=linux
@@ -12,14 +12,14 @@ wait_for_if_link() {
     local cnt=0
     local li
     while [ $cnt -lt 600 ]; do
-        li=$(ip -o link show dev $1 2>/dev/null)
-       [ -n "$li" ] && return 0
+        li=$(ip -o link show dev $1 2> /dev/null)
+        [ -n "$li" ] && return 0
         if [[ $2 ]]; then
-           li=$(ip -o link show dev $2 2>/dev/null)
-           [ -n "$li" ] && return 0
+            li=$(ip -o link show dev $2 2> /dev/null)
+            [ -n "$li" ] && return 0
         fi
         sleep 0.1
-        cnt=$(($cnt+1))
+        cnt=$(($cnt + 1))
     done
     return 1
 }
@@ -35,7 +35,7 @@ ip link set ens2 up
 ip link set dev eth1 name ens3
 ip addr add 192.168.51.1/24 dev ens3
 ip link set ens3 up
->/var/lib/dhcpd/dhcpd.leases
+> /var/lib/dhcpd/dhcpd.leases
 chmod 777 /var/lib/dhcpd/dhcpd.leases
 dhcpd -d -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases &
 
@@ -50,12 +50,11 @@ tgtadm --lld iscsi --mode target --op bind --tid 1 -I 192.168.50.101
 tgtadm --lld iscsi --mode target --op bind --tid 2 -I 192.168.51.101
 tgtadm --lld iscsi --mode target --op bind --tid 3 -I 192.168.50.101
 
-
 # Wait forever for the VM to die
 while :; do
-       echo "Serving iSCSI"
-       [ -n "$(jobs -rp)" ] && echo > /dev/watchdog
-       sleep 10
+    echo "Serving iSCSI"
+    [ -n "$(jobs -rp)" ] && echo > /dev/watchdog
+    sleep 10
 done
 mount -n -o remount,ro /
 poweroff -f
index a34c1fcdd926f63af39313aa83cb7c69eb2697bf..97de433c4b4738af26e644de444167098b67c2e5 100755 (executable)
@@ -42,7 +42,7 @@ run_server() {
 
     if ! [[ $SERIAL ]]; then
         echo "Waiting for the server to startup"
-        while : ; do
+        while :; do
             grep Serving "$TESTDIR"/server.log && break
             echo "Waiting for the server to startup"
             sleep 1
@@ -54,7 +54,8 @@ run_server() {
 }
 
 run_client() {
-    local test_name=$1; shift
+    local test_name=$1
+    shift
     echo "CLIENT TEST START: $test_name"
 
     dd if=/dev/zero of=$TESTDIR/client.img bs=1M count=1
@@ -80,28 +81,28 @@ do_test_run() {
     initiator=$(iscsi-iname)
 
     run_client "root=dhcp" \
-               "root=/dev/root netroot=dhcp ip=ens2:dhcp" \
-               "rd.iscsi.initiator=$initiator" \
+        "root=/dev/root netroot=dhcp ip=ens2:dhcp" \
+        "rd.iscsi.initiator=$initiator" \
         || return 1
 
-    run_client "netroot=iscsi target0"\
-               "root=LABEL=singleroot netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0" \
-               "ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:ens2:off" \
-               "rd.iscsi.initiator=$initiator" \
+    run_client "netroot=iscsi target0" \
+        "root=LABEL=singleroot netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0" \
+        "ip=192.168.50.101::192.168.50.1:255.255.255.0:iscsi-1:ens2:off" \
+        "rd.iscsi.initiator=$initiator" \
         || return 1
 
     run_client "netroot=iscsi target1 target2" \
-               "root=LABEL=sysroot" \
-               "ip=dhcp" \
-               "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
-               "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
-               "rd.iscsi.initiator=$initiator" \
+        "root=LABEL=sysroot" \
+        "ip=dhcp" \
+        "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
+        "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
+        "rd.iscsi.initiator=$initiator" \
         || return 1
 
     run_client "root=ibft" \
-               "root=LABEL=singleroot" \
-               "rd.iscsi.ibft=1" \
-               "rd.iscsi.firmware=1" \
+        "root=LABEL=singleroot" \
+        "rd.iscsi.ibft=1" \
+        "rd.iscsi.firmware=1" \
         || return 1
 
     echo "All tests passed [OK]"
@@ -123,7 +124,7 @@ test_run() {
 }
 
 test_setup() {
-    if ! command -v tgtd &>/dev/null || ! command -v tgtadm &>/dev/null; then
+    if ! command -v tgtd &> /dev/null || ! command -v tgtadm &> /dev/null; then
         echo "Need tgtd and tgtadm from scsi-target-utils"
         return 1
     fi
@@ -149,7 +150,7 @@ test_setup() {
             mkdir -p -- var/lib/nfs/rpc_pipefs
         )
         inst_multiple sh shutdown poweroff stty cat ps ln ip \
-                      mount dmesg mkdir cp ping grep setsid dd
+            mount dmesg mkdir cp ping grep setsid dd
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [ -f ${_terminfodir}/l/linux ] && break
         done
@@ -174,10 +175,10 @@ test_setup() {
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-                       -m "dash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
-                       -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
+        -m "dash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
+        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
     rm -rf -- $TESTDIR/overlay
 
     # Need this so kvm-qemu will boot (needs non-/dev/zero local disk)
@@ -192,12 +193,11 @@ test_setup() {
         -drive format=raw,index=2,media=disk,file=$TESTDIR/iscsidisk2.img \
         -drive format=raw,index=3,media=disk,file=$TESTDIR/iscsidisk3.img \
         -append "root=/dev/fakeroot rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
-        -initrd $TESTDIR/initramfs.makeroot  || return 1
+        -initrd $TESTDIR/initramfs.makeroot || return 1
     grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created $TESTDIR/client.img || return 1
     rm -- $TESTDIR/client.img
     rm -rf -- $TESTDIR/overlay
 
-
     # Make server root
     dd if=/dev/zero of=$TESTDIR/server.ext3 bs=1M count=120
 
@@ -208,14 +208,14 @@ test_setup() {
         export initdir=$TESTDIR/overlay/source
         . $basedir/dracut-init.sh
         (
-            cd "$initdir";
+            cd "$initdir"
             mkdir -p dev sys proc etc var/run tmp var/lib/dhcpd /etc/iscsi
         )
         inst /etc/passwd /etc/passwd
         inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
-                      dmesg mkdir cp ping \
-                      modprobe tcpdump setsid \
-                      /etc/services sleep mount chmod
+            dmesg mkdir cp ping \
+            modprobe tcpdump setsid \
+            /etc/services sleep mount chmod
         inst_multiple tgtd tgtadm
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [ -f ${_terminfodir}/l/linux ] && break
@@ -223,7 +223,7 @@ test_setup() {
         inst_multiple -o ${_terminfodir}/l/linux
         instmods iscsi_tcp crc32c ipv6
         [ -f /etc/netconfig ] && inst_multiple /etc/netconfig
-        type -P dhcpd >/dev/null && inst_multiple dhcpd
+        type -P dhcpd > /dev/null && inst_multiple dhcpd
         [ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
         inst_simple /etc/os-release
         inst ./server-init.sh /sbin/init
@@ -251,17 +251,17 @@ test_setup() {
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-                       -m "dash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
-                       -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
-                       --nomdadmconf \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
+        -m "dash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
+        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
+        --nomdadmconf \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
 
     # Invoke KVM and/or QEMU to actually create the target filesystem.
     $testdir/run-qemu \
         -drive format=raw,index=0,media=disk,file=$TESTDIR/server.ext3 \
         -append "root=/dev/dracut/root rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
-        -initrd $TESTDIR/initramfs.makeroot  || return 1
+        -initrd $TESTDIR/initramfs.makeroot || return 1
     grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created $TESTDIR/server.ext3 || return 1
     rm -rf -- $TESTDIR/overlay
 
@@ -278,18 +278,18 @@ test_setup() {
 
     # Make server's dracut image
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-                       -a "dash udev-rules base rootfs-block fs-lib debug kernel-modules" \
-                       -d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod e1000 drbg" \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.server $KVERSION || return 1
+        -a "dash udev-rules base rootfs-block fs-lib debug kernel-modules" \
+        -d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod e1000 drbg" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.server $KVERSION || return 1
 
     # Make client dracut image
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-         -o "dash plymouth dmraid nfs ${OMIT_NETWORK}" \
-         -a "debug ${USE_NETWORK}" \
-         -d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod" \
-         --no-hostonly-cmdline -N \
-         -f $TESTDIR/initramfs.testing $KVERSION || return 1
+        -o "dash plymouth dmraid nfs ${OMIT_NETWORK}" \
+        -a "debug ${USE_NETWORK}" \
+        -d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.testing $KVERSION || return 1
     rm -rf -- $TESTDIR/overlay
 
 }
index a659f148e02f8ba4cd58a322716ed07d2650cabd..5fda27cd74acd10460e2f8828db5399da377d004 100755 (executable)
@@ -2,7 +2,7 @@
 getcmdline() {
     while read -r _line || [ -n "$_line" ]; do
         printf "%s" "$_line"
-    done </proc/cmdline;
+    done < /proc/cmdline
 }
 
 _dogetarg() {
@@ -17,7 +17,7 @@ _dogetarg() {
             if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
                 # if $1 has a "=<value>", we want the exact match
                 if [ "$_o" = "$1" ]; then
-                    _val="1";
+                    _val="1"
                     unset _doecho
                 fi
                 continue
@@ -25,7 +25,7 @@ _dogetarg() {
 
             if [ "${_o#*=}" = "$_o" ]; then
                 # if cmdline argument has no "=<value>", we assume "=1"
-                _val="1";
+                _val="1"
                 unset _doecho
                 continue
             fi
@@ -35,18 +35,22 @@ _dogetarg() {
         fi
     done
     if [ -n "$_val" ]; then
-        [ "x$_doecho" != "x" ] && echo "$_val";
-        return 0;
+        [ "x$_doecho" != "x" ] && echo "$_val"
+        return 0
     fi
-    return 1;
+    return 1
 }
 
 getarg() {
     local _deprecated _newoption
     while [ $# -gt 0 ]; do
         case $1 in
-            -d) _deprecated=1; shift;;
-            -y) if _dogetarg $2 >/dev/null; then
+            -d)
+                _deprecated=1
+                shift
+                ;;
+            -y)
+                if _dogetarg $2 > /dev/null; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
                     fi
@@ -54,27 +58,32 @@ getarg() {
                     return 0
                 fi
                 _deprecated=0
-                shift 2;;
-            -n) if _dogetarg $2 >/dev/null; then
-                    echo 0;
+                shift 2
+                ;;
+            -n)
+                if _dogetarg $2 > /dev/null; then
+                    echo 0
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
                     fi
                     return 1
                 fi
                 _deprecated=0
-                shift 2;;
-            *)  if [ -z "$_newoption" ]; then
+                shift 2
+                ;;
+            *)
+                if [ -z "$_newoption" ]; then
                     _newoption="$1"
                 fi
                 if _dogetarg $1; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
                     fi
-                    return 0;
+                    return 0
                 fi
                 _deprecated=0
-                shift;;
+                shift
+                ;;
         esac
     done
     return 1
@@ -84,7 +93,8 @@ getargbool() {
     local _b
     unset _b
     local _default
-    _default="$1"; shift
+    _default="$1"
+    shift
     _b=$(getarg "$@")
     [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
     if [ -n "$_b" ]; then
@@ -95,9 +105,9 @@ getargbool() {
     return 0
 }
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
-exec >/dev/console 2>&1
+exec > /dev/console 2>&1
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
-CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
+CMDLINE=$(while read line || [ -n "$line" ]; do echo $line; done < /proc/cmdline)
 export TERM=linux
 export PS1='initramfs-test:\w\$ '
 stty sane
@@ -109,7 +119,7 @@ while read dev fs fstype opts rest || [ -n "$dev" ]; do
 done < /proc/mounts
 #sh -i
 if getargbool 0 rd.shell; then
-       strstr "$(setsid --help)" "control" && CTTY="-c"
-       setsid $CTTY sh -i
+    strstr "$(setsid --help)" "control" && CTTY="-c"
+    setsid $CTTY sh -i
 fi
 poweroff -f
index efd8204cb647d8293137509cfaaf48c299b9a057..228ccbd919ce81fb5878feec5d2caa49b452f064 100755 (executable)
@@ -7,22 +7,22 @@ rm -f -- /etc/lvm/lvm.conf
 udevadm control --reload
 udevadm settle
 
-mkfs.ext3 -j -L singleroot -F /dev/sda && \
-mkdir -p /sysroot && \
-mount /dev/sda /sysroot && \
-cp -a -t /sysroot /source/* && \
-umount /sysroot && \
-mdadm --create /dev/md0 --run --auto=yes --level=stripe --raid-devices=2 /dev/sdc /dev/sdd && \
-mdadm -W /dev/md0 || : && \
-lvm pvcreate -ff  -y /dev/md0 && \
-lvm vgcreate dracut /dev/md0 && \
-lvm lvcreate -l 100%FREE -n root dracut && \
-lvm vgchange -ay && \
-mkfs.ext3 -j -L sysroot /dev/dracut/root && \
-mount /dev/dracut/root /sysroot && \
-cp -a -t /sysroot /source/* && \
-umount /sysroot && \
-lvm lvchange -a n /dev/dracut/root && \
-echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/sdb
+mkfs.ext3 -j -L singleroot -F /dev/sda \
+    && mkdir -p /sysroot \
+    && mount /dev/sda /sysroot \
+    && cp -a -t /sysroot /source/* \
+    && umount /sysroot \
+    && mdadm --create /dev/md0 --run --auto=yes --level=stripe --raid-devices=2 /dev/sdc /dev/sdd \
+    && mdadm -W /dev/md0 || : \
+    && lvm pvcreate -ff -y /dev/md0 \
+    && lvm vgcreate dracut /dev/md0 \
+    && lvm lvcreate -l 100%FREE -n root dracut \
+    && lvm vgchange -ay \
+    && mkfs.ext3 -j -L sysroot /dev/dracut/root \
+    && mount /dev/dracut/root /sysroot \
+    && cp -a -t /sysroot /source/* \
+    && umount /sysroot \
+    && lvm lvchange -a n /dev/dracut/root \
+    && echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/sdb
 sync
 poweroff -f
index cae305f9c399078349879464c1caab7855e992a9..40e8421559f0f30fcacb2717d4fb1227f1c9cd10 100755 (executable)
@@ -8,7 +8,7 @@ udevadm control --reload
 udevadm settle
 set -e
 # save a partition at the beginning for future flagging purposes
-sfdisk /dev/sda <<EOF
+sfdisk /dev/sda << EOF
 ,1M
 ,
 EOF
@@ -23,4 +23,3 @@ umount /root
 echo "dracut-root-block-created" | dd oflag=direct,dsync of=/dev/sda1
 sync
 poweroff -f
-
index fe962311325a496893405fd1cf584d8827a8b732..49ec07ee47a84749343ca0dc4737cefd3b18e315 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-exec </dev/console >/dev/console 2>&1
+exec < /dev/console > /dev/console 2>&1
 set -x
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
 export TERM=linux
@@ -12,14 +12,14 @@ wait_for_if_link() {
     local cnt=0
     local li
     while [ $cnt -lt 600 ]; do
-        li=$(ip -o link show dev $1 2>/dev/null)
-       [ -n "$li" ] && return 0
+        li=$(ip -o link show dev $1 2> /dev/null)
+        [ -n "$li" ] && return 0
         if [[ $2 ]]; then
-           li=$(ip -o link show dev $2 2>/dev/null)
-           [ -n "$li" ] && return 0
+            li=$(ip -o link show dev $2 2> /dev/null)
+            [ -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,15 +42,13 @@ 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
 }
 
 linkup() {
-    wait_for_if_link $1 2>/dev/null\
-     && ip link set $1 up 2>/dev/null\
-     && wait_for_if_up $1 2>/dev/null
+    wait_for_if_link $1 2> /dev/null && ip link set $1 up 2> /dev/null && wait_for_if_up $1 2> /dev/null
 }
 
 wait_for_if_link eth0 ens2
@@ -65,7 +63,7 @@ ip link set dev eth1 name ens3
 ip addr add 192.168.51.1/24 dev ens3
 linkup ens3
 
->/var/lib/dhcpd/dhcpd.leases
+> /var/lib/dhcpd/dhcpd.leases
 chmod 777 /var/lib/dhcpd/dhcpd.leases
 dhcpd -d -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases &
 
@@ -80,12 +78,11 @@ tgtadm --lld iscsi --mode target --op bind --tid 1 -I 192.168.50.101
 tgtadm --lld iscsi --mode target --op bind --tid 2 -I 192.168.51.101
 tgtadm --lld iscsi --mode target --op bind --tid 3 -I 192.168.50.101
 
-
 # Wait forever for the VM to die
 echo "Serving iSCSI"
 while :; do
-       [ -n "$(jobs -rp)" ] && echo > /dev/watchdog
-       sleep 10
+    [ -n "$(jobs -rp)" ] && echo > /dev/watchdog
+    sleep 10
 done
 mount -n -o remount,ro /
 poweroff -f
index 017c85a80f88ea3dae2b1a47d1204e4162462589..434e6d5be27b24965fbd932184c18804ecc3050e 100755 (executable)
@@ -41,7 +41,7 @@ run_server() {
     tty -s && stty sane
 
     if ! [[ $SERIAL ]]; then
-        while : ; do
+        while :; do
             grep Serving "$TESTDIR"/server.log && break
             echo "Waiting for the server to startup"
             tail "$TESTDIR"/server.log
@@ -54,7 +54,8 @@ run_server() {
 }
 
 run_client() {
-    local test_name=$1; shift
+    local test_name=$1
+    shift
     echo "CLIENT TEST START: $test_name"
 
     dd if=/dev/zero of=$TESTDIR/client.img bs=1M count=1
@@ -78,45 +79,45 @@ run_client() {
 do_test_run() {
     initiator=$(iscsi-iname)
     run_client "netroot=iscsi target1 target2" \
-               "root=LABEL=sysroot" \
-               "ip=192.168.50.101:::255.255.255.0::ens2:off" \
-               "ip=192.168.51.101:::255.255.255.0::ens3:off" \
-               "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
-               "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
-               "rd.iscsi.initiator=$initiator" \
+        "root=LABEL=sysroot" \
+        "ip=192.168.50.101:::255.255.255.0::ens2:off" \
+        "ip=192.168.51.101:::255.255.255.0::ens3:off" \
+        "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
+        "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
+        "rd.iscsi.initiator=$initiator" \
         || return 1
 
     run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0" \
-               "root=LABEL=sysroot" \
-               "ip=192.168.50.101:::255.255.255.0::ens2:off" \
-               "ip=192.168.51.101:::255.255.255.0::ens3:off" \
-               "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
-               "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
-               "rd.iscsi.firmware" \
-               "rd.iscsi.initiator=$initiator" \
-               "rd.iscsi.waitnet=0" \
+        "root=LABEL=sysroot" \
+        "ip=192.168.50.101:::255.255.255.0::ens2:off" \
+        "ip=192.168.51.101:::255.255.255.0::ens3:off" \
+        "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
+        "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
+        "rd.iscsi.firmware" \
+        "rd.iscsi.initiator=$initiator" \
+        "rd.iscsi.waitnet=0" \
         || return 1
 
     run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \
-               "root=LABEL=sysroot" \
-               "ip=192.168.50.101:::255.255.255.0::ens2:off" \
-               "ip=192.168.51.101:::255.255.255.0::ens3:off" \
-               "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
-               "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
-               "rd.iscsi.firmware" \
-               "rd.iscsi.initiator=$initiator" \
-               "rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \
+        "root=LABEL=sysroot" \
+        "ip=192.168.50.101:::255.255.255.0::ens2:off" \
+        "ip=192.168.51.101:::255.255.255.0::ens3:off" \
+        "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
+        "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
+        "rd.iscsi.firmware" \
+        "rd.iscsi.initiator=$initiator" \
+        "rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \
         || return 1
 
     run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0 rd.iscsi.testroute=0 default GW" \
-               "root=LABEL=sysroot" \
-               "ip=192.168.50.101::192.168.50.1:255.255.255.0::ens2:off" \
-               "ip=192.168.51.101::192.168.51.1:255.255.255.0::ens3:off" \
-               "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
-               "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
-               "rd.iscsi.firmware" \
-               "rd.iscsi.initiator=$initiator" \
-               "rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \
+        "root=LABEL=sysroot" \
+        "ip=192.168.50.101::192.168.50.1:255.255.255.0::ens2:off" \
+        "ip=192.168.51.101::192.168.51.1:255.255.255.0::ens3:off" \
+        "netroot=iscsi:192.168.51.1::::iqn.2009-06.dracut:target1" \
+        "netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target2" \
+        "rd.iscsi.firmware" \
+        "rd.iscsi.initiator=$initiator" \
+        "rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \
         || return 1
 
     echo "All tests passed [OK]"
@@ -138,7 +139,7 @@ test_run() {
 }
 
 test_setup() {
-    if ! command -v tgtd &>/dev/null || ! command -v tgtadm &>/dev/null; then
+    if ! command -v tgtd &> /dev/null || ! command -v tgtadm &> /dev/null; then
         echo "Need tgtd and tgtadm from scsi-target-utils"
         return 1
     fi
@@ -164,7 +165,7 @@ test_setup() {
             mkdir -p -- var/lib/nfs/rpc_pipefs
         )
         inst_multiple sh shutdown poweroff stty cat ps ln ip \
-                      mount dmesg mkdir cp ping grep setsid dd
+            mount dmesg mkdir cp ping grep setsid dd
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [ -f ${_terminfodir}/l/linux ] && break
         done
@@ -189,13 +190,12 @@ test_setup() {
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-                       -m "dash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
-                       -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
+        -m "dash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
+        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
     rm -rf -- $TESTDIR/overlay
 
-
     # Need this so kvm-qemu will boot (needs non-/dev/zero local disk)
     if ! dd if=/dev/zero of=$TESTDIR/client.img bs=1M count=1; then
         echo "Unable to make client sdb image" 1>&2
@@ -208,7 +208,7 @@ test_setup() {
         -drive format=raw,index=2,media=disk,file=$TESTDIR/iscsidisk2.img \
         -drive format=raw,index=3,media=disk,file=$TESTDIR/iscsidisk3.img \
         -append "root=/dev/fakeroot rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
-        -initrd $TESTDIR/initramfs.makeroot  || return 1
+        -initrd $TESTDIR/initramfs.makeroot || return 1
     grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created $TESTDIR/client.img || return 1
     rm -- $TESTDIR/client.img
 
@@ -224,14 +224,14 @@ test_setup() {
         export initdir=$TESTDIR/overlay/source
         . $basedir/dracut-init.sh
         (
-            cd "$initdir";
+            cd "$initdir"
             mkdir -p dev sys proc etc var/run tmp var/lib/dhcpd /etc/iscsi
         )
         inst /etc/passwd /etc/passwd
         inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
-                      dmesg mkdir cp ping \
-                      modprobe tcpdump setsid \
-                      /etc/services sleep mount chmod
+            dmesg mkdir cp ping \
+            modprobe tcpdump setsid \
+            /etc/services sleep mount chmod
         inst_multiple tgtd tgtadm
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [ -f ${_terminfodir}/l/linux ] && break
@@ -239,7 +239,7 @@ test_setup() {
         inst_multiple -o ${_terminfodir}/l/linux
         instmods iscsi_tcp crc32c ipv6
         [ -f /etc/netconfig ] && inst_multiple /etc/netconfig
-        type -P dhcpd >/dev/null && inst_multiple dhcpd
+        type -P dhcpd > /dev/null && inst_multiple dhcpd
         [ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
         inst_simple /etc/os-release
         inst ./server-init.sh /sbin/init
@@ -266,17 +266,17 @@ test_setup() {
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-                       -m "dash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
-                       -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
-                       --nomdadmconf \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
+        -m "dash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
+        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
+        --nomdadmconf \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
 
     # Invoke KVM and/or QEMU to actually create the target filesystem.
     $testdir/run-qemu \
         -drive format=raw,index=0,media=disk,file=$TESTDIR/server.ext3 \
         -append "root=/dev/dracut/root rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
-        -initrd $TESTDIR/initramfs.makeroot  || return 1
+        -initrd $TESTDIR/initramfs.makeroot || return 1
     grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created $TESTDIR/server.ext3 || return 1
     rm -rf -- $TESTDIR/overlay
 
@@ -292,18 +292,18 @@ test_setup() {
 
     # Make server's dracut image
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-                       -a "dash udev-rules base rootfs-block fs-lib debug kernel-modules" \
-                       -d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod e1000 drbg" \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.server $KVERSION || return 1
+        -a "dash udev-rules base rootfs-block fs-lib debug kernel-modules" \
+        -d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod e1000 drbg" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.server $KVERSION || return 1
 
     # Make client's dracut image
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-         -o "dash plymouth dmraid nfs ${OMIT_NETWORK}" \
-         -a "debug ${USE_NETWORK}" \
-         -d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod" \
-         --no-hostonly-cmdline -N \
-         -f $TESTDIR/initramfs.testing $KVERSION || return 1
+        -o "dash plymouth dmraid nfs ${OMIT_NETWORK}" \
+        -a "debug ${USE_NETWORK}" \
+        -d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.testing $KVERSION || return 1
 
     rm -rf -- $TESTDIR/overlay
 }
index 6292501ab16ad77de75c9ff6f34d0d6363c44a30..0a0f6c1cf69246b1072737dc51d1fc8bebe8ac9b 100755 (executable)
@@ -1,12 +1,12 @@
 #!/bin/sh
->/dev/watchdog
+> /dev/watchdog
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
-exec >/dev/console 2>&1
+exec > /dev/console 2>&1
 while read dev fs fstype opts rest || [ -n "$dev" ]; do
     [ "$dev" = "rootfs" ] && continue
     [ "$fs" != "/" ] && continue
     echo "nbd-OK $fstype $opts" | dd oflag=direct,dsync of=/dev/sda
-    echo "nbd-OK $fstype $opts" 
+    echo "nbd-OK $fstype $opts"
     break
 done < /proc/mounts
 export TERM=linux
@@ -14,7 +14,7 @@ export PS1='nbdclient-test:\w\$ '
 stty sane
 echo "made it to the rootfs! Powering down."
 #sh -i
->/dev/watchdog
+> /dev/watchdog
 mount -n -o remount,ro / &> /dev/null
->/dev/watchdog
+> /dev/watchdog
 poweroff -f
index d752a7fe54224ca640a54f7555fd77e64ed394d3..69b51ee8f565b5de95e54b6dddb5cc2b377f44ce 100755 (executable)
@@ -15,6 +15,9 @@ mount /dev/sda /root
 cp -a -t /root /source/*
 mkdir -p /root/run
 umount /root
-{ echo "dracut-root-block-created"; echo "ID_FS_UUID=$ID_FS_UUID"; } | dd oflag=direct,dsync of=/dev/sdb
+{
+    echo "dracut-root-block-created"
+    echo "ID_FS_UUID=$ID_FS_UUID"
+} | dd oflag=direct,dsync of=/dev/sdb
 sync
 poweroff -f
index efe106c04964eaa6cdea43acc2a7cb5aa14eaf71..f605c0e4b36a71f6e6ed11ab638bc34689cc9cfd 100755 (executable)
@@ -7,26 +7,29 @@ rm -f -- /etc/lvm/lvm.conf
 udevadm control --reload
 udevadm settle
 
-printf test >keyfile
+printf test > keyfile
 cryptsetup -q luksFormat /dev/sda /keyfile
 echo "The passphrase is test"
-cryptsetup luksOpen /dev/sda dracut_crypt_test </keyfile && \
-lvm pvcreate -ff  -y /dev/mapper/dracut_crypt_test && \
-lvm vgcreate dracut /dev/mapper/dracut_crypt_test && \
-lvm lvcreate -l 100%FREE -n root dracut && \
-lvm vgchange -ay && \
-mkfs.ext3 -L dracut -j /dev/dracut/root && \
-mkdir -p /sysroot && \
-mount /dev/dracut/root /sysroot && \
-cp -a -t /sysroot /source/* && \
-umount /sysroot
+cryptsetup luksOpen /dev/sda dracut_crypt_test < /keyfile \
+    && lvm pvcreate -ff -y /dev/mapper/dracut_crypt_test \
+    && lvm vgcreate dracut /dev/mapper/dracut_crypt_test \
+    && lvm lvcreate -l 100%FREE -n root dracut \
+    && lvm vgchange -ay \
+    && mkfs.ext3 -L dracut -j /dev/dracut/root \
+    && mkdir -p /sysroot \
+    && mount /dev/dracut/root /sysroot \
+    && cp -a -t /sysroot /source/* \
+    && umount /sysroot
 sleep 1
 lvm lvchange -a n /dev/dracut/root
 udevadm settle
 cryptsetup luksClose /dev/mapper/dracut_crypt_test
 udevadm settle
 sleep 1
-eval $(udevadm info --query=env --name=/dev/sda|while read line || [ -n "$line" ]; do [ "$line" != "${line#*ID_FS_UUID*}" ] && echo $line; done;)
-{ echo "dracut-root-block-created"; echo "ID_FS_UUID=$ID_FS_UUID"; } | dd oflag=direct,dsync of=/dev/sdb
+eval $(udevadm info --query=env --name=/dev/sda | while read line || [ -n "$line" ]; do [ "$line" != "${line#*ID_FS_UUID*}" ] && echo $line; done)
+{
+    echo "dracut-root-block-created"
+    echo "ID_FS_UUID=$ID_FS_UUID"
+} | dd oflag=direct,dsync of=/dev/sdb
 sync
 poweroff -f
index d752a7fe54224ca640a54f7555fd77e64ed394d3..69b51ee8f565b5de95e54b6dddb5cc2b377f44ce 100755 (executable)
@@ -15,6 +15,9 @@ mount /dev/sda /root
 cp -a -t /root /source/*
 mkdir -p /root/run
 umount /root
-{ echo "dracut-root-block-created"; echo "ID_FS_UUID=$ID_FS_UUID"; } | dd oflag=direct,dsync of=/dev/sdb
+{
+    echo "dracut-root-block-created"
+    echo "ID_FS_UUID=$ID_FS_UUID"
+} | dd oflag=direct,dsync of=/dev/sdb
 sync
 poweroff -f
index 78ed7f5f238a53c3ef9a37c74d66c45a0aaad6cd..7318fa7068f90c5957f13e7975f0dbd5b8ca9d86 100755 (executable)
@@ -1,6 +1,5 @@
 #!/bin/sh
 
 [ -b /dev/mapper/$2 ] && exit 0
-printf test >/keyfile
-/sbin/cryptsetup luksOpen $1 $2 </keyfile
-
+printf test > /keyfile
+/sbin/cryptsetup luksOpen $1 $2 < /keyfile
index ea1f153f99d6cb4233f3c1383b4ffc4759e7d50d..6c7462d317594ce0d0a9108225f8f9d8fee14f89 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-exec </dev/console >/dev/console 2>&1
+exec < /dev/console > /dev/console 2>&1
 set -x
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
 export TERM=linux
@@ -12,14 +12,14 @@ wait_for_if_link() {
     local cnt=0
     local li
     while [ $cnt -lt 600 ]; do
-        li=$(ip -o link show dev $1 2>/dev/null)
-       [ -n "$li" ] && return 0
+        li=$(ip -o link show dev $1 2> /dev/null)
+        [ -n "$li" ] && return 0
         if [[ $2 ]]; then
-           li=$(ip -o link show dev $2 2>/dev/null)
-           [ -n "$li" ] && return 0
+            li=$(ip -o link show dev $2 2> /dev/null)
+            [ -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,15 +42,13 @@ 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
 }
 
 linkup() {
-    wait_for_if_link $1 2>/dev/null\
-     && ip link set $1 up 2>/dev/null\
-     && wait_for_if_up $1 2>/dev/null
+    wait_for_if_link $1 2> /dev/null && ip link set $1 up 2> /dev/null && wait_for_if_up $1 2> /dev/null
 }
 
 wait_for_if_link eth0 ens3
@@ -63,13 +61,13 @@ linkup ens3
 
 modprobe af_packet
 nbd-server
->/var/lib/dhcpd/dhcpd.leases
+> /var/lib/dhcpd/dhcpd.leases
 chmod 777 /var/lib/dhcpd/dhcpd.leases
 dhcpd -d -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases &
 echo "Serving NBD disks"
 while :; do
-       [ -n "$(jobs -rp)" ] && echo > /dev/watchdog
-       sleep 10
+    [ -n "$(jobs -rp)" ] && echo > /dev/watchdog
+    sleep 10
 done
 mount -n -o remount,ro /
 poweroff -f
index 419e9d28c05814d4664f0ed9d49890619b5ad4bb..02a5d70a672908acdffc999f5f1f966c37738a40 100755 (executable)
@@ -12,12 +12,12 @@ test_check() {
     # NBD is still too flaky and hangs hard sometimes
     return 1
 
-    if ! type -p nbd-server 2>/dev/null; then
+    if ! type -p nbd-server 2> /dev/null; then
         echo "Test needs nbd-server... Skipping"
         return 1
     fi
 
-    if ! modinfo -k $KVERSION nbd &>/dev/null; then
+    if ! modinfo -k $KVERSION nbd &> /dev/null; then
         echo "Kernel module nbd does not exist"
         return 1
     fi
@@ -46,7 +46,7 @@ run_server() {
 
     if ! [[ $SERIAL ]]; then
         echo "Waiting for the server to startup"
-        while : ; do
+        while :; do
             grep Serving "$TESTDIR"/server.log && break
             tail "$TESTDIR"/server.log
             sleep 1
@@ -126,73 +126,73 @@ client_run() {
     # The default is ext3,errors=continue so use that to determine
     # if our options were parsed and used
     client_test "NBD root=nbd:IP:port" 52:54:00:12:34:00 \
-                "root=nbd:192.168.50.1:raw rd.luks=0" || return 1
+        "root=nbd:192.168.50.1:raw rd.luks=0" || return 1
 
     client_test "NBD root=nbd:IP:port::fsopts" 52:54:00:12:34:00 \
-                "root=nbd:192.168.50.1:raw::errors=panic rd.luks=0" \
-                ext3 errors=panic || return 1
+        "root=nbd:192.168.50.1:raw::errors=panic rd.luks=0" \
+        ext3 errors=panic || return 1
 
     client_test "NBD root=nbd:IP:port:fstype" 52:54:00:12:34:00 \
-                "root=nbd:192.168.50.1:raw:ext3 rd.luks=0" ext3 || return 1
+        "root=nbd:192.168.50.1:raw:ext3 rd.luks=0" ext3 || return 1
 
     client_test "NBD root=nbd:IP:port:fstype:fsopts" 52:54:00:12:34:00 \
-                "root=nbd:192.168.50.1:raw:ext3:errors=panic rd.luks=0" \
-                ext3 errors=panic || return 1
+        "root=nbd:192.168.50.1:raw:ext3:errors=panic rd.luks=0" \
+        ext3 errors=panic || return 1
 
-#
-# FIXME! These fail, but probably shouldn't
-#
+    #
+    # FIXME! These fail, but probably shouldn't
+    #
 
     # There doesn't seem to be a good way to validate the NBD options, so
     # just check that we don't screw up the other options
-#
-#    client_test "NBD root=nbd:IP:port:::NBD opts" 52:54:00:12:34:00 \
-#                "root=nbd:192.168.50.1:raw:::bs=2048 rd.luks=0" || return 1
-#
-#    client_test "NBD root=nbd:IP:port:fstype::NBD opts" 52:54:00:12:34:00 \
-#                "root=nbd:192.168.50.1:raw:ext3::bs=2048 rd.luks=0" ext3 || return 1
-#
-#    client_test "NBD root=nbd:IP:port:fstype:fsopts:NBD opts" \
-#                52:54:00:12:34:00 \
-#                "root=nbd:192.168.50.1:raw:ext3:errors=panic:bs=2048 rd.luks=0" \
-#                ext3 errors=panic || return 1
+    #
+    #    client_test "NBD root=nbd:IP:port:::NBD opts" 52:54:00:12:34:00 \
+    #                "root=nbd:192.168.50.1:raw:::bs=2048 rd.luks=0" || return 1
+    #
+    #    client_test "NBD root=nbd:IP:port:fstype::NBD opts" 52:54:00:12:34:00 \
+    #                "root=nbd:192.168.50.1:raw:ext3::bs=2048 rd.luks=0" ext3 || return 1
+    #
+    #    client_test "NBD root=nbd:IP:port:fstype:fsopts:NBD opts" \
+    #                52:54:00:12:34:00 \
+    #                "root=nbd:192.168.50.1:raw:ext3:errors=panic:bs=2048 rd.luks=0" \
+    #                ext3 errors=panic || return 1
 
     # DHCP root-path parsing
 
     client_test "NBD root=dhcp DHCP root-path nbd:srv:port" 52:54:00:12:34:01 \
-                "root=dhcp rd.luks=0" || return 1
+        "root=dhcp rd.luks=0" || return 1
 
     client_test "NBD root=dhcp DHCP root-path nbd:srv:port:fstype" \
-                52:54:00:12:34:02 "root=dhcp rd.luks=0" ext3 || return 1
+        52:54:00:12:34:02 "root=dhcp rd.luks=0" ext3 || return 1
 
     client_test "NBD root=dhcp DHCP root-path nbd:srv:port::fsopts" \
-                52:54:00:12:34:03 "root=dhcp rd.luks=0" ext3 errors=panic || return 1
+        52:54:00:12:34:03 "root=dhcp rd.luks=0" ext3 errors=panic || return 1
 
     client_test "NBD root=dhcp DHCP root-path nbd:srv:port:fstype:fsopts" \
-                52:54:00:12:34:04 "root=dhcp rd.luks=0" ext3 errors=panic || return 1
+        52:54:00:12:34:04 "root=dhcp rd.luks=0" ext3 errors=panic || return 1
 
     # netroot handling
 
     client_test "NBD netroot=nbd:IP:port" 52:54:00:12:34:00 \
-                "netroot=nbd:192.168.50.1:raw rd.luks=0" || return 1
+        "netroot=nbd:192.168.50.1:raw rd.luks=0" || return 1
 
     client_test "NBD netroot=dhcp DHCP root-path nbd:srv:port:fstype:fsopts" \
-                52:54:00:12:34:04 "netroot=dhcp rd.luks=0" ext3 errors=panic || return 1
+        52:54:00:12:34:04 "netroot=dhcp rd.luks=0" ext3 errors=panic || return 1
 
     # Encrypted root handling via LVM/LUKS over NBD
 
     . $TESTDIR/luks.uuid
 
     client_test "NBD root=LABEL=dracut netroot=nbd:IP:port" \
-                52:54:00:12:34:00 \
-                "root=LABEL=dracut rd.luks.uuid=$ID_FS_UUID rd.lv.vg=dracut netroot=nbd:192.168.50.1:encrypted" || return 1
+        52:54:00:12:34:00 \
+        "root=LABEL=dracut rd.luks.uuid=$ID_FS_UUID rd.lv.vg=dracut netroot=nbd:192.168.50.1:encrypted" || return 1
 
     # XXX This should be ext3,errors=panic but that doesn't currently
     # XXX work when you have a real root= line in addition to netroot=
     # XXX How we should work here needs clarification
-#    client_test "NBD root=LABEL=dracut netroot=dhcp (w/ fstype and opts)" \
-#                52:54:00:12:34:05 \
-#                "root=LABEL=dracut rd.luks.uuid=$ID_FS_UUID rd.lv.vg=dracut netroot=dhcp" || return 1
+    #    client_test "NBD root=LABEL=dracut netroot=dhcp (w/ fstype and opts)" \
+    #                52:54:00:12:34:05 \
+    #                "root=LABEL=dracut rd.luks.uuid=$ID_FS_UUID rd.lv.vg=dracut netroot=dhcp" || return 1
 
     if [[ -s server.pid ]]; then
         kill -TERM $(cat $TESTDIR/server.pid)
@@ -223,14 +223,14 @@ make_encrypted_root() {
         )
 
         inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
-                      mount dmesg mkdir cp ping dd
+            mount dmesg mkdir cp ping dd
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [ -f ${_terminfodir}/l/linux ] && break
         done
         inst_multiple -o ${_terminfodir}/l/linux
         inst ./client-init.sh /sbin/init
         inst_simple /etc/os-release
-        find_binary plymouth >/dev/null && inst_multiple plymouth
+        find_binary plymouth > /dev/null && inst_multiple plymouth
         cp -a /etc/ld.so.conf* $initdir/etc
         ldconfig -r "$initdir"
     )
@@ -259,10 +259,10 @@ make_encrypted_root() {
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-                       -m "dash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
-                       -d "piix ide-gd_mod ata_piix ext3 ext3 sd_mod" \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
+        -m "dash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules qemu" \
+        -d "piix ide-gd_mod ata_piix ext3 ext3 sd_mod" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
     rm -rf -- $TESTDIR/overlay
 
     # Invoke KVM and/or QEMU to actually create the target filesystem.
@@ -270,7 +270,7 @@ make_encrypted_root() {
         -drive format=raw,index=0,media=disk,file=$TESTDIR/encrypted.ext3 \
         -drive format=raw,index=1,media=disk,file=$TESTDIR/flag.img \
         -append "root=/dev/fakeroot rw quiet console=ttyS0,115200n81 selinux=0" \
-        -initrd $TESTDIR/initramfs.makeroot  || return 1
+        -initrd $TESTDIR/initramfs.makeroot || return 1
     grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created $TESTDIR/flag.img || return 1
     grep -F -a -m 1 ID_FS_UUID $TESTDIR/flag.img > $TESTDIR/luks.uuid
 }
@@ -295,7 +295,7 @@ make_client_root() {
             done
         )
         inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
-                      dmesg mkdir cp ping dd
+            dmesg mkdir cp ping dd
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [ -f ${_terminfodir}/l/linux ] && break
         done
@@ -305,7 +305,7 @@ make_client_root() {
         inst /etc/nsswitch.conf /etc/nsswitch.conf
         inst /etc/passwd /etc/passwd
         inst /etc/group /etc/group
-        for i in /usr/lib*/libnss_files* /lib*/libnss_files*;do
+        for i in /usr/lib*/libnss_files* /lib*/libnss_files*; do
             [ -e "$i" ] || continue
             inst $i
         done
@@ -327,18 +327,18 @@ make_client_root() {
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-                       -m "dash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
-                       -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
-                       --nomdadmconf \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
+        -m "dash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
+        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
+        --nomdadmconf \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
 
     # Invoke KVM and/or QEMU to actually create the target filesystem.
     $testdir/run-qemu \
         -drive format=raw,index=0,media=disk,file=$TESTDIR/nbd.ext3 \
         -drive format=raw,index=1,media=disk,file=$TESTDIR/flag.img \
         -append "root=/dev/dracut/root rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
-        -initrd $TESTDIR/initramfs.makeroot  || return 1
+        -initrd $TESTDIR/initramfs.makeroot || return 1
     grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created $TESTDIR/flag.img || return 1
     rm -fr "$TESTDIR"/overlay
 }
@@ -355,11 +355,11 @@ make_server_root() {
         . "$basedir"/dracut-init.sh
         mkdir -p "$initdir"
         (
-            cd "$initdir";
+            cd "$initdir"
             mkdir -p run dev sys proc etc var var/lib/dhcpd tmp etc/nbd-server
             ln -s ../run var/run
         )
-        cat > "$initdir/etc/nbd-server/config" <<EOF
+        cat > "$initdir/etc/nbd-server/config" << EOF
 [generic]
 [raw]
 exportname = /dev/sdb
@@ -371,14 +371,14 @@ port = 2001
 bs = 4096
 EOF
         inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
-                      dmesg mkdir cp ping grep \
-                      sleep nbd-server chmod modprobe vi
+            dmesg mkdir cp ping grep \
+            sleep nbd-server chmod modprobe vi
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [ -f ${_terminfodir}/l/linux ] && break
         done
         inst_multiple -o ${_terminfodir}/l/linux
         instmods af_packet
-        type -P dhcpd >/dev/null && inst_multiple dhcpd
+        type -P dhcpd > /dev/null && inst_multiple dhcpd
         [ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
         inst ./server-init.sh /sbin/init
         inst_simple /etc/os-release
@@ -387,7 +387,7 @@ EOF
         inst /etc/nsswitch.conf /etc/nsswitch.conf
         inst /etc/passwd /etc/passwd
         inst /etc/group /etc/group
-        for i in /usr/lib*/libnss_files* /lib*/libnss_files*;do
+        for i in /usr/lib*/libnss_files* /lib*/libnss_files*; do
             [ -e "$i" ] || continue
             inst $i
         done
@@ -410,18 +410,18 @@ EOF
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-                       -m "dash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
-                       -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
-                       --nomdadmconf \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
+        -m "dash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
+        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
+        --nomdadmconf \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
 
     # Invoke KVM and/or QEMU to actually create the target filesystem.
     $testdir/run-qemu \
         -drive format=raw,index=0,media=disk,file=$TESTDIR/server.ext3 \
         -drive format=raw,index=1,media=disk,file=$TESTDIR/flag.img \
         -append "root=/dev/dracut/root rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
-        -initrd $TESTDIR/initramfs.makeroot  || return 1
+        -initrd $TESTDIR/initramfs.makeroot || return 1
     grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created $TESTDIR/flag.img || return 1
     rm -fr "$TESTDIR"/overlay
 }
@@ -452,17 +452,17 @@ test_setup() {
     )
 
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-         -m "dash udev-rules rootfs-block fs-lib base debug kernel-modules" \
-         -d "af_packet piix ide-gd_mod ata_piix ext3 ext3 sd_mod e1000" \
-         --no-hostonly-cmdline -N \
-         -f $TESTDIR/initramfs.server $KVERSION || return 1
+        -m "dash udev-rules rootfs-block fs-lib base debug kernel-modules" \
+        -d "af_packet piix ide-gd_mod ata_piix ext3 ext3 sd_mod e1000" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.server $KVERSION || return 1
 
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-         -o "plymouth" \
-         -a "debug watchdog" \
-         -d "af_packet piix ide-gd_mod ata_piix ext3 ext3 sd_mod e1000 i6300esb ib700wdt" \
-         --no-hostonly-cmdline -N \
-         -f $TESTDIR/initramfs.testing $KVERSION || return 1
+        -o "plymouth" \
+        -a "debug watchdog" \
+        -d "af_packet piix ide-gd_mod ata_piix ext3 ext3 sd_mod e1000 i6300esb ib700wdt" \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.testing $KVERSION || return 1
 }
 
 kill_server() {
index 38879049c9642a312bc2c5985de5fb777e5dd18e..33d27256992db7018799c697b94b118fc5b8d754 100755 (executable)
@@ -2,7 +2,7 @@
 getcmdline() {
     while read -r _line || [ -n "$_line" ]; do
         printf "%s" "$_line"
-    done </proc/cmdline;
+    done < /proc/cmdline
 }
 
 _dogetarg() {
@@ -17,7 +17,7 @@ _dogetarg() {
             if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
                 # if $1 has a "=<value>", we want the exact match
                 if [ "$_o" = "$1" ]; then
-                    _val="1";
+                    _val="1"
                     unset _doecho
                 fi
                 continue
@@ -25,7 +25,7 @@ _dogetarg() {
 
             if [ "${_o#*=}" = "$_o" ]; then
                 # if cmdline argument has no "=<value>", we assume "=1"
-                _val="1";
+                _val="1"
                 unset _doecho
                 continue
             fi
@@ -35,18 +35,22 @@ _dogetarg() {
         fi
     done
     if [ -n "$_val" ]; then
-        [ "x$_doecho" != "x" ] && echo "$_val";
-        return 0;
+        [ "x$_doecho" != "x" ] && echo "$_val"
+        return 0
     fi
-    return 1;
+    return 1
 }
 
 getarg() {
     local _deprecated _newoption
     while [ $# -gt 0 ]; do
         case $1 in
-            -d) _deprecated=1; shift;;
-            -y) if _dogetarg $2 >/dev/null; then
+            -d)
+                _deprecated=1
+                shift
+                ;;
+            -y)
+                if _dogetarg $2 > /dev/null; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption' instead." || warn "Option '$2' is deprecated."
                     fi
@@ -54,27 +58,32 @@ getarg() {
                     return 0
                 fi
                 _deprecated=0
-                shift 2;;
-            -n) if _dogetarg $2 >/dev/null; then
-                    echo 0;
+                shift 2
+                ;;
+            -n)
+                if _dogetarg $2 > /dev/null; then
+                    echo 0
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$2' is deprecated, use '$_newoption=0' instead." || warn "Option '$2' is deprecated."
                     fi
                     return 1
                 fi
                 _deprecated=0
-                shift 2;;
-            *)  if [ -z "$_newoption" ]; then
+                shift 2
+                ;;
+            *)
+                if [ -z "$_newoption" ]; then
                     _newoption="$1"
                 fi
                 if _dogetarg $1; then
                     if [ "$_deprecated" = "1" ]; then
                         [ -n "$_newoption" ] && warn "Kernel command line option '$1' is deprecated, use '$_newoption' instead." || warn "Option '$1' is deprecated."
                     fi
-                    return 0;
+                    return 0
                 fi
                 _deprecated=0
-                shift;;
+                shift
+                ;;
         esac
     done
     return 1
@@ -84,7 +93,8 @@ getargbool() {
     local _b
     unset _b
     local _default
-    _default="$1"; shift
+    _default="$1"
+    shift
     _b=$(getarg "$@")
     [ $? -ne 0 -a -z "$_b" ] && _b="$_default"
     if [ -n "$_b" ]; then
@@ -95,23 +105,22 @@ getargbool() {
     return 0
 }
 
-exec >/dev/console 2>&1
+exec > /dev/console 2>&1
 set -x
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
 strstr() { [ "${1##*"$2"*}" != "$1" ]; }
 strglobin() { [ -n "$1" -a -z "${1##*$2*}" ]; }
-CMDLINE=$(while read line || [ -n "$line" ]; do echo $line;done < /proc/cmdline)
+CMDLINE=$(while read line || [ -n "$line" ]; do echo $line; done < /proc/cmdline)
 export TERM=linux
 export PS1='initramfs-test:\w\$ '
 stty sane
 echo "made it to the rootfs! Powering down."
-for i in /sys/class/net/*
-do
+for i in /sys/class/net/*; do
     # booting with network-manager module
     state=/run/NetworkManager/devices/$(cat $i/ifindex)
-    grep -q connection-uuid= $state 2>/dev/null || continue
+    grep -q connection-uuid= $state 2> /dev/null || continue
     i=${i##*/}
-    ip link show $i |grep -q master && continue
+    ip link show $i | grep -q master && continue
     IFACES+="$i "
 done
 for i in /run/initramfs/net.*.did-setup; do
index b15110f792fe8cf0bf3e6db63f63abf32b2a9b77..40e8421559f0f30fcacb2717d4fb1227f1c9cd10 100755 (executable)
@@ -8,7 +8,7 @@ udevadm control --reload
 udevadm settle
 set -e
 # save a partition at the beginning for future flagging purposes
-sfdisk /dev/sda <<EOF
+sfdisk /dev/sda << EOF
 ,1M
 ,
 EOF
index 22e821e2c245cb3de947fd1b95ab96a68f67ff02..4f550084bd5603bc9ba3c92fb943545712807a8a 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-exec </dev/console >/dev/console 2>&1
+exec < /dev/console > /dev/console 2>&1
 set -x
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
 export TERM=linux
@@ -13,14 +13,14 @@ wait_for_if_link() {
     local cnt=0
     local li
     while [ $cnt -lt 600 ]; do
-        li=$(ip -o link show dev $1 2>/dev/null)
-       [ -n "$li" ] && return 0
+        li=$(ip -o link show dev $1 2> /dev/null)
+        [ -n "$li" ] && return 0
         if [[ $2 ]]; then
-           li=$(ip -o link show dev $2 2>/dev/null)
-           [ -n "$li" ] && return 0
+            li=$(ip -o link show dev $2 2> /dev/null)
+            [ -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,61 +43,59 @@ 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
 }
 
 linkup() {
-    wait_for_if_link $1 2>/dev/null\
-     && ip link set $1 up 2>/dev/null\
-     && wait_for_if_up $1 2>/dev/null
+    wait_for_if_link $1 2> /dev/null && ip link set $1 up 2> /dev/null && wait_for_if_up $1 2> /dev/null
 }
 
 wait_for_if_link eth0 ens2
 
->/dev/watchdog
+> /dev/watchdog
 ip addr add 127.0.0.1/8 dev lo
 linkup lo
 ip link set dev eth0 name ens2
 ip addr add 192.168.50.1/24 dev ens2
 linkup ens2
 
->/dev/watchdog
+> /dev/watchdog
 modprobe af_packet
 > /dev/watchdog
 modprobe sunrpc
->/dev/watchdog
+> /dev/watchdog
 mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs
->/dev/watchdog
+> /dev/watchdog
 [ -x /sbin/portmap ] && portmap
->/dev/watchdog
+> /dev/watchdog
 mkdir -p /run/rpcbind
 [ -x /sbin/rpcbind ] && rpcbind
->/dev/watchdog
+> /dev/watchdog
 modprobe nfsd
->/dev/watchdog
+> /dev/watchdog
 mount -t nfsd nfsd /proc/fs/nfsd
->/dev/watchdog
+> /dev/watchdog
 exportfs -r
->/dev/watchdog
+> /dev/watchdog
 rpc.nfsd
->/dev/watchdog
+> /dev/watchdog
 rpc.mountd
->/dev/watchdog
+> /dev/watchdog
 rpc.idmapd -S
->/dev/watchdog
+> /dev/watchdog
 exportfs -r
->/dev/watchdog
->/var/lib/dhcpd/dhcpd.leases
->/dev/watchdog
+> /dev/watchdog
+> /var/lib/dhcpd/dhcpd.leases
+> /dev/watchdog
 chmod 777 /var/lib/dhcpd/dhcpd.leases
->/dev/watchdog
+> /dev/watchdog
 dhcpd -d -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases &
 echo "Serving NFS mounts"
 while :; do
-       [ -n "$(jobs -rp)" ] && echo > /dev/watchdog
-       sleep 10
+    [ -n "$(jobs -rp)" ] && echo > /dev/watchdog
+    sleep 10
 done
 mount -n -o remount,ro /
 poweroff -f
index e9328a8d770596018b91853a63309f3c516406d5..21fbcaf41309c1aec30928534beb5fe548026313 100755 (executable)
@@ -16,8 +16,6 @@ KVERSION=${KVERSION-$(uname -r)}
 #DEBUGFAIL="rd.shell rd.break"
 #SERIAL="tcp:127.0.0.1:9999"
 
-
-
 run_server() {
     # Start server first
     echo "MULTINIC TEST SETUP: Starting DHCP/NFS server"
@@ -39,7 +37,7 @@ run_server() {
     tty -s && stty sane
 
     if ! [[ $SERIAL ]]; then
-        while : ; do
+        while :; do
             grep Serving "$TESTDIR"/server.log && break
             echo "Waiting for the server to startup"
             tail "$TESTDIR"/server.log
@@ -68,19 +66,22 @@ client_test() {
     fi
 
     $testdir/run-qemu -drive format=raw,index=0,media=disk,file="$TESTDIR"/client.img \
-                      -net socket,connect=127.0.0.1:12350 \
-                      -net nic,macaddr=52:54:00:12:34:$mac1,model=e1000 \
-                      -net nic,macaddr=52:54:00:12:34:$mac2,model=e1000 \
-                      -net nic,macaddr=52:54:00:12:34:$mac3,model=e1000 \
-                      -netdev hubport,id=n1,hubid=1 \
-                      -netdev hubport,id=n2,hubid=2 \
-                      -device e1000,netdev=n1,mac=52:54:00:12:34:98 \
-                      -device e1000,netdev=n2,mac=52:54:00:12:34:99 \
-                      -watchdog i6300esb -watchdog-action poweroff \
-                      -append "quiet rd.net.timeout.dhcp=3 panic=1 systemd.crash_reboot rd.shell=0 $cmdline $DEBUGFAIL rd.retry=5 ro console=ttyS0,115200n81 selinux=0 init=/sbin/init rd.debug systemd.log_target=console" \
-                      -initrd "$TESTDIR"/initramfs.testing
-
-    { read OK; read IFACES; } < "$TESTDIR"/client.img
+        -net socket,connect=127.0.0.1:12350 \
+        -net nic,macaddr=52:54:00:12:34:$mac1,model=e1000 \
+        -net nic,macaddr=52:54:00:12:34:$mac2,model=e1000 \
+        -net nic,macaddr=52:54:00:12:34:$mac3,model=e1000 \
+        -netdev hubport,id=n1,hubid=1 \
+        -netdev hubport,id=n2,hubid=2 \
+        -device e1000,netdev=n1,mac=52:54:00:12:34:98 \
+        -device e1000,netdev=n2,mac=52:54:00:12:34:99 \
+        -watchdog i6300esb -watchdog-action poweroff \
+        -append "quiet rd.net.timeout.dhcp=3 panic=1 systemd.crash_reboot rd.shell=0 $cmdline $DEBUGFAIL rd.retry=5 ro console=ttyS0,115200n81 selinux=0 init=/sbin/init rd.debug systemd.log_target=console" \
+        -initrd "$TESTDIR"/initramfs.testing
+
+    {
+        read OK
+        read IFACES
+    } < "$TESTDIR"/client.img
 
     if [[ "$OK" != "OK" ]]; then
         echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]"
@@ -107,7 +108,6 @@ client_test() {
     return 0
 }
 
-
 test_run() {
     if ! run_server; then
         echo "Failed to start server" 1>&2
@@ -126,49 +126,49 @@ test_client() {
 
     # PXE Style BOOTIF=
     client_test "MULTINIC root=nfs BOOTIF=" \
-                00 01 02 \
-                "root=nfs:192.168.50.1:/nfs/client BOOTIF=52-54-00-12-34-00" \
-                "ens2" || return 1
+        00 01 02 \
+        "root=nfs:192.168.50.1:/nfs/client BOOTIF=52-54-00-12-34-00" \
+        "ens2" || return 1
 
     client_test "MULTINIC root=nfs BOOTIF= ip=ens4:dhcp" \
-                00 01 02 \
-                "root=nfs:192.168.50.1:/nfs/client BOOTIF=52-54-00-12-34-00 ip=ens3:dhcp" \
-                "ens2 ens3" || return 1
+        00 01 02 \
+        "root=nfs:192.168.50.1:/nfs/client BOOTIF=52-54-00-12-34-00 ip=ens3:dhcp" \
+        "ens2 ens3" || return 1
 
     # PXE Style BOOTIF= with dhcp root-path
     client_test "MULTINIC root=dhcp BOOTIF=" \
-                00 01 02 \
-                "root=dhcp BOOTIF=52-54-00-12-34-02" \
-                "ens4" || return 1
+        00 01 02 \
+        "root=dhcp BOOTIF=52-54-00-12-34-02" \
+        "ens4" || return 1
 
     # Multinic case, where only one nic works
     client_test "MULTINIC root=nfs ip=dhcp" \
-                FF 00 FE \
-                "root=nfs:192.168.50.1:/nfs/client ip=dhcp" \
-                "ens3" || return 1
+        FF 00 FE \
+        "root=nfs:192.168.50.1:/nfs/client ip=dhcp" \
+        "ens3" || return 1
 
     # Require two interfaces
     client_test "MULTINIC root=nfs ip=ens3:dhcp ip=ens4:dhcp bootdev=ens3" \
-                00 01 02 \
-                "root=nfs:192.168.50.1:/nfs/client ip=ens3:dhcp ip=ens4:dhcp bootdev=ens3" \
-                "ens3 ens4" || return 1
+        00 01 02 \
+        "root=nfs:192.168.50.1:/nfs/client ip=ens3:dhcp ip=ens4:dhcp bootdev=ens3" \
+        "ens3 ens4" || return 1
 
     # Require three interfaces with dhcp root-path
     client_test "MULTINIC root=dhcp ip=ens2:dhcp ip=ens3:dhcp ip=ens4:dhcp bootdev=ens4" \
-                00 01 02 \
-                "root=dhcp ip=ens2:dhcp ip=ens3:dhcp ip=ens4:dhcp bootdev=ens4" \
-                "ens2 ens3 ens4" || return 1
+        00 01 02 \
+        "root=dhcp ip=ens2:dhcp ip=ens3:dhcp ip=ens4:dhcp bootdev=ens4" \
+        "ens2 ens3 ens4" || return 1
 
     client_test "MULTINIC bonding" \
-                00 01 02 \
-                "root=nfs:192.168.50.1:/nfs/client ip=bond0:dhcp  bond=bond0:ens2,ens3,ens4:mode=balance-rr" \
-                "bond0" || return 1
+        00 01 02 \
+        "root=nfs:192.168.50.1:/nfs/client ip=bond0:dhcp  bond=bond0:ens2,ens3,ens4:mode=balance-rr" \
+        "bond0" || return 1
 
     # bridge, where only one interface is actually connected
     client_test "MULTINIC bridging" \
-                00 01 02 \
-                "root=nfs:192.168.50.1:/nfs/client ip=bridge0:dhcp  bridge=bridge0:ens2,ens6,ens7" \
-                "bridge0" || return 1
+        00 01 02 \
+        "root=nfs:192.168.50.1:/nfs/client ip=bridge0:dhcp  bridge=bridge0:ens2,ens6,ens7" \
+        "bridge0" || return 1
     return 0
 }
 
@@ -182,9 +182,8 @@ test_setup() {
         export initdir=$TESTDIR/overlay/source
         . $basedir/dracut-init.sh
 
-
         (
-            cd "$initdir";
+            cd "$initdir"
             mkdir -p -- dev sys proc run var/run etc tmp var/lib/{dhcpd,rpcbind}
             mkdir -p -- var/lib/nfs/{v4recovery,rpc_pipefs}
             chmod 777 -- var/lib/rpcbind var/lib/nfs
@@ -202,17 +201,17 @@ test_setup() {
         done
 
         inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
-                      dmesg mkdir cp ping exportfs \
-                      modprobe rpc.nfsd rpc.mountd showmount tcpdump \
-                      /etc/services sleep mount chmod
+            dmesg mkdir cp ping exportfs \
+            modprobe rpc.nfsd rpc.mountd showmount tcpdump \
+            /etc/services sleep mount chmod
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [ -f "${_terminfodir}"/l/linux ] && break
         done
         inst_multiple -o "${_terminfodir}"/l/linux
-        type -P portmap >/dev/null && inst_multiple portmap
-        type -P rpcbind >/dev/null && inst_multiple rpcbind
+        type -P portmap > /dev/null && inst_multiple portmap
+        type -P rpcbind > /dev/null && inst_multiple rpcbind
         [ -f /etc/netconfig ] && inst_multiple /etc/netconfig
-        type -P dhcpd >/dev/null && inst_multiple dhcpd
+        type -P dhcpd > /dev/null && inst_multiple dhcpd
         [ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
         instmods nfsd sunrpc ipv6 lockd af_packet
         inst_simple /etc/os-release
@@ -229,7 +228,7 @@ test_setup() {
         inst_libdir_file 'libnfsidmap*.so*'
 
         _nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \
-                       |  tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
+            | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
         _nsslibs=${_nsslibs#|}
         _nsslibs=${_nsslibs%|}
 
@@ -258,7 +257,7 @@ test_setup() {
             done
         )
         inst_multiple sh shutdown poweroff stty cat ps ln ip \
-                      mount dmesg mkdir cp ping grep ls dd
+            mount dmesg mkdir cp ping grep ls dd
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [[ -f ${_terminfodir}/l/linux ]] && break
         done
@@ -275,7 +274,7 @@ test_setup() {
         inst_libdir_file 'libnfsidmap*.so*'
 
         _nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' -- /etc/nsswitch.conf \
-                       |  tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
+            | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
         _nsslibs=${_nsslibs#|}
         _nsslibs=${_nsslibs%|}
 
@@ -299,17 +298,17 @@ test_setup() {
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-                       -m "bash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
-                       -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
-                       --nomdadmconf \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
+        -m "bash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
+        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
+        --nomdadmconf \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
 
     # Invoke KVM and/or QEMU to actually create the target filesystem.
     $testdir/run-qemu \
         -drive format=raw,index=0,media=disk,file=$TESTDIR/server.ext3 \
         -append "root=/dev/dracut/root rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
-        -initrd $TESTDIR/initramfs.makeroot  || return 1
+        -initrd $TESTDIR/initramfs.makeroot || return 1
     grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created $TESTDIR/server.ext3 || return 1
     rm -fr "$TESTDIR"/overlay
 
index 13cef7ffa92ea268e50d622c3dc6d9b1bfdeeb45..0f3bda31bd94c757d4aa890e2387879e2bb95c6a 100755 (executable)
@@ -1,8 +1,8 @@
 #!/bin/sh
-exec >/dev/console 2>&1
+exec > /dev/console 2>&1
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
 strstr() { [ "${1#*$2*}" != "$1" ]; }
-CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
+CMDLINE=$(while read line; do echo $line; done < /proc/cmdline)
 export TERM=linux
 export PS1='initramfs-test:\w\$ '
 stty sane
@@ -10,10 +10,10 @@ echo "made it to the rootfs! Powering down."
 
 (
     echo OK
-    ip -o -4 address show scope global | while read n if rest; do echo $if;done | sort
+    ip -o -4 address show scope global | while read n if rest; do echo $if; done | sort
     for i in /run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-*; do
-         echo $i
-         grep -v 'UUID=' $i
+        echo $i
+        grep -v 'UUID=' $i
     done
     echo EOF
 ) | dd oflag=direct,dsync of=/dev/sda
index b15110f792fe8cf0bf3e6db63f63abf32b2a9b77..40e8421559f0f30fcacb2717d4fb1227f1c9cd10 100755 (executable)
@@ -8,7 +8,7 @@ udevadm control --reload
 udevadm settle
 set -e
 # save a partition at the beginning for future flagging purposes
-sfdisk /dev/sda <<EOF
+sfdisk /dev/sda << EOF
 ,1M
 ,
 EOF
index f2788305845186ea9b3ad820ae5591de7b6bf150..9a18db188a124401c7c9980b8f315b81c2ca83c0 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-exec </dev/console >/dev/console 2>&1
+exec < /dev/console > /dev/console 2>&1
 set -x
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
 export TERM=linux
@@ -13,16 +13,16 @@ wait_for_if_link() {
     local li
 
     while [ $cnt -lt 600 ]; do
-ip link show
+        ip link show
 
-        li=$(ip -o link show dev $1 2>/dev/null)
-       [ -n "$li" ] && return 0
+        li=$(ip -o link show dev $1 2> /dev/null)
+        [ -n "$li" ] && return 0
         if [[ $2 ]]; then
-           li=$(ip -o link show dev $2 2>/dev/null)
-           [ -n "$li" ] && return 0
+            li=$(ip -o link show dev $2 2> /dev/null)
+            [ -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,15 +45,13 @@ 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
 }
 
 linkup() {
-    wait_for_if_link $1 2>/dev/null\
-     && ip link set $1 up 2>/dev/null\
-     && wait_for_if_up $1 2>/dev/null
+    wait_for_if_link $1 2> /dev/null && ip link set $1 up 2> /dev/null && wait_for_if_up $1 2> /dev/null
 }
 
 udevadm settle
@@ -66,13 +64,13 @@ wait_for_if_link eth2 ens5
 wait_for_if_link eth3 ens6
 
 modprobe --all -b -q 8021q ipvlan macvlan
->/dev/watchdog
+> /dev/watchdog
 ip addr add 127.0.0.1/8 dev lo
 linkup lo
 ip link set dev eth0 name ens3
 ip addr add 192.168.50.1/24 dev ens3
 linkup ens3
->/dev/watchdog
+> /dev/watchdog
 ip link set dev eth1 name ens4
 ip link add dev ens4.1 link ens4 type vlan id 1
 ip link add dev ens4.2 link ens4 type vlan id 2
@@ -92,36 +90,36 @@ ip addr add 192.168.51.1/24 dev ens5
 linkup ens5
 ip link set dev eth3 name ens6
 linkup ens6
->/dev/watchdog
+> /dev/watchdog
 modprobe af_packet
 > /dev/watchdog
 modprobe sunrpc
->/dev/watchdog
+> /dev/watchdog
 mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs
->/dev/watchdog
+> /dev/watchdog
 [ -x /sbin/portmap ] && portmap
->/dev/watchdog
+> /dev/watchdog
 mkdir -p /run/rpcbind
 [ -x /sbin/rpcbind ] && rpcbind
->/dev/watchdog
+> /dev/watchdog
 modprobe nfsd
->/dev/watchdog
+> /dev/watchdog
 mount -t nfsd nfsd /proc/fs/nfsd
->/dev/watchdog
+> /dev/watchdog
 exportfs -r
->/dev/watchdog
+> /dev/watchdog
 rpc.nfsd
->/dev/watchdog
+> /dev/watchdog
 rpc.mountd
->/dev/watchdog
+> /dev/watchdog
 rpc.idmapd -S
->/dev/watchdog
+> /dev/watchdog
 exportfs -r
->/dev/watchdog
->/var/lib/dhcpd/dhcpd.leases
->/dev/watchdog
+> /dev/watchdog
+> /var/lib/dhcpd/dhcpd.leases
+> /dev/watchdog
 chmod 777 /var/lib/dhcpd/dhcpd.leases
->/dev/watchdog
+> /dev/watchdog
 dhcpd -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases ens3 ens5
 #echo -n 'V' > /dev/watchdog
 #sh -i
@@ -129,8 +127,8 @@ dhcpd -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases ens3 ens5
 # Wait forever for the VM to die
 echo "Serving"
 while :; do
-       sleep 10
-       >/dev/watchdog
+    sleep 10
+    /dev/watchdog
 done
 mount -n -o remount,ro /
 poweroff -f
index 77e197fb5a1956d1f97635ad485ce2f7aaaa90ae..e4090c581bdc0296ec61e58f25d3951008e5fca6 100755 (executable)
@@ -2,7 +2,6 @@
 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 
-
 if [[ $NM ]]; then
     USE_NETWORK="network-manager"
     OMIT_NETWORK="network-legacy"
@@ -47,7 +46,7 @@ run_server() {
 
     if ! [[ $SERIAL ]]; then
         echo "Waiting for the server to startup"
-        while : ; do
+        while :; do
             grep Serving "$TESTDIR"/server.log && break
             tail "$TESTDIR"/server.log
             sleep 1
@@ -88,7 +87,7 @@ client_test() {
         -netdev hubport,hubid=1,id=h1,netdev=s1 \
         -netdev hubport,hubid=1,id=h2 -device e1000,mac=52:54:00:12:34:01,netdev=h2 \
         -netdev hubport,hubid=1,id=h3 -device e1000,mac=52:54:00:12:34:02,netdev=h3 \
-        $nic1 -device e1000,mac=52:54:00:12:34:03,netdev=n1  \
+        $nic1 -device e1000,mac=52:54:00:12:34:03,netdev=n1 \
         -netdev socket,connect=127.0.0.1:12372,id=n2 -device e1000,mac=52:54:00:12:34:04,netdev=n2 \
         $nic3 -device e1000,mac=52:54:00:12:34:05,netdev=n3 \
         -watchdog i6300esb -watchdog-action poweroff \
@@ -121,13 +120,15 @@ client_test() {
     return 0
 }
 
-
 test_run() {
     if ! run_server; then
         echo "Failed to start server" 1>&2
         return 1
     fi
-    test_client || { kill_server; return 1; }
+    test_client || {
+        kill_server
+        return 1
+    }
 }
 
 test_client() {
@@ -138,8 +139,8 @@ test_client() {
     fi
 
     client_test "Multiple VLAN" \
-                "yes" \
-                "
+        "yes" \
+        "
 vlan=vlan0001:ens5
 vlan=vlan2:ens5
 vlan=ens5.3:ens5
@@ -152,7 +153,7 @@ ip=192.168.57.104::192.168.57.1:24:test:ens5.0004:none
 rd.neednet=1
 root=nfs:192.168.50.1:/nfs/client bootdev=ens3
 " \
-                "$EXPECT" \
+        "$EXPECT" \
         || return 1
 
     if [[ $NM ]]; then
@@ -162,8 +163,8 @@ root=nfs:192.168.50.1:/nfs/client bootdev=ens3
     fi
 
     client_test "Multiple Bonds" \
-                "yes" \
-                "
+        "yes" \
+        "
 bond=bond0:ens3,ens4
 bond=bond1:ens6,ens7
 ip=bond0:dhcp
@@ -171,7 +172,7 @@ ip=bond1:dhcp
 rd.neednet=1
 root=nfs:192.168.50.1:/nfs/client bootdev=bond0
 " \
-                "$EXPECT" \
+        "$EXPECT" \
         || return 1
 
     if [[ $NM ]]; then
@@ -181,8 +182,8 @@ root=nfs:192.168.50.1:/nfs/client bootdev=bond0
     fi
 
     client_test "Multiple Bridges" \
-                "no" \
-                "
+        "no" \
+        "
 bridge=br0:ens3,ens4
 bridge=br1:ens6,ens7
 ip=br0:dhcp
@@ -190,7 +191,7 @@ ip=br1:dhcp
 rd.neednet=1
 root=nfs:192.168.50.1:/nfs/client bootdev=br0
 " \
-                "$EXPECT" \
+        "$EXPECT" \
         || return 1
     kill_server
     return 0
@@ -207,7 +208,7 @@ test_setup() {
         . "$basedir"/dracut-init.sh
 
         (
-            cd "$initdir";
+            cd "$initdir"
             mkdir -p -- dev sys proc run etc var/run tmp var/lib/{dhcpd,rpcbind}
             mkdir -p -- var/lib/nfs/{v4recovery,rpc_pipefs}
             chmod 777 -- var/lib/rpcbind var/lib/nfs
@@ -225,17 +226,17 @@ test_setup() {
         done
 
         inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
-                      dmesg mkdir cp ping exportfs \
-                      modprobe rpc.nfsd rpc.mountd showmount tcpdump \
-                      /etc/services sleep mount chmod
+            dmesg mkdir cp ping exportfs \
+            modprobe rpc.nfsd rpc.mountd showmount tcpdump \
+            /etc/services sleep mount chmod
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [ -f "${_terminfodir}"/l/linux ] && break
         done
         inst_multiple -o "${_terminfodir}"/l/linux
-        type -P portmap >/dev/null && inst_multiple portmap
-        type -P rpcbind >/dev/null && inst_multiple rpcbind
+        type -P portmap > /dev/null && inst_multiple portmap
+        type -P rpcbind > /dev/null && inst_multiple rpcbind
         [ -f /etc/netconfig ] && inst_multiple /etc/netconfig
-        type -P dhcpd >/dev/null && inst_multiple dhcpd
+        type -P dhcpd > /dev/null && inst_multiple dhcpd
         [ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd
         instmods nfsd sunrpc ipv6 lockd af_packet 8021q ipvlan macvlan
         inst_simple /etc/os-release
@@ -252,7 +253,7 @@ test_setup() {
         inst_libdir_file 'libnfsidmap*.so*'
 
         _nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \
-                       |  tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
+            | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
         _nsslibs=${_nsslibs#|}
         _nsslibs=${_nsslibs%|}
 
@@ -272,7 +273,7 @@ test_setup() {
         export initdir=$TESTDIR/overlay/source/nfs/client
         . $basedir/dracut-init.sh
         inst_multiple sh shutdown poweroff stty cat ps ln ip \
-                      mount dmesg mkdir cp ping grep ls sort dd
+            mount dmesg mkdir cp ping grep ls sort dd
         for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
             [[ -f ${_terminfodir}/l/linux ]] && break
         done
@@ -294,7 +295,7 @@ test_setup() {
         inst_libdir_file 'libnfsidmap*.so*'
 
         _nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' -- /etc/nsswitch.conf \
-                       |  tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
+            | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
         _nsslibs=${_nsslibs#|}
         _nsslibs=${_nsslibs%|}
 
@@ -318,17 +319,17 @@ test_setup() {
     # We do it this way so that we do not risk trashing the host mdraid
     # devices, volume groups, encrypted partitions, etc.
     $basedir/dracut.sh -l -i $TESTDIR/overlay / \
-                       -m "bash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
-                       -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
-                       --nomdadmconf \
-                       --no-hostonly-cmdline -N \
-                       -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
+        -m "bash udev-rules base rootfs-block fs-lib kernel-modules fs-lib qemu" \
+        -d "piix ide-gd_mod ata_piix ext3 sd_mod" \
+        --nomdadmconf \
+        --no-hostonly-cmdline -N \
+        -f $TESTDIR/initramfs.makeroot $KVERSION || return 1
 
     # Invoke KVM and/or QEMU to actually create the target filesystem.
     $testdir/run-qemu \
         -drive format=raw,index=0,media=disk,file=$TESTDIR/server.ext3 \
         -append "root=/dev/dracut/root rw rootfstype=ext3 quiet console=ttyS0,115200n81 selinux=0" \
-        -initrd $TESTDIR/initramfs.makeroot  || return 1
+        -initrd $TESTDIR/initramfs.makeroot || return 1
     grep -U --binary-files=binary -F -m 1 -q dracut-root-block-created $TESTDIR/server.ext3 || return 1
     rm -fr "$TESTDIR"/overlay
 
@@ -344,20 +345,20 @@ test_setup() {
 
     # Make server's dracut image
     $basedir/dracut.sh -l -i "$TESTDIR"/overlay / \
-                       --no-early-microcode \
-                       -m "udev-rules base rootfs-block fs-lib debug kernel-modules watchdog qemu" \
-                       -d "ipvlan macvlan af_packet piix ide-gd_mod ata_piix ext3 sd_mod nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files nfsd e1000 i6300esb ib700wdt" \
-                       --no-hostonly-cmdline -N \
-                       -f "$TESTDIR"/initramfs.server "$KVERSION" || return 1
+        --no-early-microcode \
+        -m "udev-rules base rootfs-block fs-lib debug kernel-modules watchdog qemu" \
+        -d "ipvlan macvlan af_packet piix ide-gd_mod ata_piix ext3 sd_mod nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files nfsd e1000 i6300esb ib700wdt" \
+        --no-hostonly-cmdline -N \
+        -f "$TESTDIR"/initramfs.server "$KVERSION" || return 1
 
     # Make client's dracut image
     $basedir/dracut.sh -l -i "$TESTDIR"/overlay / \
-                       --no-early-microcode \
-                       -o "plymouth ${OMIT_NETWORK}" \
-                       -a "debug ${USE_NETWORK}" \
-                       -d "ipvlan macvlan af_packet piix sd_mod sr_mod ata_piix ide-gd_mod e1000 nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files sunrpc i6300esb ib700wdt" \
-                       --no-hostonly-cmdline -N \
-                       -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1
+        --no-early-microcode \
+        -o "plymouth ${OMIT_NETWORK}" \
+        -a "debug ${USE_NETWORK}" \
+        -d "ipvlan macvlan af_packet piix sd_mod sr_mod ata_piix ide-gd_mod e1000 nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files sunrpc i6300esb ib700wdt" \
+        --no-hostonly-cmdline -N \
+        -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1
 }
 
 kill_server() {
index 5954e95663c2992270ff02602926af42c49b00ee..64ff9cdfb5c6871109205b6b418e66e9cf71342d 100755 (executable)
@@ -41,44 +41,44 @@ test_run() {
         for key in "${!TEST[@]}"; do
             if ! val=$(./dracut-getarg "${key}="); then
                 echo "'$key' == '${TEST[$key]}', but not found" >&2
-                ret=$((ret+1))
+                ret=$((ret + 1))
             else
                 if [[ $val != "${TEST[$key]}" ]]; then
                     echo "'$key' != '${TEST[$key]}' but '$val'" >&2
-                    ret=$((ret+1))
+                    ret=$((ret + 1))
                 fi
             fi
         done
 
         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
+            if (($? == 0)); then
                 echo "key '$key' should not be found"
-                ret=$((ret+1))
+                ret=$((ret + 1))
             fi
             # must have no output
-            [[ $val ]] && ret=$((ret+1))
+            [[ $val ]] && ret=$((ret + 1))
         done
 
         RESULT=("val" "val2")
         readarray -t args < <(./dracut-getargs "key2=")
-        (( ${#RESULT[@]} == ${#args[@]} )) || ret=$((ret+1))
-        for ((i=0; i < ${#RESULT[@]}; i++)); do
-            [[ ${args[$i]} == "${RESULT[$i]}" ]] || ret=$((ret+1))
+        ((${#RESULT[@]} == ${#args[@]})) || ret=$((ret + 1))
+        for ((i = 0; i < ${#RESULT[@]}; i++)); do
+            [[ ${args[$i]} == "${RESULT[$i]}" ]] || ret=$((ret + 1))
         done
 
-        val=$(./dracut-getarg "key1") || ret=$((ret+1))
-        [[ $val == "0" ]] || ret=$((ret+1))
+        val=$(./dracut-getarg "key1") || ret=$((ret + 1))
+        [[ $val == "0" ]] || ret=$((ret + 1))
 
-        val=$(./dracut-getarg "key2=val") && ret=$((ret+1))
+        val=$(./dracut-getarg "key2=val") && ret=$((ret + 1))
         # must have no output
-        [[ $val ]] && ret=$((ret+1))
-        val=$(./dracut-getarg "key2=val2") || ret=$((ret+1))
+        [[ $val ]] && ret=$((ret + 1))
+        val=$(./dracut-getarg "key2=val2") || ret=$((ret + 1))
         # must have no output
-        [[ $val ]] && ret=$((ret+1))
+        [[ $val ]] && ret=$((ret + 1))
 
         export PATH=".:$PATH"
 
@@ -96,27 +96,27 @@ test_run() {
             echo "rdbreak=cmdline rd.lvm rd.auto rd.retry=10"
         }
         RDRETRY=$(getarg rd.retry -d 'rd_retry=')
-        [[ $RDRETRY == "10" ]] || ret=$((ret+1))
-        getarg rd.break=cmdline -d rdbreak=cmdline || ret=$((ret+1))
-        getargbool 1 rd.lvm -d -n rd_NO_LVM || ret=$((ret+1))
-        getargbool 0 rd.auto || ret=$((ret+1))
+        [[ $RDRETRY == "10" ]] || ret=$((ret + 1))
+        getarg rd.break=cmdline -d rdbreak=cmdline || ret=$((ret + 1))
+        getargbool 1 rd.lvm -d -n rd_NO_LVM || ret=$((ret + 1))
+        getargbool 0 rd.auto || ret=$((ret + 1))
 
         getcmdline() {
             echo "rd.break=cmdlined rd.lvm=0 rd.auto=0"
         }
-        getarg rd.break=cmdline -d rdbreak=cmdline && ret=$((ret+1))
-        getargbool 1 rd.lvm -d -n rd_NO_LVM && ret=$((ret+1))
-        getargbool 0 rd.auto && ret=$((ret+1))
+        getarg rd.break=cmdline -d rdbreak=cmdline && ret=$((ret + 1))
+        getargbool 1 rd.lvm -d -n rd_NO_LVM && ret=$((ret + 1))
+        getargbool 0 rd.auto && ret=$((ret + 1))
 
         getcmdline() {
             echo "ip=a ip=b ip=dhcp6"
         }
-        getargs "ip=dhcp6" &>/dev/null || ret=$((ret+1))
+        getargs "ip=dhcp6" &> /dev/null || ret=$((ret + 1))
         readarray -t args < <(getargs "ip=")
         RESULT=("a" "b" "dhcp6")
-        (( ${#RESULT[@]} || ${#args[@]} )) || ret=$((ret+1))
-        for ((i=0; i < ${#RESULT[@]}; i++)); do
-            [[ ${args[$i]} == "${RESULT[$i]}" ]] || ret=$((ret+1))
+        ((${#RESULT[@]} || ${#args[@]})) || ret=$((ret + 1))
+        for ((i = 0; i < ${#RESULT[@]}; i++)); do
+            [[ ${args[$i]} == "${RESULT[$i]}" ]] || ret=$((ret + 1))
         done
 
         getcmdline() {
@@ -124,20 +124,19 @@ test_run() {
         }
         readarray -t args < <(getargs bridge=)
         RESULT=("bridge" "val")
-        (( ${#RESULT[@]} == ${#args[@]} )) || ret=$((ret+1))
-        for ((i=0; i < ${#RESULT[@]}; i++)); do
-            [[ ${args[$i]} == "${RESULT[$i]}" ]] || ret=$((ret+1))
+        ((${#RESULT[@]} == ${#args[@]})) || ret=$((ret + 1))
+        for ((i = 0; i < ${#RESULT[@]}; i++)); do
+            [[ ${args[$i]} == "${RESULT[$i]}" ]] || ret=$((ret + 1))
         done
 
-
         getcmdline() {
             echo "rd.break rd.md.uuid=bf96e457:230c9ad4:1f3e59d6:745cf942 rd.md.uuid=bf96e457:230c9ad4:1f3e59d6:745cf943 rd.shell"
         }
         readarray -t args < <(getargs rd.md.uuid -d rd_MD_UUID=)
         RESULT=("bf96e457:230c9ad4:1f3e59d6:745cf942" "bf96e457:230c9ad4:1f3e59d6:745cf943")
-        (( ${#RESULT[@]} == ${#args[@]} )) || ret=$((ret+1))
-        for ((i=0; i < ${#RESULT[@]}; i++)); do
-            [[ ${args[$i]} == "${RESULT[$i]}" ]] || ret=$((ret+1))
+        ((${#RESULT[@]} == ${#args[@]})) || ret=$((ret + 1))
+        for ((i = 0; i < ${#RESULT[@]}; i++)); do
+            [[ ${args[$i]} == "${RESULT[$i]}" ]] || ret=$((ret + 1))
         done
 
         return $ret
index ec03de07735535df71efe38f8ed261b9b385c3f2..6108b388fd40f0ed76b17a186d63130c854e3b49 100755 (executable)
@@ -8,7 +8,7 @@ TEST_DESCRIPTION="rpm integrity after dracut and kernel install"
 test_check() {
     # disable for now
     return 1
-    command -v rpm &>/dev/null && ( command -v yum || command -v dnf ) &>/dev/null
+    command -v rpm &> /dev/null && (command -v yum || command -v dnf) &> /dev/null
 }
 
 test_run() {
@@ -32,39 +32,42 @@ test_run() {
 
     mkdir -p "$rootdir/$TESTDIR"
     cp --reflink=auto -a \
-       "$TESTDIR"/dracut-[0-9]*.$(uname -m).rpm \
-       "$TESTDIR"/dracut-network-[0-9]*.$(uname -m).rpm \
-       "$rootdir/$TESTDIR/"
+        "$TESTDIR"/dracut-[0-9]*.$(uname -m).rpm \
+        "$TESTDIR"/dracut-network-[0-9]*.$(uname -m).rpm \
+        "$rootdir/$TESTDIR/"
     . /etc/os-release
     dnf_or_yum=yum
     dnf_or_yum_cmd=yum
-    command -v dnf >/dev/null && { dnf_or_yum="dnf"; dnf_or_yum_cmd="dnf --allowerasing"; }
-    for (( i=0; i < 5 ; i++)); do
+    command -v dnf > /dev/null && {
+        dnf_or_yum="dnf"
+        dnf_or_yum_cmd="dnf --allowerasing"
+    }
+    for ((i = 0; i < 5; i++)); do
         $dnf_or_yum_cmd -v --nogpgcheck --installroot "$rootdir"/ --releasever "$VERSION_ID" --disablerepo='*' \
-                        --enablerepo=fedora --enablerepo=updates --setopt=install_weak_deps=False \
-                        install -y \
-                        $dnf_or_yum \
-                        passwd \
-                        rootfiles \
-                        systemd \
-                        systemd-udev \
-                        kernel \
-                        kernel-core \
-                        redhat-release \
-                        device-mapper-multipath \
-                        lvm2 \
-                        mdadm \
-                        bash \
-                        iscsi-initiator-utils \
-                        "$TESTDIR"/dracut-[0-9]*.$(uname -m).rpm \
-                        ${NULL} && break
+            --enablerepo=fedora --enablerepo=updates --setopt=install_weak_deps=False \
+            install -y \
+            $dnf_or_yum \
+            passwd \
+            rootfiles \
+            systemd \
+            systemd-udev \
+            kernel \
+            kernel-core \
+            redhat-release \
+            device-mapper-multipath \
+            lvm2 \
+            mdadm \
+            bash \
+            iscsi-initiator-utils \
+            "$TESTDIR"/dracut-[0-9]*.$(uname -m).rpm \
+            ${NULL} && break
         #"$TESTDIR"/dracut-config-rescue-[0-9]*.$(uname -m).rpm \
-            #"$TESTDIR"/dracut-network-[0-9]*.$(uname -m).rpm \
-            #    ${NULL}
+        #"$TESTDIR"/dracut-network-[0-9]*.$(uname -m).rpm \
+        #    ${NULL}
     done
-    (( i < 5 ))
+    ((i < 5))
 
-    cat >"$rootdir"/test.sh <<EOF
+    cat > "$rootdir"/test.sh << EOF
 #!/bin/bash
 set -x
 export LC_MESSAGES=C
index 4cde33aab031e0381e0860793afdefb6f2235c89..387fb901df98725926f62a00aa7e84917c6f8bc2 100755 (executable)
@@ -12,9 +12,9 @@ $(lsmod | grep -q '^kqemu ') && BIN=/usr/bin/qemu && ARGS="-kernel-kqemu -cpu ho
 [[ -c /dev/kvm && -x /usr/bin/qemu-system-$(uname -i) ]] && BIN=/usr/bin/qemu-system-$(uname -i) && ARGS="-enable-kvm -cpu host"
 
 [[ $BIN ]] || {
-   echo "Could not find a working KVM or QEMU to test with!" >&2
-   echo "Please install kvm or qemu." >&2
-   exit 1
+    echo "Could not find a working KVM or QEMU to test with!" >&2
+    echo "Please install kvm or qemu." >&2
+    exit 1
 }
 
 # Provide rng device sourcing the hosts /dev/urandom and other standard parameters
@@ -31,7 +31,7 @@ VMLINUZ="/lib/modules/${KVERSION}/vmlinuz"
 if ! [ -f "$VMLINUZ" ]; then
     [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
 
-    if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
+    if [[ $MACHINE_ID ]] && ([[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]]); then
         VMLINUZ="/boot/${MACHINE_ID}/$KVERSION/linux"
     else
         VMLINUZ="/boot/vmlinuz-${KVERSION}"
index ae096c2146bc36ff23bc268b3b365e07a0697791..3e3fdf8a73b290f3c7cafe47ec09ce792a887c27 100644 (file)
@@ -9,9 +9,9 @@ fi
 echo "TESTDIR=\"$TESTDIR\"" > .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
 export TESTDIR
 
-command -v test_check &>/dev/null || test_check() {
-        :
-    }
+command -v test_check &> /dev/null || test_check() {
+    :
+}
 
 # terminal sequence to set color to a 'success' color (currently: green)
 function SETCOLOR_SUCCESS() { echo -en '\033[0;32m'; }
@@ -28,8 +28,10 @@ COLOR_WARNING='\033[0;33m'
 COLOR_NORMAL='\033[0;39m'
 
 check_root() {
-    if (( $EUID != 0 )); then
-        SETCOLOR_FAILURE; echo "Tests must be run as root! Please use 'sudo'."; SETCOLOR_NORMAL
+    if (($EUID != 0)); then
+        SETCOLOR_FAILURE
+        echo "Tests must be run as root! Please use 'sudo'."
+        SETCOLOR_NORMAL
         exit 1
     fi
 }
@@ -40,25 +42,28 @@ while (($# > 0)); do
             check_root
             echo "TEST RUN: $TEST_DESCRIPTION"
             test_check && test_run
-            exit $?;;
+            exit $?
+            ;;
         --setup)
             check_root
             echo "TEST SETUP: $TEST_DESCRIPTION"
             test_check && test_setup
-            exit $?;;
+            exit $?
+            ;;
         --clean)
             echo "TEST CLEANUP: $TEST_DESCRIPTION"
             test_cleanup
             rm -fr -- "$TESTDIR"
             rm -f -- .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
-            exit $?;;
+            exit $?
+            ;;
         --all)
             check_root
-            if ! test_check 2&>test${TEST_RUN_ID:+-$TEST_RUN_ID}.log ; then
+            if ! test_check 2 &> test${TEST_RUN_ID:+-$TEST_RUN_ID}.log; then
                 echo -e "TEST: $TEST_DESCRIPTION " $COLOR_WARNING "[SKIPPED]" $COLOR_NORMAL
-                exit 0;
+                exit 0
             else
-                echo -e "TEST: $TEST_DESCRIPTION " $COLOR_SUCCESS "[STARTED]" $COLOR_NORMAL;
+                echo -e "TEST: $TEST_DESCRIPTION " $COLOR_SUCCESS "[STARTED]" $COLOR_NORMAL
             fi
             if [[ "$V" == "1" ]]; then
                 set -o pipefail
@@ -66,26 +71,26 @@ while (($# > 0)); do
                     test_setup && test_run
                     ret=$?
                     test_cleanup
-                    if ((ret!=0)) && [[ -f "$TESTDIR"/server.log ]]; then
+                    if ((ret != 0)) && [[ -f "$TESTDIR"/server.log ]]; then
                         mv "$TESTDIR"/server.log ./server${TEST_RUN_ID:+-$TEST_RUN_ID}.log
                     fi
                     rm -fr -- "$TESTDIR"
                     rm -f -- .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
                     exit $ret
-                ) </dev/null 2>&1 | tee test${TEST_RUN_ID:+-$TEST_RUN_ID}.log
+                ) < /dev/null 2>&1 | tee test${TEST_RUN_ID:+-$TEST_RUN_ID}.log
             elif [[ "$V" == "2" ]]; then
                 set -o pipefail
                 (
                     test_setup && test_run
                     ret=$?
                     test_cleanup
-                    if ((ret!=0)) && [[ -f "$TESTDIR"/server.log ]]; then
+                    if ((ret != 0)) && [[ -f "$TESTDIR"/server.log ]]; then
                         mv "$TESTDIR"/server.log ./server${TEST_RUN_ID:+-$TEST_RUN_ID}.log
                     fi
                     rm -fr -- "$TESTDIR"
                     rm -f -- .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
                     exit $ret
-                ) </dev/null 2>&1 | $basedir/logtee test${TEST_RUN_ID:+-$TEST_RUN_ID}.log
+                ) < /dev/null 2>&1 | $basedir/logtee test${TEST_RUN_ID:+-$TEST_RUN_ID}.log
             else
                 (
                     test_setup && test_run
@@ -94,7 +99,7 @@ while (($# > 0)); do
                     rm -fr -- "$TESTDIR"
                     rm -f -- .testdir${TEST_RUN_ID:+-$TEST_RUN_ID}
                     exit $ret
-                ) </dev/null >test${TEST_RUN_ID:+-$TEST_RUN_ID}.log 2>&1
+                ) < /dev/null > test${TEST_RUN_ID:+-$TEST_RUN_ID}.log 2>&1
             fi
             ret=$?
             set +o pipefail
@@ -110,7 +115,8 @@ while (($# > 0)); do
                     echo "see $(pwd)/test${TEST_RUN_ID:+-$TEST_RUN_ID}.log"
                 fi
             fi
-            exit $ret;;
+            exit $ret
+            ;;
         *) break ;;
     esac
     shift