#!/bin/bash # This script appends LUKS keys and config to initrd set -euo pipefail initrd=$1 tmpdir=$2 # Appending LUKS root keys and crypttab config to the end of initrd cd ${tmpdir} mkdir -p etc/luks cp -f /etc/luks/* etc/luks/ cp -f /etc/crypttab etc/ find . -mindepth 1 | cpio --quiet -H newc -o | gzip -9 -n >> ${initrd} # Cleanup rm -rf etc/