mirror of
https://github.com/CachyOS/New-Cli-Installer.git
synced 2025-01-23 14:32:22 +08:00
👷 utils: add function to dump partition scheme into log
This commit is contained in:
parent
e2537840ee
commit
414c8f0aa4
@ -213,6 +213,20 @@ void dump_settings_to_log() noexcept {
|
|||||||
spdlog::info("Settings:\n{}", out);
|
spdlog::info("Settings:\n{}", out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dump_partition_to_log(const gucc::fs::Partition& partition) noexcept {
|
||||||
|
const std::string_view part_tag = (partition.mountpoint == "/"sv) ? "root partition"sv : "partition"sv;
|
||||||
|
|
||||||
|
spdlog::debug("[DUMP] {}: fs='{}';mountpoint='{}';uuid_str='{}';device='{}';mount_opts='{}';subvolume='{}'",
|
||||||
|
part_tag,
|
||||||
|
partition.fstype, partition.mountpoint, partition.uuid_str, partition.device, partition.mount_opts, *partition.subvolume);
|
||||||
|
}
|
||||||
|
|
||||||
|
void dump_partitions_to_log(const std::vector<gucc::fs::Partition>& partitions) noexcept {
|
||||||
|
for (auto&& partition : partitions) {
|
||||||
|
dump_partition_to_log(partition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool prompt_char(const char* prompt, const char* color, char* read) noexcept {
|
bool prompt_char(const char* prompt, const char* color, char* read) noexcept {
|
||||||
fmt::print("{}{}{}\n", color, prompt, RESET);
|
fmt::print("{}{}{}\n", color, prompt, RESET);
|
||||||
|
|
||||||
|
@ -4,6 +4,9 @@
|
|||||||
#include "definitions.hpp"
|
#include "definitions.hpp"
|
||||||
#include "subprocess.h"
|
#include "subprocess.h"
|
||||||
|
|
||||||
|
// import gucc
|
||||||
|
#include "gucc/partition.hpp"
|
||||||
|
|
||||||
#include <charconv> // for from_chars
|
#include <charconv> // for from_chars
|
||||||
#include <functional> // for function
|
#include <functional> // for function
|
||||||
#include <optional> // for optional
|
#include <optional> // for optional
|
||||||
@ -59,6 +62,8 @@ void arch_chroot(const std::string_view& command, bool follow = true) noexcept;
|
|||||||
void exec_follow(const std::vector<std::string>& vec, std::string& process_log, bool& running, subprocess_s& child, bool async = true) noexcept;
|
void exec_follow(const std::vector<std::string>& vec, std::string& process_log, bool& running, subprocess_s& child, bool async = true) noexcept;
|
||||||
void dump_to_log(const std::string& data) noexcept;
|
void dump_to_log(const std::string& data) noexcept;
|
||||||
void dump_settings_to_log() noexcept;
|
void dump_settings_to_log() noexcept;
|
||||||
|
void dump_partition_to_log(const gucc::fs::Partition& partition) noexcept;
|
||||||
|
void dump_partitions_to_log(const std::vector<gucc::fs::Partition>& partitions) noexcept;
|
||||||
[[nodiscard]] bool check_root() noexcept;
|
[[nodiscard]] bool check_root() noexcept;
|
||||||
void id_system() noexcept;
|
void id_system() noexcept;
|
||||||
[[nodiscard]] bool handle_connection() noexcept;
|
[[nodiscard]] bool handle_connection() noexcept;
|
||||||
|
Loading…
Reference in New Issue
Block a user