Make efiSystemPartition mount point configurable in partition.conf.

Copy the setting into the global storage. Make the EraseDiskPage in the
partition module and the grub and bootloader modules read it from there.
Do not hardcode /boot as the path anymore.

I set the default path to /boot/efi because I think that's the most
common setting. At least Fedora and Debian use that path. But we can
change the default setting if you think I'm wrong, as long as it remains
configurable.

There is no separate setting for efi_directory_firmware anymore. The EFI
firmwares expect that directory to always be in the "EFI" path in the
EFI System Partition. Distributions using /boot/efi actually have that
directory under /boot/efi/EFI.
main
Kevin Kofler 10 years ago
parent 18da15a087
commit 8c98aeb04a

@ -117,18 +117,20 @@ def create_loader(loader_path):
def install_bootloader(boot_loader, fw_type):
if fw_type == 'efi':
install_path = libcalamares.globalstorage.value("rootMountPoint")
efi_directory = libcalamares.globalstorage.value("efiSystemPartition")
install_efi_directory = install_path + efi_directory
uuid = get_uuid()
distribution = get_bootloader_entry_name()
file_name_sanitizer = str.maketrans(" /", "_-")
conf_path = os.path.join(
install_path, "boot", "loader", "entries", "%s.conf" % distribution.translate(file_name_sanitizer))
install_efi_directory, "loader", "entries", "%s.conf" % distribution.translate(file_name_sanitizer))
fallback_path = os.path.join(
install_path, "boot", "loader", "entries", "%s-fallback.conf" % distribution.translate(file_name_sanitizer))
install_efi_directory, "loader", "entries", "%s-fallback.conf" % distribution.translate(file_name_sanitizer))
loader_path = os.path.join(
install_path, "boot", "loader", "loader.conf")
install_efi_directory, "loader", "loader.conf")
partitions = libcalamares.globalstorage.value("partitions")
for partition in partitions:
if partition["mountPoint"] == "/boot":
if partition["mountPoint"] == efi_directory:
print(partition["device"])
boot_device = partition["device"]
boot_p = boot_device[-1:]
@ -136,7 +138,7 @@ def install_bootloader(boot_loader, fw_type):
print(device)
subprocess.call(["sgdisk", "--typecode=%s:EF00" % boot_p, "%s" % device])
subprocess.call(
["gummiboot", "--path=%s/boot" % install_path, "install"])
["gummiboot", "--path=%s" % install_efi_directory, "install"])
create_conf(uuid, conf_path)
create_fallback(uuid, fallback_path)
create_loader(loader_path)

@ -26,8 +26,8 @@ from libcalamares.utils import check_chroot_call
def install_grub(boot_loader, fw_type):
if fw_type == 'efi':
efi_directory = "/boot"
efi_directory_firmware = "/boot/EFI"
efi_directory = libcalamares.globalstorage.value("efiSystemPartition")
efi_directory_firmware = efi_directory + "/EFI"
check_chroot_call(["mkdir", "-p", "{!s}".format(efi_directory)])
if "efiBootloaderId" in libcalamares.job.configuration:
efi_bootloader_id = libcalamares.job.configuration["efiBootloaderId"]

@ -30,6 +30,8 @@
#include "utils/CalamaresUtilsGui.h"
#include "utils/Logger.h"
#include "utils/Retranslator.h"
#include "GlobalStorage.h"
#include "JobQueue.h"
#include <QBoxLayout>
#include <QDir>
@ -160,7 +162,10 @@ EraseDiskPage::doAutopartition( Device* dev )
first_free_sector,
lastSector
);
PartitionInfo::setMountPoint( efiPartition, "/boot" );
PartitionInfo::setMountPoint( efiPartition, Calamares::JobQueue::instance()
->globalStorage()
->value( "efiSystemPartition" )
.toString() );
PartitionInfo::setFormat( efiPartition, true );
m_core->createPartition( dev, efiPartition );
first_free_sector = lastSector + 1;

@ -300,6 +300,25 @@ PartitionViewStep::onLeave()
}
void
PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
{
// Copy the efiSystemPartition setting to the global storage. It is needed not only in
// the EraseDiskPage, but also in the bootloader configuration modules (grub, bootloader).
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
if ( configurationMap.contains( "efiSystemPartition" ) &&
configurationMap.value( "efiSystemPartition" ).type() == QVariant::String &&
!configurationMap.value( "efiSystemPartition" ).toString().isEmpty() )
{
gs->insert( "efiSystemPartition", configurationMap.value( "efiSystemPartition" ).toString() );
}
else
{
gs->insert( "efiSystemPartition", QStringLiteral( "/boot/efi" ) );
}
}
QList< Calamares::job_ptr >
PartitionViewStep::jobs() const
{

@ -63,6 +63,8 @@ public:
void onLeave() override;
void setConfigurationMap( const QVariantMap& configurationMap ) override;
QList< Calamares::job_ptr > jobs() const override;
private:

@ -0,0 +1,4 @@
# This setting specifies the mount point of the EFI system partition. Some
# distributions (Fedora, Debian, etc.) use /boot/efi, others (KaOS, Manjaro,
# etc.) use just /boot.
efiSystemPartition: "/boot/efi"
Loading…
Cancel
Save