zdb: show bp in uberblock dump
[zfs.git] / contrib / initramfs / hooks / zfs.in
blob6cd7e6f1ea3b273cd08dde296d98b1aade4c8886
1 #!/bin/sh
3 # Add OpenZFS filesystem capabilities to an initrd, usually for a native ZFS root.
6 if [ "$1" = "prereqs" ]; then
7 echo "udev"
8 exit
9 fi
11 . /usr/share/initramfs-tools/hook-functions
13 for req in "@sbindir@/zpool" "@sbindir@/zfs" "@mounthelperdir@/mount.zfs"; do
14 copy_exec "$req" || {
15 echo "$req not available!" >&2
16 exit 2
18 done
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
29 copy_exec "$libgcc"
30 done
32 # shellcheck disable=SC2050
33 if [ @LIBFETCH_DYNAMIC@ -gt 0 ]; then
34 find /lib/ -name "@LIBFETCH_SONAME@" | while read -r libfetch; do
35 copy_exec "$libfetch"
36 done
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
45 copy_file config "$f"
46 done
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"
54 else
55 hostname="$(mktemp -t hostname.XXXXXXXXXX)"
56 hostname > "$hostname"
57 copy_file config "$hostname" "/etc/hostname"
58 rm -f "$hostname"