mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-30 02:45:37 -04:00
Fix for zfs partition deletion
This commit is contained in:
parent
132bca649e
commit
be47b5e59c
1 changed files with 25 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "DeletePartitionJob.h"
|
#include "DeletePartitionJob.h"
|
||||||
|
#include "utils/CalamaresUtilsSystem.h"
|
||||||
|
|
||||||
// KPMcore
|
// KPMcore
|
||||||
#include <kpmcore/core/device.h>
|
#include <kpmcore/core/device.h>
|
||||||
|
@ -19,6 +20,7 @@
|
||||||
#include <kpmcore/ops/deleteoperation.h>
|
#include <kpmcore/ops/deleteoperation.h>
|
||||||
#include <kpmcore/util/report.h>
|
#include <kpmcore/util/report.h>
|
||||||
|
|
||||||
|
|
||||||
DeletePartitionJob::DeletePartitionJob( Device* device, Partition* partition )
|
DeletePartitionJob::DeletePartitionJob( Device* device, Partition* partition )
|
||||||
: PartitionJob( partition )
|
: PartitionJob( partition )
|
||||||
, m_device( device )
|
, m_device( device )
|
||||||
|
@ -49,6 +51,29 @@ DeletePartitionJob::prettyStatusMessage() const
|
||||||
Calamares::JobResult
|
Calamares::JobResult
|
||||||
DeletePartitionJob::exec()
|
DeletePartitionJob::exec()
|
||||||
{
|
{
|
||||||
|
// Special handling for zfs
|
||||||
|
if ( m_partition->fileSystem().type() == FileSystem::Type::Zfs )
|
||||||
|
{
|
||||||
|
// Since deletion of a zfs partition can happen even if the distro doesn't support zfs,
|
||||||
|
// we need to check if the installation has a working zfs. If not, just remove the partition.
|
||||||
|
auto r = CalamaresUtils::System::instance()->runCommand( { "zpool", "status" }, std::chrono::seconds( 5 ) );
|
||||||
|
|
||||||
|
if ( r.getExitCode() != 0 )
|
||||||
|
{
|
||||||
|
r = CalamaresUtils::System::instance()->runCommand( { "sfdisk",
|
||||||
|
"--delete",
|
||||||
|
"--force",
|
||||||
|
m_partition->devicePath(),
|
||||||
|
QString::number( m_partition->number() ) },
|
||||||
|
std::chrono::seconds( 5 ) );
|
||||||
|
if ( r.getExitCode() != 0 )
|
||||||
|
return Calamares::JobResult::error( "message",
|
||||||
|
"Failed to delete zfs partition with output: " + r.getOutput() );
|
||||||
|
else
|
||||||
|
return Calamares::JobResult::ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Report report( nullptr );
|
Report report( nullptr );
|
||||||
DeleteOperation op( *m_device, m_partition );
|
DeleteOperation op( *m_device, m_partition );
|
||||||
op.setStatus( Operation::StatusRunning );
|
op.setStatus( Operation::StatusRunning );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue