👷 implement smth natively

This commit is contained in:
Vladislav Nepogodin 2023-12-14 21:31:44 +04:00
parent 877e86d9b4
commit f746a67be1
No known key found for this signature in database
GPG Key ID: B62C3D10C54D5DA9
2 changed files with 5 additions and 11 deletions

View File

@ -39,11 +39,9 @@ bool confirm_mount([[maybe_unused]] const std::string_view& part_user, bool quit
detail::infobox_widget("\nMount Successful!\n");
std::this_thread::sleep_for(std::chrono::seconds(2));
}
// TODO: reimplement natively
const auto& str = utils::make_multiline(partitions);
const auto& cmd = fmt::format(FMT_COMPILE("echo \"{0}\" | sed \"s~{1} [0-9]*[G-M]~~\" | sed \"s~{1} [0-9]*\\.[0-9]*[G-M]~~\" | sed s~{1}$' -'~~"), str, partition);
const auto& res_text = utils::exec(cmd);
partitions = utils::make_multiline(res_text);
// remove current mount from all partitions list
std::erase_if(partitions, [partition](std::string_view x) { return x.find(partition) != std::string_view::npos; });
number_partitions -= 1;
return true;
}

View File

@ -746,7 +746,7 @@ void bios_bootloader() {
if (selected_bootloader.empty()) { return; }
/* clang-format on */
selected_bootloader = utils::exec(fmt::format(FMT_COMPILE("echo \"{}\" | sed 's/+ \\|\"//g'"), selected_bootloader));
utils::remove_all(selected_bootloader, "+ ");
/* clang-format off */
if (!tui::select_device()) { return; }
@ -1224,12 +1224,8 @@ void make_swap() noexcept {
utils::exec(fmt::format(FMT_COMPILE("swapon {} &>/dev/null"), partition));
#endif
// TODO: reimplement natively
// Since a partition was used, remove that partition from the list
const auto& str = utils::make_multiline(partitions);
const auto& cmd = fmt::format(FMT_COMPILE("echo \"{0}\" | sed \"s~{1} [0-9]*[G-M]~~\" | sed \"s~{1} [0-9]*\\.[0-9]*[G-M]~~\" | sed s~{1}$' -'~~"), str, partition);
const auto& res_text = utils::exec(cmd);
partitions = utils::make_multiline(res_text);
std::erase_if(partitions, [partition](std::string_view x) { return x.find(partition) != std::string_view::npos; });
number_partitions -= 1;
}