diff --git a/src/utils.cpp b/src/utils.cpp index 6bd1839..3f92e3d 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -213,6 +213,20 @@ void dump_settings_to_log() noexcept { 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& partitions) noexcept { + for (auto&& partition : partitions) { + dump_partition_to_log(partition); + } +} + bool prompt_char(const char* prompt, const char* color, char* read) noexcept { fmt::print("{}{}{}\n", color, prompt, RESET); diff --git a/src/utils.hpp b/src/utils.hpp index 5643e41..2e2fa77 100644 --- a/src/utils.hpp +++ b/src/utils.hpp @@ -4,6 +4,9 @@ #include "definitions.hpp" #include "subprocess.h" +// import gucc +#include "gucc/partition.hpp" + #include // for from_chars #include // for function #include // for optional @@ -59,6 +62,8 @@ void arch_chroot(const std::string_view& command, bool follow = true) noexcept; void exec_follow(const std::vector& 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_settings_to_log() noexcept; +void dump_partition_to_log(const gucc::fs::Partition& partition) noexcept; +void dump_partitions_to_log(const std::vector& partitions) noexcept; [[nodiscard]] bool check_root() noexcept; void id_system() noexcept; [[nodiscard]] bool handle_connection() noexcept;