mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-18 10:21:01 +03:00
eda3d4e1de
Provide '/lib/dracut-zfs-lib.sh' with utility functions. Signed-off-by: Sören Tempel <soeren+git@soeren-tempel.net> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Issue #3109
46 lines
814 B
Bash
Executable File
46 lines
814 B
Bash
Executable File
#!/bin/sh
|
|
|
|
. /lib/dracut-lib.sh
|
|
. /lib/dracut-zfs-lib.sh
|
|
|
|
ZFS_DATASET=""
|
|
ZFS_POOL=""
|
|
|
|
case "${root}" in
|
|
zfs:*) ;;
|
|
*) return ;;
|
|
esac
|
|
|
|
# Delay until all required block devices are present.
|
|
udevadm settle
|
|
|
|
if [ "${root}" = "zfs:AUTO" ] ; then
|
|
ZFS_DATASET="$(find_bootfs)"
|
|
if [ $? -ne 0 ] ; then
|
|
zpool import -N -a ${ZPOOL_IMPORT_OPTS}
|
|
ZFS_DATASET="$(find_bootfs)"
|
|
if [ $? -ne 0 ] ; then
|
|
warn "ZFS: No bootfs attribute found in importable pools."
|
|
export_all
|
|
|
|
rootok=0
|
|
return 1
|
|
fi
|
|
fi
|
|
info "ZFS: Using ${ZFS_DATASET} as root."
|
|
fi
|
|
|
|
ZFS_DATASET="${ZFS_DATASET:-${root#zfs:}}"
|
|
ZFS_POOL="${ZFS_DATASET%%/*}"
|
|
|
|
if import_pool "${ZFS_POOL}" ; then
|
|
info "ZFS: Mounting dataset ${ZFS_DATASET}..."
|
|
if mount_dataset "${ZFS_DATASET}" ; then
|
|
ROOTFS_MOUNTED=yes
|
|
return 0
|
|
fi
|
|
fi
|
|
|
|
rootok=0
|
|
need_shutdown
|