mirror of
https://github.com/CachyOS/New-Cli-Installer.git
synced 2025-01-23 14:32:22 +08:00
🧹 gucc: move partition struct into own header
This commit is contained in:
parent
a8af65e38b
commit
f5f8886e00
@ -1,37 +1,16 @@
|
||||
#ifndef FSTAB_HPP
|
||||
#define FSTAB_HPP
|
||||
|
||||
#include <optional> // for optional
|
||||
#include "gucc/partition.hpp"
|
||||
|
||||
#include <string> // for string
|
||||
#include <string_view> // for string_view
|
||||
#include <vector> // for vector
|
||||
|
||||
namespace gucc::fs {
|
||||
|
||||
struct Partition final {
|
||||
std::string fstype;
|
||||
std::string mountpoint;
|
||||
std::string uuid_str;
|
||||
std::string device;
|
||||
|
||||
// mount points that will be written in fstab,
|
||||
// excluding subvol={subvol name}
|
||||
// if device is ssd, mount options for ssd should be appended
|
||||
std::string mount_opts;
|
||||
std::optional<std::string> luks_mapper_name;
|
||||
std::optional<std::string> luks_uuid;
|
||||
|
||||
/*
|
||||
// subvolumes per partition
|
||||
// e.g we have partition /dev/nvme0n1p1 with subvolumes: /@, /@home, /@cache
|
||||
std::optional<std::vector<BtrfsSubvolume>> subvols;
|
||||
*/
|
||||
// subvolume name if the partition is btrrfs subvolume
|
||||
std::optional<std::string> subvolume;
|
||||
};
|
||||
|
||||
// Generate fstab
|
||||
auto generate_fstab(const std::vector<Partition>& partitions, std::string_view root_mountpoint, std::string_view crypttab_opts) noexcept -> bool;
|
||||
auto generate_fstab(const std::vector<Partition>& partitions, std::string_view root_mountpoint) noexcept -> bool;
|
||||
|
||||
// Generate fstab into string
|
||||
auto generate_fstab_content(const std::vector<Partition>& partitions) noexcept -> std::string;
|
||||
|
33
gucc/include/gucc/partition.hpp
Normal file
33
gucc/include/gucc/partition.hpp
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef PARTITION_HPP
|
||||
#define PARTITION_HPP
|
||||
|
||||
#include <optional> // for optional
|
||||
#include <string> // for string
|
||||
|
||||
namespace gucc::fs {
|
||||
|
||||
struct Partition final {
|
||||
std::string fstype;
|
||||
std::string mountpoint;
|
||||
std::string uuid_str;
|
||||
std::string device;
|
||||
|
||||
// mount points that will be written in fstab,
|
||||
// excluding subvol={subvol name}
|
||||
// if device is ssd, mount options for ssd should be appended
|
||||
std::string mount_opts;
|
||||
std::optional<std::string> luks_mapper_name;
|
||||
std::optional<std::string> luks_uuid;
|
||||
|
||||
/*
|
||||
// subvolumes per partition
|
||||
// e.g we have partition /dev/nvme0n1p1 with subvolumes: /@, /@home, /@cache
|
||||
std::optional<std::vector<BtrfsSubvolume>> subvols;
|
||||
*/
|
||||
// subvolume name if the partition is btrrfs subvolume
|
||||
std::optional<std::string> subvolume;
|
||||
};
|
||||
|
||||
} // namespace gucc::fs
|
||||
|
||||
#endif // PARTITION_HPP
|
Loading…
Reference in New Issue
Block a user