|
|
|
@ -3,6 +3,8 @@
|
|
|
|
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
|
|
|
|
#
|
|
|
|
|
# Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
|
|
|
|
# Copyright 2014, Daniel Hillenbrand <codeworkx@bbqlinux.org>
|
|
|
|
|
# Copyright 2014, 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
|
|
|
|
@ -21,13 +23,22 @@ import libcalamares
|
|
|
|
|
from libcalamares.utils import check_chroot_call
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def install_grub(boot_loader):
|
|
|
|
|
install_path = boot_loader["installPath"]
|
|
|
|
|
check_chroot_call([libcalamares.job.configuration["grubInstall"], install_path])
|
|
|
|
|
def install_grub(boot_loader, fw_type):
|
|
|
|
|
if fw_type == 'efi':
|
|
|
|
|
efi_directory = "/boot/efi"
|
|
|
|
|
branding = libcalamares.globalstorage.value("branding")
|
|
|
|
|
distribution = branding["shortProductName"]
|
|
|
|
|
file_name_sanitizer = str.maketrans(" /", "_-")
|
|
|
|
|
check_chroot_call([libcalamares.job.configuration["grubInstall"], "--target=x86_64-efi", "--efi-directory={!s}".format(efi_directory), "--bootloader-id={!s}".format(distribution.translate(file_name_sanitizer))])
|
|
|
|
|
else:
|
|
|
|
|
install_path = boot_loader["installPath"]
|
|
|
|
|
check_chroot_call([libcalamares.job.configuration["grubInstall"], install_path])
|
|
|
|
|
|
|
|
|
|
check_chroot_call([libcalamares.job.configuration["grubMkconfig"], "-o", libcalamares.job.configuration["grubCfg"]])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def run():
|
|
|
|
|
boot_loader = libcalamares.globalstorage.value("bootLoader")
|
|
|
|
|
install_grub(boot_loader)
|
|
|
|
|
fw_type = libcalamares.globalstorage.value("firmwareType")
|
|
|
|
|
install_grub(boot_loader, fw_type)
|
|
|
|
|
return None
|
|
|
|
|