]>
git.proxmox.com Git - mirror_zfs.git/blob - contrib/dracut/90zfs/parse-zfs.sh.in
2 # shellcheck disable=SC2034,SC2154
6 # Let the command line override our host id.
7 spl_hostid
=$
(getarg spl_hostid
=)
8 if [ -n "${spl_hostid}" ] ; then
9 info
"ZFS: Using hostid from command line: ${spl_hostid}"
10 zgenhostid
-f "${spl_hostid}"
11 elif [ -f "/etc/hostid" ] ; then
12 info
"ZFS: Using hostid from /etc/hostid: $(hostid)"
14 warn
"ZFS: No hostid found on kernel command line or /etc/hostid."
15 warn
"ZFS: Pools may not import correctly."
21 # We'll take root unset, root=zfs, or root=zfs:
22 # No root set, so we want to read the bootfs attribute. We
23 # can't do that until udev settles so we'll set dummy values
24 # and hope for the best later on.
29 info
"ZFS: Enabling autodetection of bootfs after udev settles."
33 # root is explicit ZFS root. Parse it now. We can handle
34 # a root=... param in any of the following formats:
37 # root=ZFS=pool+with+space/ROOT+WITH+SPACE (translates to root=ZFS=pool with space/ROOT WITH SPACE)
39 # Strip down to just the pool/fs
41 root
="zfs:${root#ZFS=}"
42 # switch + with spaces because kernel cmdline does not allow us to quote parameters
43 root
=$
(echo "$root" |
tr '+' ' ')
47 info
"ZFS: Set ${root} as bootfs."
51 info
"ZFS: no ZFS-on-root"
54 # Make sure Dracut is happy that we have a root and will wait for ZFS
55 # modules to settle before mounting.
56 if [ "${wait_for_zfs}" -eq 1 ]; then
57 ln -s /dev
/null
/dev
/root
2>/dev
/null
58 initqueuedir
="${hookdir}/initqueue/finished"
59 echo '[ -e /dev/zfs ]' > "${initqueuedir}/zfs.sh"