4 # We depend on udev-rules being loaded
5 [ "${1}" = "-d" ] && return 0
7 # Verify the zfs tool chain
8 for tool
in "@sbindir@/zpool" "@sbindir@/zfs" "@sbindir@/mount.zfs" ; do
9 test -x "$tool" ||
return 1
12 which grep >/dev
/null
2>&1 ||
return 1
35 inst_rules @udevruledir@
/90-zfs.rules
36 inst_rules @udevruledir@
/69-vdev.rules
37 inst_rules @udevruledir@
/60-zvol.rules
40 dracut_install @sbindir@
/zfs
41 dracut_install @sbindir@
/zpool
42 # Workaround for zfsonlinux/zfs#4749 by ensuring libgcc_s.so(.1) is included
43 if [[ -n "$(ldd @sbindir@/zpool | grep -F 'libgcc_s.so')" ]]; then
44 # Dracut will have already tracked and included it
46 elif command -v gcc-config
2>&1 1>/dev
/null
; then
47 # On systems with gcc-config (Gentoo, Funtoo, etc.):
48 # Use the current profile to resolve the appropriate path
49 dracut_install
"/usr/lib/gcc/$(s=$(gcc-config -c); echo ${s%-*}/${s##*-})/libgcc_s.so.1"
50 elif [[ -n "$(ls /usr/lib/libgcc_s.so* 2>/dev/null)" ]]; then
51 # Try a simple path first
52 dracut_install
/usr
/lib
/libgcc_s.so
*
54 # Fallback: Guess the path and include all matches
55 dracut_install
/usr
/lib
/gcc
/*/*/libgcc_s.so
*
57 dracut_install @sbindir@
/mount.zfs
58 dracut_install @udevdir@
/vdev_id
61 dracut_install @udevdir@
/zvol_id
62 inst_hook cmdline
95 "${moddir}/parse-zfs.sh"
63 if [ -n "$systemdutildir" ] ; then
64 inst_script
"${moddir}/zfs-generator.sh" "$systemdutildir"/system-generators
/dracut-zfs-generator
66 inst_hook mount
98 "${moddir}/mount-zfs.sh"
67 inst_hook cleanup
99 "${moddir}/zfs-needshutdown.sh"
68 inst_hook shutdown
20 "${moddir}/export-zfs.sh"
70 inst_simple
"${moddir}/zfs-lib.sh" "/lib/dracut-zfs-lib.sh"
71 if [ -e @sysconfdir@
/zfs
/zpool.cache
]; then
72 inst @sysconfdir@
/zfs
/zpool.cache
73 type mark_hostonly
>/dev
/null
2>&1 && mark_hostonly @sysconfdir@
/zfs
/zpool.cache
76 if [ -e @sysconfdir@
/zfs
/vdev_id.conf
]; then
77 inst @sysconfdir@
/zfs
/vdev_id.conf
78 type mark_hostonly
>/dev
/null
2>&1 && mark_hostonly @sysconfdir@
/zfs
/vdev_id.conf
81 # Synchronize initramfs and system hostid
82 AA
=`hostid | cut -b 1,2`
83 BB
=`hostid | cut -b 3,4`
84 CC
=`hostid | cut -b 5,6`
85 DD
=`hostid | cut -b 7,8`
86 printf "\x${DD}\x${CC}\x${BB}\x${AA}" > "${initdir}/etc/hostid"
88 if dracut_module_included
"systemd"; then
89 mkdir
-p "${initdir}/$systemdsystemunitdir/initrd.target.wants"
90 for _item
in scan cache
; do
91 dracut_install @systemdunitdir@
/zfs-import-
$_item.service
92 if ! [ -L "${initdir}/$systemdsystemunitdir/initrd.target.wants"/zfs-import-
$_item.service
]; then
93 ln -s ..
/zfs-import-
$_item.service
"${initdir}/$systemdsystemunitdir/initrd.target.wants"/zfs-import-
$_item.service
94 type mark_hostonly
>/dev
/null
2>&1 && mark_hostonly @systemdunitdir@
/zfs-import-
$_item.service