mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-30 18:56:23 +03:00
contrib; dracut: centralise root= parsing, actually support root=s
So far, everything parsed root= manually, which meant that while
zfs-parse.sh was updated, and supposedly supported + -> ' ' conversion,
it meant nothing
Instead, centralise parsing, and allow:
root=
root=zfs
root=zfs:
root=zfs:AUTO
root=ZFS=data/set
root=zfs:data/set
root=zfs:ZFS=data/set (as a side-effect; allowed but undocumented)
rootfstype=zfs AND root=data/set <=> root=data/set
rootfstype=zfs AND root= <=> root=zfs:AUTO
So rootfstype=zfs /also/ behaves as expected, and + decoding works
Upstream-commit: 245529d85f
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13291
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
# shellcheck disable=SC2016,SC1004
|
||||
# shellcheck disable=SC2016,SC1004,SC2154
|
||||
|
||||
grep -wq debug /proc/cmdline && debug=1
|
||||
[ -n "$debug" ] && echo "zfs-generator: starting" >> /dev/kmsg
|
||||
@@ -10,37 +10,17 @@ GENERATOR_DIR="$1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -f /lib/dracut-lib.sh ] && dracutlib=/lib/dracut-lib.sh
|
||||
[ -f /usr/lib/dracut/modules.d/99base/dracut-lib.sh ] && dracutlib=/usr/lib/dracut/modules.d/99base/dracut-lib.sh
|
||||
command -v getarg >/dev/null 2>&1 || {
|
||||
[ -n "$debug" ] && echo "zfs-generator: loading Dracut library from $dracutlib" >> /dev/kmsg
|
||||
. "$dracutlib"
|
||||
}
|
||||
|
||||
# shellcheck source=zfs-lib.sh.in
|
||||
. /lib/dracut-zfs-lib.sh
|
||||
decode_root_args || exit 0
|
||||
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
[ -z "$rootfstype" ] && rootfstype=$(getarg rootfstype=)
|
||||
[ -z "$rootflags" ] && rootflags=$(getarg rootflags=)
|
||||
|
||||
# If root is not ZFS= or zfs: or rootfstype is not zfs
|
||||
# then we are not supposed to handle it.
|
||||
[ "${root##zfs:}" = "${root}" ] &&
|
||||
[ "${root##ZFS=}" = "${root}" ] &&
|
||||
[ "$rootfstype" != "zfs" ] &&
|
||||
exit 0
|
||||
|
||||
[ -z "${rootflags}" ] && rootflags=$(getarg rootflags=)
|
||||
case ",${rootflags}," in
|
||||
*,zfsutil,*) ;;
|
||||
,,) rootflags=zfsutil ;;
|
||||
*) rootflags="zfsutil,${rootflags}" ;;
|
||||
esac
|
||||
|
||||
if [ "${root}" != "zfs:AUTO" ]; then
|
||||
root="${root##zfs:}"
|
||||
root="${root##ZFS=}"
|
||||
fi
|
||||
|
||||
[ -n "$debug" ] && echo "zfs-generator: writing extension for sysroot.mount to $GENERATOR_DIR/sysroot.mount.d/zfs-enhancement.conf" >> /dev/kmsg
|
||||
|
||||
|
||||
@@ -89,7 +69,7 @@ else
|
||||
_zfs_generator_cb() {
|
||||
dset="${1}"
|
||||
mpnt="${2}"
|
||||
unit="sysroot$(echo "$mpnt" | tr '/' '-').mount"
|
||||
unit="$(systemd-escape --suffix=mount -p "/sysroot${mpnt}")"
|
||||
|
||||
{
|
||||
echo "[Unit]"
|
||||
|
||||
Reference in New Issue
Block a user