mirror of
https://github.com/CachyOS/New-Cli-Installer.git
synced 2025-01-23 14:32:22 +08:00
🚧 gucc: add helper function to get UUID of device/part
This commit is contained in:
parent
a905a9ebe7
commit
45ade9ed50
@ -12,6 +12,9 @@ auto get_mountpoint_fs(std::string_view mountpoint) noexcept -> std::string;
|
||||
// Get SOURCE of mountpoint
|
||||
auto get_mountpoint_source(std::string_view mountpoint) noexcept -> std::string;
|
||||
|
||||
// Get UUID of device/partition
|
||||
auto get_device_uuid(std::string_view device) noexcept -> std::string;
|
||||
|
||||
} // namespace gucc::fs::utils
|
||||
|
||||
#endif // FS_UTILS_HPP
|
||||
|
@ -16,4 +16,8 @@ auto get_mountpoint_source(std::string_view mountpoint) noexcept -> std::string
|
||||
return gucc::utils::exec(fmt::format(FMT_COMPILE("findmnt -ln -o SOURCE \"{}\""), mountpoint));
|
||||
}
|
||||
|
||||
auto get_device_uuid(std::string_view device) noexcept -> std::string {
|
||||
return gucc::utils::exec(fmt::format(FMT_COMPILE("lsblk -o UUID '{}' | awk 'NR==2'"), device));
|
||||
}
|
||||
|
||||
} // namespace gucc::fs::utils
|
||||
|
Loading…
Reference in New Issue
Block a user