contrib/dracut: zfs-lib: export_all: replace with inline zpool export -a

07a3312f17, which introduced this in
October of 2014, didn't have zpool export -a available; we do

Upstream-commit: 6a41310c70
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13093
This commit is contained in:
наб 2022-02-12 14:08:02 +01:00 committed by Brian Behlendorf
parent bc03fee94d
commit 0657247548
3 changed files with 2 additions and 20 deletions

View File

@ -1,14 +1,12 @@
#!/bin/sh #!/bin/sh
. /lib/dracut-zfs-lib.sh
_do_zpool_export() { _do_zpool_export() {
ret=0 ret=0
errs="" errs=""
final="${1}" final="${1}"
info "ZFS: Exporting ZFS storage pools..." info "ZFS: Exporting ZFS storage pools..."
errs=$(export_all -F 2>&1) errs=$(zpool export -aF 2>&1)
ret=$? ret=$?
[ -z "${errs}" ] || echo "${errs}" | vwarn [ -z "${errs}" ] || echo "${errs}" | vwarn
if [ "x${ret}" != "x0" ]; then if [ "x${ret}" != "x0" ]; then

View File

@ -44,7 +44,7 @@ if [ "${root}" = "zfs:AUTO" ] ; then
zpool import -N -a ${ZPOOL_IMPORT_OPTS} zpool import -N -a ${ZPOOL_IMPORT_OPTS}
if ! ZFS_DATASET="$(find_bootfs)" ; then if ! ZFS_DATASET="$(find_bootfs)" ; then
warn "ZFS: No bootfs attribute found in importable pools." warn "ZFS: No bootfs attribute found in importable pools."
export_all -F zpool export -aF
rootok=0 rootok=0
return 1 return 1

View File

@ -121,22 +121,6 @@ for_relevant_root_children() {
) )
} }
# export_all OPTS
# exports all imported zfs pools.
export_all() {
ret=0
IFS="${NEWLINE}"
for pool in $(zpool list -H -o name) ; do
if zpool list -H "${pool}" > /dev/null 2>&1; then
zpool export "${pool}" "$@" || ret=$?
fi
done
IFS="${OLDIFS}"
return ${ret}
}
# ask_for_password # ask_for_password
# #
# Wraps around plymouth ask-for-password and adds fallback to tty password ask # Wraps around plymouth ask-for-password and adds fallback to tty password ask