diff options
author | Matthew Thode <[email protected]> | 2016-03-30 18:59:15 -0500 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-04-25 08:51:38 -0700 |
commit | a5a370227eb0a3daf8992a38920d54eb3b7b3c25 (patch) | |
tree | cc85181222f7cd64ff79c9eae7013588730977c2 /contrib/dracut/90zfs/zfs-generator.sh.in | |
parent | 232604b58e8579501c5a260ad3a7b71a239dd546 (diff) |
fix booting via dracut generated initramfs
Dracut and Systemd updated how they integrate with each other, because
of this our current integrations stopped working (around the time
4.1.13 came out). This patch addresses that issue and gets us booting
again.
Thanks to @Rudd-O for doing the work to get dracut working again and
letting me submit this on his behalf.
Signed-off-by: Manuel Amador (Rudd-O) <[email protected]>
Signed-off-by: Matthew Thode <[email protected]>
Closes #3605
Closes #4478
Diffstat (limited to 'contrib/dracut/90zfs/zfs-generator.sh.in')
-rw-r--r-- | contrib/dracut/90zfs/zfs-generator.sh.in | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/contrib/dracut/90zfs/zfs-generator.sh.in b/contrib/dracut/90zfs/zfs-generator.sh.in new file mode 100644 index 000000000..0e0664d0a --- /dev/null +++ b/contrib/dracut/90zfs/zfs-generator.sh.in @@ -0,0 +1,39 @@ +#!/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 + +rootfstype=zfs +if echo "${rootflags}" | grep -q zfsutil ; then + true +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" |