2020-11-29 02:02:08 +07:00
|
|
|
#!/bin/sh
|
2021-05-14 14:02:11 +02:00
|
|
|
# shellcheck disable=SC2034,SC2154
|
2011-07-04 13:25:31 -04:00
|
|
|
|
2022-04-04 22:45:58 +02:00
|
|
|
# shellcheck source=zfs-lib.sh.in
|
|
|
|
|
. /lib/dracut-zfs-lib.sh
|
2011-07-04 13:25:31 -04:00
|
|
|
|
|
|
|
|
# Let the command line override our host id.
|
2018-02-21 20:54:54 -05:00
|
|
|
spl_hostid=$(getarg spl_hostid=)
|
2015-02-15 20:28:42 +01:00
|
|
|
if [ -n "${spl_hostid}" ] ; then
|
2011-07-24 16:46:16 -04:00
|
|
|
info "ZFS: Using hostid from command line: ${spl_hostid}"
|
2020-09-16 12:25:12 -07:00
|
|
|
zgenhostid -f "${spl_hostid}"
|
2015-02-15 20:28:42 +01:00
|
|
|
elif [ -f "/etc/hostid" ] ; then
|
2018-02-21 20:54:54 -05:00
|
|
|
info "ZFS: Using hostid from /etc/hostid: $(hostid)"
|
2011-07-04 13:25:31 -04:00
|
|
|
else
|
2015-02-15 20:28:42 +01:00
|
|
|
warn "ZFS: No hostid found on kernel command line or /etc/hostid."
|
2011-07-31 00:21:40 -04:00
|
|
|
warn "ZFS: Pools may not import correctly."
|
2011-07-04 13:25:31 -04:00
|
|
|
fi
|
|
|
|
|
|
2022-04-04 22:45:58 +02:00
|
|
|
if decode_root_args; then
|
|
|
|
|
if [ "$root" = "zfs:AUTO" ]; then
|
|
|
|
|
info "ZFS: Boot dataset autodetected from bootfs=."
|
|
|
|
|
else
|
|
|
|
|
info "ZFS: Boot dataset is ${root}."
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
rootok=1
|
|
|
|
|
# Make sure Dracut is happy that we have a root and will wait for ZFS
|
|
|
|
|
# modules to settle before mounting.
|
|
|
|
|
if [ -n "${wait_for_zfs}" ]; then
|
|
|
|
|
ln -s null /dev/root
|
|
|
|
|
echo '[ -e /dev/zfs ]' > "${hookdir}/initqueue/finished/zfs.sh"
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
info "ZFS: no ZFS-on-root."
|
2011-08-26 13:55:26 -04:00
|
|
|
fi
|