diff options
author | Brian Behlendorf <[email protected]> | 2015-07-09 11:41:14 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2015-07-09 13:59:37 -0700 |
commit | cc49250563b65c80d87afa5273ae350d06aa8d3b (patch) | |
tree | 9fe3928c6279f518c82d0f5fd8a813e8a3ed7d75 /contrib/dracut/90zfs/mount-zfs.sh.in | |
parent | 2cac7f5f11756663525a5d4604d9f0a3202d4024 (diff) |
Move dracut directory to contrib
The dracut code is analogous to the initramfs code and as such
it should be located in the contrib with initramfs for consistency.
Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'contrib/dracut/90zfs/mount-zfs.sh.in')
-rwxr-xr-x | contrib/dracut/90zfs/mount-zfs.sh.in | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/contrib/dracut/90zfs/mount-zfs.sh.in b/contrib/dracut/90zfs/mount-zfs.sh.in new file mode 100755 index 000000000..2abc8766b --- /dev/null +++ b/contrib/dracut/90zfs/mount-zfs.sh.in @@ -0,0 +1,44 @@ +#!/bin/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 || export_all "-f" + + 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 |