Skip to content
Snippets Groups Projects
Commit 423c7b57 authored by Kevin Kofler's avatar Kevin Kofler Committed by Philip Müller
Browse files

[initramfscfg] Don't include keyfile in initramfs on unencrypted /boot.

This matches the fix in initcpiocfg.

I had to create an encrypt_hook_nokey that is a copy of encrypt_hook
without the part that copies the keyfile.
parent e0c5e81b
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
. /usr/share/initramfs-tools/hook-functions
if [ -f /etc/crypttab ]
then
cp /etc/crypttab ${DESTDIR}/etc/
fi
......@@ -6,6 +6,7 @@
# Copyright 2014, Rohan Garg <rohan@kde.org>
# Copyright 2015, Philip Müller <philm@manjaro.org>
# Copyright 2016, David McKinney <mckinney@subgraph.com>
# Copyright 2016, Kevin Kofler <kevin.kofler@chello.at>
#
# Calamares is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -31,13 +32,20 @@ def copy_initramfs_hooks(partitions, root_mount_point):
:param root_mount_point:
"""
encrypt_hook = False
unencrypted_separate_boot = False
for partition in partitions:
if partition["mountPoint"] == "/" and "luksMapperName" in partition:
encrypt_hook = True
if partition["mountPoint"] == "/boot" and "luksMapperName" not in partition:
unencrypted_separate_boot = True
if encrypt_hook:
shutil.copy2("/usr/lib/calamares/modules/initramfscfg/encrypt_hook", "{!s}/usr/share/initramfs-tools/hooks/".format(root_mount_point))
if unencrypted_separate_boot:
shutil.copy2("/usr/lib/calamares/modules/initramfscfg/encrypt_hook_nokey", "{!s}/usr/share/initramfs-tools/hooks/encrypt_hook".format(root_mount_point))
else:
shutil.copy2("/usr/lib/calamares/modules/initramfscfg/encrypt_hook", "{!s}/usr/share/initramfs-tools/hooks/".format(root_mount_point))
os.chmod("{!s}/usr/share/initramfs-tools/hooks/encrypt_hook".format(root_mount_point), 0o755)
def run():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment