Initial upload of HyprArch releng configuration

This commit is contained in:
2026-03-03 20:31:33 +00:00
commit 7df61351c0
634 changed files with 36355 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*
*/
#ifndef PARTITION_AUTOMOUNT_H
#define PARTITION_AUTOMOUNT_H
#include "DllMacro.h"
#include <memory>
namespace Calamares
{
namespace Partition
{
struct AutoMountInfo;
/** @brief Disable automount
*
* Various subsystems can do "agressive automount", which can get in the
* way of partitioning actions. In particular, Solid can be configured
* to automount every device it sees, and partitioning happens in multiple
* steps (create table, create partition, set partition flags) which are
* blocked if the partition gets mounted partway through the operation.
*
* @param disable set this to false to reverse the sense of the function
* call and force *enabling* automount, instead.
*
* Returns an opaque structure which can be passed to automountRestore()
* to return the system to the previously-configured automount settings.
*/
DLLEXPORT std::shared_ptr< AutoMountInfo > automountDisable( bool disable = true );
/** @brief Restore automount settings
*
* Pass the value returned from automountDisable() to restore the
* previous settings.
*/
DLLEXPORT void automountRestore( const std::shared_ptr< AutoMountInfo >& t );
} // namespace Partition
} // namespace Calamares
#endif

View File

@@ -0,0 +1,100 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2014 Aurélien Gâteau <agateau@kde.org>
* SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac <teo@kde.org>
* SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*
*/
/*
* NOTE: this functionality is only available when Calamares is compiled
* with KPMcore support.
*/
#ifndef PARTITION_FILESYSTEM_H
#define PARTITION_FILESYSTEM_H
#include "DllMacro.h"
#include "partition/Global.h"
#include <kpmcore/fs/filesystem.h>
namespace Calamares
{
namespace Partition
{
QString DLLEXPORT prettyNameForFileSystemType( FileSystem::Type t );
/** @brief Returns a machine-readable identifier for the filesystem type
*
* This identifier is used in filesystem manipulation --
* e.g. when mounting the filesystem, or in /etc/fstab. It
* is almost always just what KPMCore says it is, with
* the following exceptions:
* - reiserfs is called "reiser" by KPMCore, "reiserfs" by Calamares
*/
QString DLLEXPORT untranslatedFS( FileSystem::Type t );
/** @brief Returns the machine-readable identifier for the given @p fs
*
* See notes for untranslatedFS(), above.
*/
static inline QString
untranslatedFS( FileSystem& fs )
{
return untranslatedFS( fs.type() );
}
/** @brief Returns a machine-readable identifier for the given @p fs
*
* Returns an empty string is the @p fs is not valid (e.g. nullptr).
*/
static inline QString
untranslatedFS( FileSystem* fs )
{
return fs ? untranslatedFS( *fs ) : QString();
}
static inline QString
userVisibleFS( FileSystem& fs )
{
return fs.name();
}
static inline QString
userVisibleFS( FileSystem* fs )
{
return fs ? userVisibleFS( *fs ) : QString();
}
/** @brief Mark a particular filesystem type as used (or not)
*
* See useFilesystemGS(const QString&, bool); this method uses the filesystem type
* enumeration to pick the name. (The other implementation is in `Global.h`
* because it touches Global Storage, but this one needs KPMcore)
*/
inline void
useFilesystemGS( FileSystem::Type filesystem, bool used )
{
useFilesystemGS( untranslatedFS( filesystem ), used );
}
/* @brief Reads from global storage whether the typesystem type is used
*
* See isFilesystemUsedGS(const QString&). (The other implementation is in `Global.h`
* because it touches Global Storage, but this one needs KPMcore)
*/
inline bool
isFilesystemUsedGS( FileSystem::Type filesystem )
{
return isFilesystemUsedGS( untranslatedFS( filesystem ) );
}
} // namespace Partition
} // namespace Calamares
#endif // PARTITION_PARTITIONQUERY_H

View File

