. /usr/share/initramfs-tools/hook-functions
# Hooks for loading smartcard reading software into the initramfs
# Check whether cryptroot hook has installed decrypt_opensc script
if [ ! -x ${DESTDIR}/lib/cryptsetup/scripts/decrypt_opensc ] ; then
# Install cryptroot key files into initramfs
keys=$(sed 's/^\(.*,\|\)key=//; s/,.*//' ${DESTDIR}/conf/conf.d/cryptroot)
if [ "${keys}" != "none" ]; then
if [ -z "${keys}" ]; then
echo $0: Missing key files in ${DESTDIR}/conf/conf.d/cryptroot >&2
cat ${DESTDIR}/conf/conf.d/cryptroot >&2
if [ ! -d ${DESTDIR}/$(dirname ${key}) ] ; then
mkdir -p ${DESTDIR}/$(dirname ${key})
cp ${key} ${DESTDIR}/${key}