Merge pull request #156 from calamares/grub-efi-support-rfe-110

grub: Add EFI support (improved).
main
Teo Mrnjavac 10 years ago
commit 3984bf0634

@ -29,17 +29,6 @@ import subprocess
from libcalamares.utils import check_chroot_call
def detect_firmware_type():
# Check for EFI variables support
if(os.path.exists("/sys/firmware/efi/efivars")):
fw_type = 'efi'
else:
fw_type = 'bios'
libcalamares.globalstorage.insert("firmwareType", fw_type)
libcalamares.utils.debug("Firmware type: {!s}".format(fw_type))
def get_uuid():
root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
print(root_mount_point)
@ -161,7 +150,6 @@ def install_bootloader(boot_loader, fw_type):
def run():
detect_firmware_type()
boot_loader = libcalamares.globalstorage.value("bootLoader")
fw_type = libcalamares.globalstorage.value("firmwareType")
install_bootloader(boot_loader, fw_type)

@ -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

@ -1,3 +1,5 @@
rootMountPoint: /tmp/mount
bootLoader:
installPath: /dev/sdb
branding:
shortProductName: "Generic Distro"

@ -32,6 +32,7 @@
#include <QDBusConnection>
#include <QDBusInterface>
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QLabel>
#include <QProcess>
@ -133,6 +134,9 @@ PrepareViewStep::PrepareViewStep( QObject* parent )
m_nextEnabled = canGoNext;
emit nextStatusChanged( m_nextEnabled );
if ( canGoNext )
detectFirmwareType();
timer->deleteLater();
} );
timer->start( 0 );
@ -363,3 +367,10 @@ PrepareViewStep::checkHasInternet()
return nmState == NM_STATE_CONNECTED_GLOBAL;
}
void
PrepareViewStep::detectFirmwareType()
{
QString fwType = QFile::exists( "/sys/firmware/efi/efivars" ) ? "efi" : "bios";
Calamares::JobQueue::instance()->globalStorage()->insert( "firmwareType", fwType );
}

@ -75,6 +75,7 @@ private:
bool checkBatteryExists();
bool checkHasPower();
bool checkHasInternet();
void detectFirmwareType();
QWidget* m_widget;
qreal m_requiredStorageGB;

Loading…
Cancel
Save