blob: 0e0664d0ac7eda371c112b657fa593a7314987dc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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"
|