mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
contrib: dracut: zfs-lib: remove find_bootfs
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #13291
This commit is contained in:
parent
5d31169d7c
commit
dac0b0785a
@ -28,10 +28,10 @@ ZFS_DATASET=
|
|||||||
ZFS_POOL=
|
ZFS_POOL=
|
||||||
|
|
||||||
if [ "${root}" = "zfs:AUTO" ] ; then
|
if [ "${root}" = "zfs:AUTO" ] ; then
|
||||||
if ! ZFS_DATASET="$(find_bootfs)" ; then
|
if ! ZFS_DATASET="$(zpool get -Ho value bootfs | grep -m1 -vFx -)"; then
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
zpool import -N -a ${ZPOOL_IMPORT_OPTS}
|
zpool import -N -a ${ZPOOL_IMPORT_OPTS}
|
||||||
if ! ZFS_DATASET="$(find_bootfs)" ; then
|
if ! ZFS_DATASET="$(zpool get -Ho value bootfs | grep -m1 -vFx -)"; then
|
||||||
warn "ZFS: No bootfs attribute found in importable pools."
|
warn "ZFS: No bootfs attribute found in importable pools."
|
||||||
zpool export -aF
|
zpool export -aF
|
||||||
|
|
||||||
|
@ -27,31 +27,6 @@ if getargbool 0 zfs_force -y zfs.force -y zfsforce ; then
|
|||||||
ZPOOL_IMPORT_OPTS="${ZPOOL_IMPORT_OPTS} -f"
|
ZPOOL_IMPORT_OPTS="${ZPOOL_IMPORT_OPTS} -f"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# find_bootfs
|
|
||||||
# returns the first dataset with the bootfs attribute.
|
|
||||||
find_bootfs() {
|
|
||||||
IFS="${NEWLINE}"
|
|
||||||
for dataset in $(zpool list -H -o bootfs); do
|
|
||||||
case "${dataset}" in
|
|
||||||
"" | "-")
|
|
||||||
continue
|
|
||||||
;;
|
|
||||||
"no pools available")
|
|
||||||
IFS="${OLDIFS}"
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
IFS="${OLDIFS}"
|
|
||||||
echo "${dataset}"
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
IFS="${OLDIFS}"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# import_pool POOL
|
# import_pool POOL
|
||||||
# imports the given zfs pool if it isn't imported already.
|
# imports the given zfs pool if it isn't imported already.
|
||||||
import_pool() {
|
import_pool() {
|
||||||
|
Loading…
Reference in New Issue
Block a user