👷 properly detect uuid of partitions during init

This commit is contained in:
Vladislav Nepogodin 2024-07-28 20:05:55 +04:00
parent 45ade9ed50
commit 1673f81d37
No known key found for this signature in database
GPG Key ID: B62C3D10C54D5DA9
2 changed files with 7 additions and 1 deletions

View File

@ -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));

View File

@ -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);