From 382522f98d99804383690ab49736a926628f88e5 Mon Sep 17 00:00:00 2001 From: Vladislav Nepogodin Date: Mon, 29 Jul 2024 02:05:09 +0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20tui:=20put=20LUKS=20information?= =?UTF-8?q?=20about=20partitions=20into=20the=20scheme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tui.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/tui.cpp b/src/tui.cpp index 0b119e6..c4c1eba 100644 --- a/src/tui.cpp +++ b/src/tui.cpp @@ -1717,7 +1717,7 @@ auto mount_root_partition(std::vector& partitions) noexcept // utils::delete_partition_in_list(std::get(config_data["ROOT_PART"])); - // TODO(vnepogodin): parse luks information + // get options used for mounting the current partition const auto& mount_opts_info = std::get(config_data["MOUNT_OPTS"]); const auto& part_fs = gucc::fs::utils::get_mountpoint_fs(mountpoint_info); @@ -1726,6 +1726,16 @@ auto mount_root_partition(std::vector& partitions) noexcept const auto& root_part_uuid = gucc::fs::utils::get_device_uuid(root_part_struct.device); root_part_struct.uuid_str = root_part_uuid; + // get luks information about the current partition + const auto& luks_name = std::get(config_data["LUKS_NAME"]); + const auto& luks_uuid = std::get(config_data["LUKS_UUID"]); + if (!luks_name.empty()) { + root_part_struct.luks_mapper_name = luks_name; + } + if (!luks_uuid.empty()) { + root_part_struct.luks_uuid = luks_uuid; + } + utils::dump_partition_to_log(root_part_struct); // insert root partition @@ -1884,8 +1894,10 @@ void mount_partitions() noexcept { tui::mount_current_partition(); // utils::delete_partition_in_list(partition); - // TODO(vnepogodin): parse luks information + // get mountpoint const auto& mountpoint_info = std::get(config_data["MOUNTPOINT"]); + + // get options used for mounting the current partition const auto& mount_opts_info = std::get(config_data["MOUNT_OPTS"]); const auto& part_fs = gucc::fs::utils::get_mountpoint_fs(mountpoint_info); @@ -1894,6 +1906,16 @@ void mount_partitions() noexcept { const auto& part_uuid = gucc::fs::utils::get_device_uuid(part_struct.device); part_struct.uuid_str = part_uuid; + // get luks information about the current partition + const auto& luks_name = std::get(config_data["LUKS_NAME"]); + const auto& luks_uuid = std::get(config_data["LUKS_UUID"]); + if (!luks_name.empty()) { + part_struct.luks_mapper_name = luks_name; + } + if (!luks_uuid.empty()) { + part_struct.luks_uuid = luks_uuid; + } + utils::dump_partition_to_log(part_struct); // insert root partition