@@ -0,0 +1,78 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2021 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*
*/
/*
* This is the API for manipulating Global Storage keys related to
* filesystems and partitions. This does **not** depend on KPMcore.
*/
#ifndef PARTITION_GLOBAL_H
#define PARTITION_GLOBAL_H
#include "DllMacro.h"
#include "JobQueue.h"
namespace Calamares
{
namespace Partition
{
/** @brief Mark a particular filesystem type as used (or not)
*
* Filesystems are marked used (or not) in the global storage
* key *filesystem_use*. Sub-keys are the filesystem name,
* and the values are boolean; filesystems that are used in
* the target system are marked with @c true. Unused filesystems
* may be unmarked, or may be marked @c false.
*
* The filesystem name should be the untranslated name. Filesystem
* names are **lower**cased when used as keys.
*/
void DLLEXPORT useFilesystemGS( Calamares::GlobalStorage* gs, const QString& filesystemType, bool used );
/** @brief Reads from global storage whether the filesystem type is used
*
* Reads from the global storage key *filesystem_use* and returns
* the boolean value stored in subkey @p filesystemType. Returns
* @c false if the subkey is not set at all.
*
* The filesystem name should be the untranslated name. Filesystem
* names are **lower**cased when used as keys.
*/
bool DLLEXPORT isFilesystemUsedGS( const Calamares::GlobalStorage* gs, const QString& filesystemType );
/** @brief Clears the usage data for filesystems
*
* This removes the internal key *filesystem_use*.
*/
void DLLEXPORT clearFilesystemGS( Calamares::GlobalStorage* gs );
/** @brief Convenience function for using "the" Global Storage
*
* @see useFilesystemGS(const QString&, bool)
*/
inline void
useFilesystemGS( const QString& filesystemType, bool used )
{
useFilesystemGS( Calamares::JobQueue::instanceGlobalStorage(), filesystemType, used );
}
/** @brief Convenience function for using "the" Global Storage
*
* @see isFilesystemUsedGS(const QString&);
*/
inline bool
isFilesystemUsedGS( const QString& filesystemType )
{
return isFilesystemUsedGS( Calamares::JobQueue::instanceGlobalStorage(), filesystemType );
}
} // namespace Partition
} // namespace Calamares
#endif

View File

@@ -0,0 +1,43 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*/
/*
* KPMCore header file inclusion.
*
* Includes the system KPMCore headers without warnings (by switching off
* the expected warnings).
*/
#ifndef PARTITION_KPMHELPER_H
#define PARTITION_KPMHELPER_H
#include <qglobal.h>
// The kpmcore headers are not C++17 warning-proof, especially
// with picky compilers like Clang 10. Since we use Clang for the
// find-all-the-warnings case, switch those warnings off for
// the we-can't-change-them system headers.
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG( "-Wdocumentation" )
QT_WARNING_DISABLE_CLANG( "-Wsuggest-destructor-override" )
QT_WARNING_DISABLE_CLANG( "-Winconsistent-missing-destructor-override" )
// Because of __lastType
QT_WARNING_DISABLE_CLANG( "-Wreserved-identifier" )
#include <backend/corebackend.h>
#include <core/device.h>
#include <core/lvmdevice.h>
#include <core/partition.h>
#include <core/partitionrole.h>
#include <core/partitiontable.h>
#include <fs/filesystem.h>
#include <fs/filesystemfactory.h>
QT_WARNING_POP
#endif

View File

