2011-03-17 22:18:13 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2015-02-15 19:28:42 +00:00
|
|
|
. /lib/dracut-zfs-lib.sh
|
2011-03-17 22:18:13 +00:00
|
|
|
|
2015-02-15 19:28:42 +00:00
|
|
|
ZFS_DATASET=""
|
|
|
|
ZFS_POOL=""
|
2011-07-24 20:53:15 +00:00
|
|
|
|
2015-02-15 19:28:42 +00:00
|
|
|
case "${root}" in
|
|
|
|
zfs:*) ;;
|
|
|
|
*) return ;;
|
|
|
|
esac
|
2011-07-04 17:25:31 +00:00
|
|
|
|
2015-03-23 16:17:56 +00:00
|
|
|
# Delay until all required block devices are present.
|
|
|
|
udevadm settle
|
|
|
|
|
2015-02-15 19:28:42 +00:00
|
|
|
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."
|
2015-02-16 08:56:04 +00:00
|
|
|
export_all || export_all "-f"
|
2015-02-15 19:28:42 +00:00
|
|
|
|
|
|
|
rootok=0
|
|
|
|
return 1
|
2011-07-24 20:46:16 +00:00
|
|
|
fi
|
2015-02-15 19:28:42 +00:00
|
|
|
fi
|
|
|
|
info "ZFS: Using ${ZFS_DATASET} as root."
|
|
|
|
fi
|
2011-07-04 17:25:31 +00:00
|
|
|
|
2015-02-15 19:28:42 +00:00
|
|
|
ZFS_DATASET="${ZFS_DATASET:-${root#zfs:}}"
|
|
|
|
ZFS_POOL="${ZFS_DATASET%%/*}"
|
2014-10-06 11:08:33 +00:00
|
|
|
|
2015-02-15 19:28:42 +00:00
|
|
|
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
|