2020-08-25 16:05:56 +02:00
|
|
|
/* === This file is part of Calamares - <https://calamares.io> ===
|
2014-09-04 19:37:30 +02:00
|
|
|
*
|
2020-08-22 01:19:58 +02:00
|
|
|
* SPDX-FileCopyrightText: 2014-2016 Teo Mrnjavac <teo@kde.org>
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2014-09-04 19:37:30 +02:00
|
|
|
*
|
2020-08-25 16:05:56 +02:00
|
|
|
* Calamares is Free Software: see the License-Identifier above.
|
2014-09-04 19:37:30 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2015-10-29 17:33:15 +01:00
|
|
|
#ifndef PARTITIONACTIONS_H
|
|
|
|
#define PARTITIONACTIONS_H
|
2014-09-04 19:37:30 +02:00
|
|
|
|
2020-10-02 12:22:53 +02:00
|
|
|
#include "core/Config.h"
|
2020-07-30 10:51:48 +02:00
|
|
|
|
2020-05-18 14:12:50 +02:00
|
|
|
#include <QSet>
|
2016-04-22 16:49:58 +02:00
|
|
|
#include <QString>
|
|
|
|
|
2014-09-04 19:37:30 +02:00
|
|
|
class PartitionCoreModule;
|
2014-09-16 18:12:30 +02:00
|
|
|
class Device;
|
2015-11-18 16:02:51 +01:00
|
|
|
class Partition;
|
2014-09-04 19:37:30 +02:00
|
|
|
|
2015-10-29 17:33:15 +01:00
|
|
|
namespace PartitionActions
|
2014-09-04 19:37:30 +02:00
|
|
|
{
|
2018-09-17 12:42:14 +02:00
|
|
|
/** @brief Namespace for enums
|
|
|
|
*
|
|
|
|
* This namespace houses non-class enums.....
|
|
|
|
*/
|
|
|
|
namespace Choices
|
|
|
|
{
|
2020-02-14 11:15:57 +01:00
|
|
|
struct ReplacePartitionOptions
|
|
|
|
{
|
2020-05-20 17:22:37 +02:00
|
|
|
QString defaultPartitionTableType; // e.g. "gpt" or "msdos"
|
2020-02-14 11:15:57 +01:00
|
|
|
QString defaultFsType; // e.g. "ext4" or "btrfs"
|
|
|
|
QString luksPassphrase; // optional
|
2018-12-04 11:15:38 +01:00
|
|
|
|
2020-05-20 17:22:37 +02:00
|
|
|
ReplacePartitionOptions( const QString& pt, const QString& fs, const QString& luks )
|
|
|
|
: defaultPartitionTableType ( pt )
|
|
|
|
, defaultFsType( fs )
|
2020-02-14 11:15:57 +01:00
|
|
|
, luksPassphrase( luks )
|
2018-09-17 12:42:14 +02:00
|
|
|
{
|
2020-02-14 11:15:57 +01:00
|
|
|
}
|
|
|
|
};
|
2018-09-17 12:42:14 +02:00
|
|
|
|
2020-02-14 11:15:57 +01:00
|
|
|
struct AutoPartitionOptions : ReplacePartitionOptions
|
|
|
|
{
|
|
|
|
QString efiPartitionMountPoint; // optional, e.g. "/boot"
|
|
|
|
quint64 requiredSpaceB; // estimated required space for root partition
|
2020-10-02 12:22:53 +02:00
|
|
|
Config::SwapChoice swap;
|
2018-09-17 12:42:14 +02:00
|
|
|
|
2020-05-20 17:22:37 +02:00
|
|
|
AutoPartitionOptions( const QString& pt,
|
|
|
|
const QString& fs,
|
2020-02-14 11:15:57 +01:00
|
|
|
const QString& luks,
|
|
|
|
const QString& efi,
|
|
|
|
qint64 requiredBytes,
|
2020-10-02 12:22:53 +02:00
|
|
|
Config::SwapChoice s )
|
2020-05-20 17:22:37 +02:00
|
|
|
: ReplacePartitionOptions( pt, fs, luks )
|
2020-02-14 11:15:57 +01:00
|
|
|
, efiPartitionMountPoint( efi )
|
|
|
|
, requiredSpaceB( requiredBytes > 0 ? static_cast< quint64 >( requiredBytes ) : 0 )
|
|
|
|
, swap( s )
|
2018-09-17 12:42:14 +02:00
|
|
|
{
|
2020-02-14 11:15:57 +01:00
|
|
|
}
|
|
|
|
};
|
2018-09-17 12:42:14 +02:00
|
|
|
|
|
|
|
} // namespace Choices
|
2017-03-03 12:31:39 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief doAutopartition sets up an autopartitioning operation on the given Device.
|
|
|
|
* @param core a pointer to the PartitionCoreModule instance.
|
|
|
|
* @param dev the device to wipe.
|
2018-09-17 12:42:14 +02:00
|
|
|
* @param options settings for autopartitioning.
|
2017-03-03 12:31:39 +01:00
|
|
|
*/
|
2020-02-14 11:15:57 +01:00
|
|
|
void doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionOptions options );
|
2016-04-22 16:49:58 +02:00
|
|
|
|
2017-03-03 12:31:39 +01:00
|
|
|
/**
|
|
|
|
* @brief doReplacePartition sets up replace-partitioning with the given partition.
|
|
|
|
* @param core a pointer to the PartitionCoreModule instance.
|
|
|
|
* @param dev a pointer to the Device on which to replace a partition.
|
|
|
|
* @param partition a pointer to the Partition to be replaced.
|
2018-09-17 12:42:14 +02:00
|
|
|
* @param options settings for partitioning (not all fields apply)
|
|
|
|
*
|
2017-03-03 12:31:39 +01:00
|
|
|
* @note this function also takes care of requesting PCM to delete the partition.
|
|
|
|
*/
|
2016-04-22 16:49:58 +02:00
|
|
|
void doReplacePartition( PartitionCoreModule* core,
|
|
|
|
Device* dev,
|
2016-06-03 16:39:28 +02:00
|
|
|
Partition* partition,
|
2018-09-17 12:42:14 +02:00
|
|
|
Choices::ReplacePartitionOptions options );
|
2018-09-13 12:23:33 +02:00
|
|
|
} // namespace PartitionActions
|
2014-09-04 19:37:30 +02:00
|
|
|
|
2020-02-14 11:15:57 +01:00
|
|
|
#endif // PARTITIONACTIONS_H
|