@@ -0,0 +1,63 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*
*/
/*
* NOTE: this functionality is only available when Calamares is compiled
* with KPMcore support.
*/
#ifndef PARTITION_KPMMANAGER_H
#define PARTITION_KPMMANAGER_H
#include "DllMacro.h"
#include <memory>
class CoreBackend;
namespace Calamares
{
namespace Partition
{
/// @brief Handle to KPMCore
class InternalManager;
/** @brief KPMCore loader and cleanup
*
* A Calamares plugin that uses KPMCore should hold an object of
* this class; its only responsibility is to load KPMCore
* and to cleanly unload it on destruction (with KPMCore 4,
* also to shutdown the privileged helper application).
*
* It loads the default plugin ("parted" with KPMCore 3, "sfdisk"
* with KPMCore 4), but this can be overridden by setting the
* environment variable KPMCORE_BACKEND. Setting it to
* "dummy" will load the dummy plugin instead.
*/
class DLLEXPORT KPMManager
{
public:
KPMManager();
~KPMManager();
/// @brief Is KPMCore loaded correctly?
operator bool() const;
/// @brief Gets the KPMCore backend (e.g. CoreBackendManager::self()->backend() )
CoreBackend* backend() const;
private:
std::shared_ptr< InternalManager > m_d;
};
} // namespace Partition
} // namespace Calamares
#endif // PARTITION_KPMMANAGER_H

View File

@@ -0,0 +1,112 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2014 Teo Mrnjavac <teo@kde.org>
* SPDX-FileCopyrightText: 2017-2019 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*
*/
#ifndef PARTITION_MOUNT_H
#define PARTITION_MOUNT_H
#include "DllMacro.h"
#include <QList>
#include <QString>
#include <QStringList>
#include <memory>
namespace Calamares
{
namespace Partition
{
/**
* Runs the mount utility with the specified parameters.
* @param devicePath the path of the partition to mount.
* @param mountPoint the full path of the target mount point.
* @param filesystemName the name of the filesystem (optional).
* @param options any additional options as passed to mount -o (optional).
* If @p options starts with a dash (-) then it is passed unchanged
* and no -o option is added; this is used in handling --bind mounts.
* @returns the program's exit code, or:
* Crashed = QProcess crash
* FailedToStart = QProcess cannot start
* NoWorkingDirectory = bad arguments
*/
DLLEXPORT int mount( const QString& devicePath,
const QString& mountPoint,
const QString& filesystemName = QString(),
const QString& options = QString() );
/** @brief Unmount the given @p path (device or mount point).
*
* Runs umount(8) in the host system.
*
* @returns the program's exit code, or special codes like mount().
*/
DLLEXPORT int unmount( const QString& path, const QStringList& options = QStringList() );
/** @brief Mount and automatically unmount a device
*
* The TemporaryMount object mounts a filesystem, and is like calling
* the mount() function, above. When the object is destroyed, unmount()
* is called with suitable options to undo the original mount.
*/
class DLLEXPORT TemporaryMount
{
public:
TemporaryMount( const QString& devicePath,
const QString& filesystemName = QString(),
const QString& options = QString() );
TemporaryMount( const TemporaryMount& ) = delete;
TemporaryMount& operator=( const TemporaryMount& ) = delete;
~TemporaryMount();
bool isValid() const { return bool( m_d ); }
QString path() const;
private:
struct Private;
std::unique_ptr< Private > m_d;
};
/** @brief Information about a mount point from /etc/mtab
*
* Entries in /etc/mtab are of the form: <device> <mountpoint> <other>
* This struct only stores device and mountpoint.
*
* The main way of getting these structs is to call fromMtab() to read
* an /etc/mtab-like file and storing all of the entries from it.
*/
struct DLLEXPORT MtabInfo
{
QString device;
QString mountPoint;
/** @brief Reads an mtab-like file and returns the entries from it
*
* When @p mtabPath is given, that file is read. If the given name is
* empty (e.g. the default) then /etc/mtab is read, instead.
*
* If @p mountPrefix is given, then only entries that have a mount point
* that starts with that prefix are returned.
*/
static QList< MtabInfo > fromMtabFilteredByPrefix( const QString& mountPrefix = QString(),
const QString& mtabPath = QString() );
/// @brief Predicate to sort MtabInfo objects by device-name
static bool deviceOrder( const MtabInfo& a, const MtabInfo& b ) { return a.device > b.device; }
/// @brief Predicate to sort MtabInfo objects by mount-point
static bool mountPointOrder( const MtabInfo& a, const MtabInfo& b ) { return a.mountPoint > b.mountPoint; }
};
} // namespace Partition
} // namespace Calamares
#endif

