From 1673f81d37395005c544cf82110ed45e55b37764 Mon Sep 17 00:00:00 2001 From: Vladislav Nepogodin Date: Sun, 28 Jul 2024 20:05:55 +0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20properly=20detect=20uuid=20of=20?= =?UTF-8?q?partitions=20during=20init?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tui.cpp | 6 ++++++ src/utils.cpp | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/tui.cpp b/src/tui.cpp index a29da08..0d7f4f9 100644 --- a/src/tui.cpp +++ b/src/tui.cpp @@ -1757,6 +1757,9 @@ void mount_partitions() noexcept { const auto& part_fs = gucc::fs::utils::get_mountpoint_fs(mountpoint_info); auto root_part_struct = gucc::fs::Partition{.fstype = part_fs, .mountpoint = "/"s, .device = root_part, .mount_opts = mount_opts_info}; + const auto& root_part_uuid = gucc::fs::utils::get_device_uuid(root_part_struct.device); + root_part_struct.uuid_str = root_part_uuid; + // insert root partition partitions.emplace_back(std::move(root_part_struct)); @@ -1879,6 +1882,9 @@ void mount_partitions() noexcept { const auto& part_fs = gucc::fs::utils::get_mountpoint_fs(mountpoint_info); auto part_struct = gucc::fs::Partition{.fstype = part_fs, .mountpoint = mount_dev, .device = partition, .mount_opts = mount_opts_info}; + const auto& part_uuid = gucc::fs::utils::get_device_uuid(part_struct.device); + part_struct.uuid_str = part_uuid; + // insert root partition partitions.emplace_back(std::move(part_struct)); diff --git a/src/utils.cpp b/src/utils.cpp index 792ef0b..37a73d7 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -1083,7 +1083,7 @@ void install_refind() noexcept { const auto& part_fs = gucc::fs::utils::get_mountpoint_fs(mountpoint); auto root_part_struct = gucc::fs::Partition{.fstype = part_fs, .mountpoint = "/", .device = fmt::format(FMT_COMPILE("/dev/{}"), root_name)}; - const auto& root_part_uuid = gucc::utils::exec(fmt::format(FMT_COMPILE("lsblk -o UUID '{}' | awk 'NR==2'"), root_part_struct.device)); + const auto& root_part_uuid = gucc::fs::utils::get_device_uuid(root_part_struct.device); root_part_struct.uuid_str = root_part_uuid; const bool is_removable = (gucc::utils::exec(fmt::format(FMT_COMPILE("cat /sys/block/{}/removable"), root_device)) == "1"sv);