move luks header and keyfile handling to init

This commit is contained in:
illiliti 2020-03-08 04:46:43 +03:00
parent 5413ec2f38
commit 15457b48be
2 changed files with 9 additions and 10 deletions

View File

@ -245,16 +245,12 @@ install_luks() {
install_library /usr/lib/libgcc_s.so.1
# copy luks header
[ -f "$luks_header" ] && {
[ -f "$luks_header" ] &&
install -m400 "$luks_header" "${workdir}/root/luks_header"
luks_args="--header=/root/luks_header $luks_args"
}
# copy luks keyfile
[ -f "$luks_keyfile" ] && {
[ -f "$luks_keyfile" ] &&
install -m400 "$luks_keyfile" "${workdir}/root/luks_keyfile"
luks_args="--key-file=/root/luks_keyfile $luks_args"
}
}
install_driver() {

View File

@ -89,7 +89,9 @@ findfs_sh() {
}
unlock_luks() {
[ "$luks_discard" = 1 ] && luks_args="--allow-discards $luks_args"
[ "$luks_discard" = 1 ] && luks_args="--allow-discards $luks_args"
[ -f /root/luks_header ] && luks_args="--header=/root/luks_header $luks_args"
[ -f /root/luks_keyfile ] && luks_args="--key-file=/root/luks_keyfile $luks_args"
cryptsetup $luks_args \
luksOpen \
@ -127,9 +129,10 @@ cleanup() {
}
boot_system() {
exec switch_root /mnt/root \
${init:-/sbin/init} ||
panic "failed to boot system"
exec switch_root \
/mnt/root \
${init:-/sbin/init} ||
panic "failed to boot system"
}
/sbin/busybox --install -s