View File

@@ -0,0 +1,69 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2014 Aurélien Gâteau <agateau@kde.org>
* SPDX-FileCopyrightText: 2015 Teo Mrnjavac <teo@kde.org>
* SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*
*/
/*
* NOTE: this functionality is only available when Calamares is compiled
* with KPMcore support.
*/
#ifndef PARTITION_PARTITIONITERATOR_H
#define PARTITION_PARTITIONITERATOR_H
#include "DllMacro.h"
class Device;
class Partition;
class PartitionTable;
namespace Calamares
{
namespace Partition
{
/** @brief Iterator over KPMCore partitions
*
* A forward-only iterator to go through the partitions of a device,
* independently of whether they are primary, logical or extended.
*
* An iterator can be created from a device (then it refers to the
* partition table of that device) or a partition table. The
* partition table must remain valid throughout iteration.
*
* A nullptr is valid, for an empty iterator.
*/
class DLLEXPORT PartitionIterator
{
public:
::Partition* operator*() const;
void operator++();
bool operator==( const PartitionIterator& other ) const;
bool operator!=( const PartitionIterator& other ) const;
static PartitionIterator begin( ::Device* device );
static PartitionIterator begin( ::PartitionTable* table );
static PartitionIterator end( ::Device* device );
static PartitionIterator end( ::PartitionTable* table );
private:
PartitionIterator( ::PartitionTable* table );
::PartitionTable* m_table;
::Partition* m_current = nullptr;
};
} // namespace Partition
} // namespace Calamares
#endif // PARTITION_PARTITIONITERATOR_H

View File

@@ -0,0 +1,77 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2014 Aurélien Gâteau <agateau@kde.org>
* SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac <teo@kde.org>
* SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*
*/
/*
* NOTE: this functionality is only available when Calamares is compiled
* with KPMcore support.
*/
#ifndef PARTITION_PARTITIONQUERY_H
#define PARTITION_PARTITIONQUERY_H
#include "DllMacro.h"
#include <QList>
#include <functional>
class Device;
class Partition;
class PartitionTable;
namespace Calamares
{
namespace Partition
{
using ::Device;
using ::Partition;
using ::PartitionTable;
/** @brief Get partition table */
DLLEXPORT const PartitionTable* getPartitionTable( const Partition* partition );
/** @brief Is this a free-space area? */
DLLEXPORT bool isPartitionFreeSpace( const Partition* );
/** @brief Is this partition newly-to-be-created?
*
* Returns true if the partition is planned to be created by the installer as
* opposed to already existing on the disk.
*/
DLLEXPORT bool isPartitionNew( const Partition* );
/**
* Iterates on all devices and return the first partition which is (already)
* mounted on @p mountPoint.
*/
DLLEXPORT Partition* findPartitionByCurrentMountPoint( const QList< Device* >& devices, const QString& mountPoint );
// TODO: add this distinction
// Partition* findPartitionByIntendedMountPoint( const QList< Device* >& devices, const QString& mountPoint );
/**
* Iterates on all devices and partitions and returns a pointer to the Partition object
* for the given path, or nullptr if a Partition for the given path cannot be found.
*/
DLLEXPORT Partition* findPartitionByPath( const QList< Device* >& devices, const QString& path );
/**
* Iterates on all devices and partitions and returns a list of pointers to the Partition
* objects that satisfy the conditions defined in the criterion function.
*/
DLLEXPORT QList< Partition* > findPartitions( const QList< Device* >& devices,
std::function< bool( Partition* ) > criterionFunction );
} // namespace Partition
} // namespace Calamares
#endif // PARTITION_PARTITIONQUERY_H

View File

