]>
git.proxmox.com Git - zfsonlinux.git/blob - zfs-debian-pve/tree/zfs-initramfs/usr/share/initramfs-tools/hooks/zfs
3 # Add ZoL filesystem capabilities to an initrd, usually for a native OpenZFS root.
6 # This hook installs udev rules for ZoL.
9 # These prerequisites are provided by the zfsutils package. The zdb utility is
10 # not strictly required, but it can be useful at the initramfs recovery prompt.
11 COPY_EXEC_LIST
="/sbin/zdb /sbin/zpool /sbin/zfs /sbin/mount.zfs"
13 # These prerequisites are provided by the base system.
14 COPY_EXEC_LIST
="$COPY_EXEC_LIST /bin/hostname /sbin/blkid"
16 # Explicitly specify all kernel modules because automatic dependency resolution
17 # is unreliable on many systems.
18 MANUAL_ADD_MODULES_LIST
="zlib_deflate spl zavl zcommon znvpair zunicode zfs"
20 # Generic result code.
30 for ii
in $COPY_EXEC_LIST
34 echo "Error: $ii is not executable."
44 .
/usr
/share
/initramfs-tools
/hook-functions
46 mkdir
-p "$DESTDIR/etc/"
48 # zpool requires /etc/mtab
49 ln -sf "/proc/mounts" "$DESTDIR/etc/mtab"
51 # ZDB uses pthreads for some functions, but the library dependency is not
52 # automatically detected. The `find` utility and extended `cp` options are
53 # used here because libgcc_s.so could be in a subdirectory of /lib for
54 # multi-arch installations.
55 cp --target-directory="$DESTDIR" --parents $
(find /lib
-type f
-name libgcc_s.so
.1)
57 for ii
in $COPY_EXEC_LIST
62 for ii
in $MANUAL_ADD_MODULES_LIST
64 manual_add_modules
"$ii"
67 if [ -f "/etc/hostname" ]
69 cp -p "/etc/hostname" "$DESTDIR/etc/"
71 hostname
>"$DESTDIR/etc/hostname"
74 # ZoL 0.6.3 deprecated the hostid check.
77 cp -p /etc
/hostid
"$DESTDIR/etc/hostid"