#!/bin/sh

set -e

PREREQ="cryptroot"

prereqs()
{
	echo "$PREREQ"
}

case "$1" in
    prereqs)
        prereqs
        exit 0
        ;;
esac

. /usr/share/initramfs-tools/hook-functions

# Hooks for loading keyctl software into the initramfs

# Check whether cryptroot hook has installed decrypt_keyctl script
if [ ! -f "/usr/lib/cryptsetup/scripts/decrypt_keytpm" ]; then
    exit 0
fi
copy_exec `which whiptail`
copy_exec `which tpm2_nvread`
copy_exec `which tpm2_changeauth`
copy_exec `which dmidecode`
copy_exec /usr/lib/x86_64-linux-gnu/libtss2-tcti-device.so.0.0.0
copy_exec /usr/lib/x86_64-linux-gnu/libtss2-tcti-device.so.0

exit 0
