Python-style: refactor calculating target path of hook-script

This commit is contained in:
Adriaan de Groot 2017-06-06 16:18:26 +06:00
parent a752df2db0
commit 29d91a4fbf

View File

@ -46,21 +46,19 @@ def copy_initramfs_hooks(partitions, root_mount_point):
unencrypted_separate_boot = True
if encrypt_hook:
target = "{!s}/usr/share/initramfs-tools/hooks/encrypt_hook".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)
)
target
)
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
)
target
)
os.chmod(target, 0o755)
def run():