2020-12-02 01:05:10 +01:00

23 lines
854 B
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: MIT
PREREQ="zfs"
[ "$1" = "prereqs" ] && exec echo "$PREREQ"
. /usr/share/initramfs-tools/hook-functions
# Bit of a hack: replace zfs-intramfs' decrypt_fs() in /scripts/zfs with our version that understands tzpfms datasets,
# which should be compatible with other hooks doing the same thing
[ "${verbose:-n}" = "y" ] && echo "Patching /scripts/zfs"
sed -Ei 's/^decrypt_fs\(\)/__tzpfms__&/' "$DESTDIR/scripts/zfs"
cat /usr/share/tzpfms/initramfs-tools-zfs-patch.sh >> "$DESTDIR/scripts/zfs"
for x in zfs-tpm-list zfs-tpm2-load-key zfs-tpm1x-load-key tcsd $(find /usr/lib -name 'libtss2-tcti*.so*'); do # TODO: there's got to be a better way™!
xloc="$(command -v "$x")"
[ "$xloc" = "" ] || copy_exec "$xloc"
done
add_loaded_modules '*tpm*' # TODO: is this the best way of going about this?