mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-11-14 12:17:17 +00:00
28 lines
827 B
Bash
28 lines
827 B
Bash
#!/bin/ash
|
|
|
|
run_hook() {
|
|
if [ -n "$lukskeyfile" ]; then
|
|
# This is a needed kernel parameter for this hook
|
|
modprobe -a -q loop dm-crypt >/dev/null 2>&1
|
|
# Refer to help from `mkinitcpio -H lukskeyfile`.
|
|
IFS=: read rootKeyDev rootKey cryptkeyLoc <<EOF
|
|
$lukskeyfile
|
|
EOF
|
|
|
|
if [ -z "${cryptkeyLoc}" ]; then
|
|
cryptkeyLoc=/crypto_keyfile.bin
|
|
fi
|
|
|
|
if resoleved=$(resolve_device "${rootKeyDev}" $rootdelay); then
|
|
if mount -o noatime "${rootKeyDev}" /mnt>/dev/null 2>&1; then
|
|
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
|
|
}
|