#!/bin/ash run_hook() { # This is a needed kernel parameter for this hook if [ -n "$lukskeyfile" ]; then modprobe -a -q loop dm-crypt >/dev/null 2>&1 # Refer to help from `mkinitcpio -H lukskeyfile`. IFS=: read rootKeyDev rootKey cryptkeyLoc </dev/null 2>&1; then # Copy the keyfile present in the device into the # ramfs filesystem to be read by dm-crypt cat "/mnt/${rootKey}" > "${cryptkeyLoc}" else echo "Failed to mount ${rootKeyDev} on /mnt" /bin/sh fi else echo "Failed to find ${rootKeyDev} containing LUKS root key." fi fi }