tinyramfs/hooks/luks/luks
2020-07-05 11:11:39 +03:00

42 lines
1.0 KiB
Bash

# vim: set ft=sh:
# shellcheck shell=sh
#
# false positive
# shellcheck disable=2154
#
# word splitting is safe by design
# shellcheck disable=2086
#
# handle_luks()
{
print "configuring LUKS"
[ "$hostonly" = 1 ] &&
for _module in \
aes ecb xts lrw wp512 sha256 \
sha512 twofish serpent dm-crypt
do
copy_module "$_module"
done
copy_binary cryptsetup
# avoid possible issues with libgcc_s.so.1
# see https://bugs.archlinux.org/task/56771
[ -e /lib/libgcc_s.so.1 ] && copy_library /lib/libgcc_s.so.1
IFS=,; set -- $luks_opts; unset IFS
for opt; do case "${opt%%=*}" in
key | header)
cp "${opt#*=}" "${tmpdir}/root/${opt%%=*}"
chmod 400 "${tmpdir}/root/${opt%%=*}"
sed "s|${opt#*=}|/root/${opt%%=*}|" \
"${tmpdir}/etc/tinyramfs/config" > "${tmpdir}/_"
mv "${tmpdir}/_" "${tmpdir}/etc/tinyramfs/config"
chmod 600 "${tmpdir}/etc/tinyramfs/config"
esac || panic; done
}