[partition] remove sgdisk dependency

This commit is contained in:
Philip 2016-10-31 11:06:04 +01:00
parent 4752f70809
commit f42e904dba
4 changed files with 6 additions and 49 deletions

View File

@ -28,10 +28,8 @@ Modules:
* extra-cmake-modules
* KF5: KCoreAddons, KConfig, KI18n, KIconThemes, KIO, KService
* KPMcore >= 2.2
* sgdisk
* bootloader:
* systemd-boot or GRUB
* sgdisk
* unpackfs:
* squashfs-tools
* rsync

View File

@ -258,7 +258,7 @@ def vfat_correct_case(parent, name):
def prepare_bootloader(fw_type):
""" Prepares bootloader and set proper flags to EFI boot partition (esp,boot).
""" Prepares bootloader.
Based on value 'efi_boot_loader', it either calls systemd-boot or grub to be installed.
:param fw_type:
@ -267,33 +267,6 @@ def prepare_bootloader(fw_type):
efi_boot_loader = libcalamares.job.configuration["efiBootLoader"]
efi_directory = libcalamares.globalstorage.value("efiSystemPartition")
if fw_type == "efi":
partitions = libcalamares.globalstorage.value("partitions")
boot_p = ""
device = ""
for partition in partitions:
if partition["mountPoint"] == efi_directory:
boot_device = partition["device"]
boot_p = boot_device[-1:]
device = boot_device[:-1]
if not boot_p or not device:
return ("EFI directory \"{!s}\" not found!".format(efi_directory),
"Boot partition: \"{!s}\"".format(boot_p),
"Boot device: \"{!s}\"".format(device))
else:
print("EFI directory: \"{!s}\"".format(efi_directory))
print("Boot partition: \"{!s}\"".format(boot_p))
print("Boot device: \"{!s}\"".format(device))
if not device:
print("WARNING: no EFI system partition or EFI system partition mount point not set.")
print(" >>> no EFI bootloader will be installed <<<")
return None
print("Set 'EF00' flag")
subprocess.call(["sgdisk", "--typecode={!s}:EF00".format(boot_p), "{!s}".format(device)])
if efi_boot_loader == "systemd-boot" and fw_type == "efi":
install_systemd_boot(efi_directory)
else:

View File

@ -140,7 +140,8 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
PartitionRole( PartitionRole::Primary ),
FileSystem::Fat32,
firstFreeSector,
lastSector
lastSector,
PartitionTable::FlagEsp
);
PartitionInfo::setFormat( efiPartition, true );
PartitionInfo::setMountPoint( efiPartition, Calamares::JobQueue::instance()

View File

@ -547,29 +547,14 @@ PartitionCoreModule::scanForEfiSystemPartitions()
devices.append( device );
}
//FIXME: Unfortunately right now we have to call sgdisk manually because
// the KPM submodule does not expose the ESP flag from libparted.
// The following findPartitions call and lambda should be scrapped and
// rewritten based on libKPM. -- Teo 5/2015
QList< Partition* > efiSystemPartitions =
KPMHelpers::findPartitions( devices,
[]( Partition* partition ) -> bool
{
QProcess process;
process.setProgram( "sgdisk" );
process.setArguments( { "-i",
QString::number( partition->number() ),
partition->devicePath() } );
process.setProcessChannelMode( QProcess::MergedChannels );
process.start();
if ( process.waitForFinished() )
if ( partition->activeFlags().testFlag( PartitionTable::FlagEsp ) )
{
if ( process.readAllStandardOutput()
.contains( "C12A7328-F81F-11D2-BA4B-00A0C93EC93B" ) )
{
cDebug() << "Found EFI system partition at" << partition->partitionPath();
return true;
}
cDebug() << "Found EFI system partition at" << partition->partitionPath();
return true;
}
return false;
} );