mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-18 10:21:01 +03:00
d402c18dd6
- In older systems without sysroot.mount, import before dracut-mount, and re-enable old dracut mount hook - rootflags MUST be present even if the administrator neglected to specify it explicitly - Check that mount.zfs exists in sbindir - Remove awk and head as (now unused) requirements, add grep, and install the right mount.zfs - Eliminate one use of grep in Dracut - Use a more accurate grepping statement to identify zfsutil in rootflags - Ensure that pooldev is nonempty - Properly handle /dev/sd* devices and more - Use new -P to get list of zpool devices - Bail out of the generator when zfs:AUTO is on the root command line - Ignore errors from systemctl trying to load sysroot.mount, we only care about the output - Determine which one is the correct initqueuedir at run time. - Add a compatibility getargbool for our detection / setup script. - Update dracut .gitignore files Signed-off-by: <Matthew Thode mthode@mthode.org> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #4558 Closes #4562
48 lines
1.4 KiB
Bash
Executable File
48 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
GENERATOR_DIR="$1"
|
|
[ -z "$GENERATOR_DIR" ] && 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
|
|
|
|
type getarg >/dev/null 2>&1 || . "$dracutlib"
|
|
|
|
[ -z "$root" ] && root=$(getarg root=)
|
|
[ -z "$rootfstype" ] && rootfstype=$(getarg rootfstype=)
|
|
[ -z "$rootflags" ] && rootflags=$(getarg rootflags=)
|
|
|
|
[ "${root##zfs:}" = "${root}" -a "${root##ZFS=}" = "${root}" -a "$rootfstype" != "zfs" ] && exit 0
|
|
# If root is set to zfs:AUTO, then we know sysroot.mount will not be generated
|
|
# so we have no need to enhance it.
|
|
# See https://github.com/zfsonlinux/zfs/pull/4558#discussion_r61118952 for details.
|
|
if [ "${root}" = "zfs:AUTO" ] ; then
|
|
exit 0
|
|
fi
|
|
|
|
rootfstype=zfs
|
|
if echo "${rootflags}" | grep -Eq '^zfsutil$|^zfsutil,|,zfsutil$|,zfsutil,' ; then
|
|
true
|
|
elif test -n "${rootflags}" ; then
|
|
rootflags="zfsutil,${rootflags}"
|
|
else
|
|
rootflags=zfsutil
|
|
fi
|
|
|
|
root="${root##zfs:}"
|
|
root="${root##ZFS=}"
|
|
|
|
[ -d "$GENERATOR_DIR" ] || mkdir "$GENERATOR_DIR"
|
|
[ -d "$GENERATOR_DIR/sysroot.mount.d" ] || mkdir "$GENERATOR_DIR/sysroot.mount.d"
|
|
|
|
{
|
|
echo "[Unit]"
|
|
echo "After=zfs-import-scan.service"
|
|
echo "After=zfs-import-cache.service"
|
|
echo ""
|
|
echo "[Mount]"
|
|
echo "What=${root}"
|
|
echo "Type=${rootfstype}"
|
|
echo "Options=${rootflags}"
|
|
} > "$GENERATOR_DIR/sysroot.mount.d/zfs-enhancement.conf"
|