[partition] remove sgdisk dependency
This commit is contained in:
parent
4752f70809
commit
f42e904dba
@ -28,10 +28,8 @@ Modules:
|
|||||||
* extra-cmake-modules
|
* extra-cmake-modules
|
||||||
* KF5: KCoreAddons, KConfig, KI18n, KIconThemes, KIO, KService
|
* KF5: KCoreAddons, KConfig, KI18n, KIconThemes, KIO, KService
|
||||||
* KPMcore >= 2.2
|
* KPMcore >= 2.2
|
||||||
* sgdisk
|
|
||||||
* bootloader:
|
* bootloader:
|
||||||
* systemd-boot or GRUB
|
* systemd-boot or GRUB
|
||||||
* sgdisk
|
|
||||||
* unpackfs:
|
* unpackfs:
|
||||||
* squashfs-tools
|
* squashfs-tools
|
||||||
* rsync
|
* rsync
|
||||||
|
@ -258,7 +258,7 @@ def vfat_correct_case(parent, name):
|
|||||||
|
|
||||||
|
|
||||||
def prepare_bootloader(fw_type):
|
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.
|
Based on value 'efi_boot_loader', it either calls systemd-boot or grub to be installed.
|
||||||
|
|
||||||
:param fw_type:
|
:param fw_type:
|
||||||
@ -267,33 +267,6 @@ def prepare_bootloader(fw_type):
|
|||||||
efi_boot_loader = libcalamares.job.configuration["efiBootLoader"]
|
efi_boot_loader = libcalamares.job.configuration["efiBootLoader"]
|
||||||
efi_directory = libcalamares.globalstorage.value("efiSystemPartition")
|
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":
|
if efi_boot_loader == "systemd-boot" and fw_type == "efi":
|
||||||
install_systemd_boot(efi_directory)
|
install_systemd_boot(efi_directory)
|
||||||
else:
|
else:
|
||||||
|
@ -140,7 +140,8 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
|
|||||||
PartitionRole( PartitionRole::Primary ),
|
PartitionRole( PartitionRole::Primary ),
|
||||||
FileSystem::Fat32,
|
FileSystem::Fat32,
|
||||||
firstFreeSector,
|
firstFreeSector,
|
||||||
lastSector
|
lastSector,
|
||||||
|
PartitionTable::FlagEsp
|
||||||
);
|
);
|
||||||
PartitionInfo::setFormat( efiPartition, true );
|
PartitionInfo::setFormat( efiPartition, true );
|
||||||
PartitionInfo::setMountPoint( efiPartition, Calamares::JobQueue::instance()
|
PartitionInfo::setMountPoint( efiPartition, Calamares::JobQueue::instance()
|
||||||
|
@ -547,29 +547,14 @@ PartitionCoreModule::scanForEfiSystemPartitions()
|
|||||||
devices.append( device );
|
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 =
|
QList< Partition* > efiSystemPartitions =
|
||||||
KPMHelpers::findPartitions( devices,
|
KPMHelpers::findPartitions( devices,
|
||||||
[]( Partition* partition ) -> bool
|
[]( Partition* partition ) -> bool
|
||||||
{
|
{
|
||||||
QProcess process;
|
if ( partition->activeFlags().testFlag( PartitionTable::FlagEsp ) )
|
||||||
process.setProgram( "sgdisk" );
|
|
||||||
process.setArguments( { "-i",
|
|
||||||
QString::number( partition->number() ),
|
|
||||||
partition->devicePath() } );
|
|
||||||
process.setProcessChannelMode( QProcess::MergedChannels );
|
|
||||||
process.start();
|
|
||||||
if ( process.waitForFinished() )
|
|
||||||
{
|
{
|
||||||
if ( process.readAllStandardOutput()
|
cDebug() << "Found EFI system partition at" << partition->partitionPath();
|
||||||
.contains( "C12A7328-F81F-11D2-BA4B-00A0C93EC93B" ) )
|
return true;
|
||||||
{
|
|
||||||
cDebug() << "Found EFI system partition at" << partition->partitionPath();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} );
|
} );
|
||||||
|
Loading…
Reference in New Issue
Block a user