3 # Add OpenZFS filesystem capabilities to an initrd, usually for a native ZFS root.
6 if [ "$1" = "prereqs" ]; then
11 .
/usr
/share
/initramfs-tools
/hook-functions
13 for req
in "@sbindir@/zpool" "@sbindir@/zfs" "@mounthelperdir@/mount.zfs"; do
15 echo "$req not available!" >&2
20 copy_exec
"@udevdir@/vdev_id"
21 copy_exec
"@udevdir@/zvol_id"
22 if command -v systemd-ask-password
> /dev
/null
; then
23 copy_exec
"$(command -v systemd-ask-password)"
26 # We use pthreads, but i-t from buster doesn't automatically
27 # copy this indirect dependency: this can be removed when buster finally dies.
28 find /lib
/ -type f
-name "libgcc_s.so.[1-9]" |
while read -r libgcc
; do
32 # shellcheck disable=SC2050
33 if [ @LIBFETCH_DYNAMIC@
-gt 0 ]; then
34 find /lib
/ -name "@LIBFETCH_SONAME@" |
while read -r libfetch
; do
39 copy_file config
"/etc/hostid"
40 copy_file cache
"@sysconfdir@/zfs/zpool.cache"
41 copy_file config
"@initconfdir@/zfs"
42 copy_file config
"@sysconfdir@/zfs/zfs-functions"
43 copy_file config
"@sysconfdir@/zfs/vdev_id.conf"
44 for f
in "@sysconfdir@/zfs/initramfs-tools-load-key" "@sysconfdir@/zfs/initramfs-tools-load-key.d/"*; do
47 copy_file rule
"@udevruledir@/60-zvol.rules"
48 copy_file rule
"@udevruledir@/69-vdev.rules"
50 manual_add_modules zfs
52 if [ -f "/etc/hostname" ]; then
53 copy_file config
"/etc/hostname"
55 hostname
="$(mktemp -t hostname.XXXXXXXXXX)"
56 hostname
> "$hostname"
57 copy_file config
"$hostname" "/etc/hostname"