mirror of
https://github.com/CachyOS/New-Cli-Installer.git
synced 2025-01-23 14:32:22 +08:00
🧹 utils: refactor to use utils::exec_checked
This commit is contained in:
parent
66890213bd
commit
c0360efac7
@ -1385,7 +1385,7 @@ void get_cryptroot() noexcept {
|
|||||||
|
|
||||||
const auto& check_cryptparts = [&luks_name](const auto& cryptparts, auto functor) {
|
const auto& check_cryptparts = [&luks_name](const auto& cryptparts, auto functor) {
|
||||||
for (const auto& cryptpart : cryptparts) {
|
for (const auto& cryptpart : cryptparts) {
|
||||||
if (!gucc::utils::exec(fmt::format(FMT_COMPILE("lsblk -lno NAME {} | grep '{}'"), cryptpart, luks_name)).empty()) {
|
if (gucc::utils::exec_checked(fmt::format(FMT_COMPILE("lsblk -lno NAME {} | grep -q '{}'"), cryptpart, luks_name))) {
|
||||||
functor(cryptpart);
|
functor(cryptpart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1495,7 +1495,7 @@ void boot_encrypted_setting() noexcept {
|
|||||||
auto& fde = std::get<std::int32_t>(config_data["fde"]);
|
auto& fde = std::get<std::int32_t>(config_data["fde"]);
|
||||||
|
|
||||||
// Check if there is separate /boot partition
|
// Check if there is separate /boot partition
|
||||||
if (gucc::utils::exec("lsblk | grep '/mnt/boot$'").empty()) {
|
if (!gucc::utils::exec_checked("lsblk | grep -q '/mnt/boot$'")) {
|
||||||
// There is no separate /boot parition
|
// There is no separate /boot parition
|
||||||
const auto& root_name = gucc::utils::exec("mount | awk '/\\/mnt / {print $1}' | sed s~/dev/mapper/~~g | sed s~/dev/~~g");
|
const auto& root_name = gucc::utils::exec("mount | awk '/\\/mnt / {print $1}' | sed s~/dev/mapper/~~g | sed s~/dev/~~g");
|
||||||
const auto& luks = std::get<std::int32_t>(config_data["LUKS"]);
|
const auto& luks = std::get<std::int32_t>(config_data["LUKS"]);
|
||||||
|
Loading…
Reference in New Issue
Block a user