dracut: use /bin/sh instead of bash as the intepreter
Despite that dracut has a hard dependency on bash,
its modules doesn't, dracut only has a hard dependency on bash for
module-setup (on a fully usable machine). Inside initramfs, dracut
allows users choose from a list of handful other shells, e.g. bash,
busybox, dash, mkfsh.
In fact, my local machine's initramfs is being built with dash,
and it's functional for a very long time.
Before 64025fa3a (Silence 'make checkbashisms', 2020-08-20), we also
allows our users to have that right, too.
Let's fix the problem 'make checkbashisms' reported and allows our users
to have that right, again.
For 'plymouth' case, let's simply run the command inside the if instead
of checking for the existence of command before running it, because the
status is also failture if plymouth is unavailable.
While we're at it, let's remove an unnecessary fork for grep in
zfs-generator.sh.in and its following complicated 'if elif fi' with
a simple 'case ... esac'.
To support this change, also exclude 90zfs from "make checkbashisms"
because the current CI infrastructure ships an old version of
"checkbashisms", which complains about "command -v", while the current
latest "checkbashisms" thinks it's fine. In the near future, we can
revert that change to "Makefile.am" when CI infrastructure is updated.
Reviewed-by: Gabriel A. Devenyi <gdevenyi@gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Closes #11244
2020-11-28 19:02:08 +00:00
|
|
|
#!/bin/sh
|
2014-10-06 11:08:33 +00:00
|
|
|
|
|
|
|
_do_zpool_export() {
|
2018-02-22 01:54:54 +00:00
|
|
|
ret=0
|
|
|
|
errs=""
|
|
|
|
final="${1}"
|
2014-10-06 11:08:33 +00:00
|
|
|
|
2016-10-16 03:30:53 +00:00
|
|
|
info "ZFS: Exporting ZFS storage pools..."
|
2022-02-12 13:08:02 +00:00
|
|
|
errs=$(zpool export -aF 2>&1)
|
2016-10-16 03:30:53 +00:00
|
|
|
ret=$?
|
|
|
|
[ -z "${errs}" ] || echo "${errs}" | vwarn
|
|
|
|
if [ "x${ret}" != "x0" ]; then
|
|
|
|
info "ZFS: There was a problem exporting pools."
|
2014-10-06 11:08:33 +00:00
|
|
|
fi
|
|
|
|
|
2015-02-15 19:28:42 +00:00
|
|
|
if [ "x${final}" != "x" ]; then
|
2016-10-16 03:30:53 +00:00
|
|
|
info "ZFS: pool list"
|
2014-10-06 11:08:33 +00:00
|
|
|
zpool list 2>&1 | vinfo
|
|
|
|
fi
|
|
|
|
|
2015-02-15 19:28:42 +00:00
|
|
|
return ${ret}
|
2014-10-06 11:08:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if command -v zpool >/dev/null; then
|
2015-02-15 19:28:42 +00:00
|
|
|
_do_zpool_export "${1}"
|
2014-10-06 11:08:33 +00:00
|
|
|
else
|
|
|
|
:
|
|
|
|
fi
|