diff --git a/Makefile.am b/Makefile.am index eac1a3e97e..436b78d762 100644 --- a/Makefile.am +++ b/Makefile.am @@ -159,6 +159,7 @@ checkbashisms: -o -name 'smart' -prune \ -o -name 'paxcheck.sh' -prune \ -o -name 'make_gitrev.sh' -prune \ + -o -name '90zfs' -prune \ -o -type f ! -name 'config*' \ ! -name 'libtool' \ -exec sh -c 'awk "NR==1 && /\#\!.*bin\/sh.*/ {print FILENAME;}" "{}"' \;); \ diff --git a/contrib/dracut/90zfs/export-zfs.sh.in b/contrib/dracut/90zfs/export-zfs.sh.in index 09e4a3cc0e..8926503834 100755 --- a/contrib/dracut/90zfs/export-zfs.sh.in +++ b/contrib/dracut/90zfs/export-zfs.sh.in @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh . /lib/dracut-zfs-lib.sh diff --git a/contrib/dracut/90zfs/mount-zfs.sh.in b/contrib/dracut/90zfs/mount-zfs.sh.in index ca407fdd4e..4a892e9382 100755 --- a/contrib/dracut/90zfs/mount-zfs.sh.in +++ b/contrib/dracut/90zfs/mount-zfs.sh.in @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh . /lib/dracut-zfs-lib.sh diff --git a/contrib/dracut/90zfs/parse-zfs.sh.in b/contrib/dracut/90zfs/parse-zfs.sh.in index 2ff76d8fa0..768de9dd25 100755 --- a/contrib/dracut/90zfs/parse-zfs.sh.in +++ b/contrib/dracut/90zfs/parse-zfs.sh.in @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh . /lib/dracut-lib.sh diff --git a/contrib/dracut/90zfs/zfs-generator.sh.in b/contrib/dracut/90zfs/zfs-generator.sh.in index 120b9ecf95..59cdadcbea 100755 --- a/contrib/dracut/90zfs/zfs-generator.sh.in +++ b/contrib/dracut/90zfs/zfs-generator.sh.in @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh echo "zfs-generator: starting" >> /dev/kmsg @@ -11,7 +11,7 @@ GENERATOR_DIR="$1" [ -f /lib/dracut-lib.sh ] && dracutlib=/lib/dracut-lib.sh [ -f /usr/lib/dracut/modules.d/99base/dracut-lib.sh ] && dracutlib=/usr/lib/dracut/modules.d/99base/dracut-lib.sh -type getarg >/dev/null 2>&1 || { +command -v getarg >/dev/null 2>&1 || { echo "zfs-generator: loading Dracut library from $dracutlib" >> /dev/kmsg . "$dracutlib" } @@ -22,16 +22,17 @@ type getarg >/dev/null 2>&1 || { # If root is not ZFS= or zfs: or rootfstype is not zfs # then we are not supposed to handle it. -[ "${root##zfs:}" = "${root}" -a "${root##ZFS=}" = "${root}" -a "$rootfstype" != "zfs" ] && exit 0 +[ "${root##zfs:}" = "${root}" ] && + [ "${root##ZFS=}" = "${root}" ] && + [ "$rootfstype" != "zfs" ] && + exit 0 rootfstype=zfs -if echo "${rootflags}" | grep -Eq '^zfsutil$|^zfsutil,|,zfsutil$|,zfsutil,' ; then - true -elif test -n "${rootflags}" ; then - rootflags="zfsutil,${rootflags}" -else - rootflags=zfsutil -fi +case ",${rootflags}," in + *,zfsutil,*) ;; + ,,) rootflags=zfsutil ;; + *) rootflags="zfsutil,${rootflags}" ;; +esac echo "zfs-generator: writing extension for sysroot.mount to $GENERATOR_DIR"/sysroot.mount.d/zfs-enhancement.conf >> /dev/kmsg @@ -58,4 +59,4 @@ echo "zfs-generator: writing extension for sysroot.mount to $GENERATOR_DIR"/sysr [ -d "$GENERATOR_DIR"/initrd-root-fs.target.requires ] || mkdir -p "$GENERATOR_DIR"/initrd-root-fs.target.requires ln -s ../sysroot.mount "$GENERATOR_DIR"/initrd-root-fs.target.requires/sysroot.mount -echo "zfs-generator: finished" >> /dev/kmsg \ No newline at end of file +echo "zfs-generator: finished" >> /dev/kmsg diff --git a/contrib/dracut/90zfs/zfs-lib.sh.in b/contrib/dracut/90zfs/zfs-lib.sh.in index f470bfcc54..c39cc5cfff 100755 --- a/contrib/dracut/90zfs/zfs-lib.sh.in +++ b/contrib/dracut/90zfs/zfs-lib.sh.in @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh command -v getarg >/dev/null || . /lib/dracut-lib.sh command -v getargbool >/dev/null || { @@ -144,7 +144,7 @@ ask_for_password() { { 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 plymouth --ping 2>/dev/null; then plymouth ask-for-password \ --prompt "$ply_prompt" --number-of-tries="$ply_tries" \ --command="$ply_cmd" diff --git a/contrib/dracut/90zfs/zfs-load-key.sh.in b/contrib/dracut/90zfs/zfs-load-key.sh.in index 49d56e546c..e295014189 100755 --- a/contrib/dracut/90zfs/zfs-load-key.sh.in +++ b/contrib/dracut/90zfs/zfs-load-key.sh.in @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # only run this on systemd systems, we handle the decrypt in mount-zfs.sh in the mount hook otherwise [ -e /bin/systemctl ] || return 0 diff --git a/contrib/dracut/90zfs/zfs-needshutdown.sh.in b/contrib/dracut/90zfs/zfs-needshutdown.sh.in index ddd3edae00..dd6de30c27 100755 --- a/contrib/dracut/90zfs/zfs-needshutdown.sh.in +++ b/contrib/dracut/90zfs/zfs-needshutdown.sh.in @@ -1,6 +1,6 @@ -#!/bin/bash +#!/bin/sh -type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh +command -v getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh if zpool list 2>&1 | grep -q 'no pools available' ; then info "ZFS: No active pools, no need to export anything."