@@ -0,0 +1,120 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2019 Collabora Ltd <arnaud.ferraris@collabora.com>
* SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*
*/
#ifndef PARTITION_PARTITIONSIZE_H
#define PARTITION_PARTITIONSIZE_H
#include "DllMacro.h"
#include "utils/NamedSuffix.h"
#include "utils/Units.h"
// Qt
#include <QString>
namespace Calamares
{
namespace Partition
{
enum class SizeUnit
{
None,
Percent,
Byte,
KB,
KiB,
MB,
MiB,
GB,
GiB
};
/** @brief Partition size expressions
*
* Sizes can be specified in bytes, KiB, MiB, GiB or percent (of
* the available drive space are on). This class handles parsing
* of such strings from the config file.
*/
class DLLEXPORT PartitionSize : public NamedSuffix< SizeUnit, SizeUnit::None >
{
public:
PartitionSize()
: NamedSuffix()
{
}
PartitionSize( int v, SizeUnit u )
: NamedSuffix( v, u )
{
}
PartitionSize( const QString& );
bool isValid() const { return ( unit() != SizeUnit::None ) && ( value() > 0 ); }
bool operator<( const PartitionSize& other ) const;
bool operator>( const PartitionSize& other ) const;
bool operator==( const PartitionSize& other ) const;
/** @brief Convert the size to the number of sectors @p totalSectors .
*
* Each sector has size @p sectorSize, for converting sizes in Bytes,
* KiB, MiB or GiB to sector counts.
*
* @return the number of sectors needed, or -1 for invalid sizes.
*/
qint64 toSectors( qint64 totalSectors, qint64 sectorSize ) const;
/** @brief Convert the size to bytes.
*
* The device's sectors count @p totalSectors and sector size
* @p sectoreSize are used to calculated the total size, which
* is then used to calculate the size when using Percent.
*
* @return the size in bytes, or -1 for invalid sizes.
*/
qint64 toBytes( qint64 totalSectors, qint64 sectorSize ) const;
/** @brief Convert the size to bytes.
*
* Total size @p totalBytes is needed for sizes in Percent. This
* parameter is unused in any other case.
*
* @return the size in bytes, or -1 for invalid sizes.
*/
qint64 toBytes( qint64 totalBytes ) const;
/** @brief Convert the size to bytes.
*
* This method is only valid for sizes in Bytes, KiB, MiB or GiB.
* It will return -1 in any other case. Note that 0KiB and 0MiB and
* 0GiB are considered **invalid** sizes and return -1.
*
* @return the size in bytes, or -1 if it cannot be calculated.
*/
qint64 toBytes() const;
/** @brief Are the units comparable?
*
* None units cannot be compared with anything. Percentages can
* be compared with each other, and all the explicit sizes (KiB, ...)
* can be compared with each other.
*/
static constexpr bool unitsComparable( const SizeUnit u1, const SizeUnit u2 )
{
return !( ( u1 == SizeUnit::None || u2 == SizeUnit::None )
|| ( u1 == SizeUnit::Percent && u2 != SizeUnit::Percent )
|| ( u1 != SizeUnit::Percent && u2 == SizeUnit::Percent ) );
}
};
} // namespace Partition
} // namespace Calamares
#endif // PARTITION_PARTITIONSIZE_H

View File

@@ -0,0 +1,40 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*
*/
#ifndef PARTITION_SYNC_H
#define PARTITION_SYNC_H
#include "DllMacro.h"
namespace Calamares
{
namespace Partition
{
/** @brief Run "udevadm settle" or other disk-sync mechanism.
*
* Call this after mounting, unmount, toggling swap, or other functions
* that might cause the disk to be "busy" for other disk-modifying
* actions (in particular, KPMcore actions with the sfdisk backend
* are sensitive, and systemd tends to keep disks busy after a change
* for a while).
*/
DLLEXPORT void sync();
/** @brief RAII class for calling sync() */
struct DLLEXPORT Syncer
{
~Syncer() { sync(); }
};
} // namespace Partition
} // namespace Calamares
#endif