From 0ed5f1cc818a1ede19e31da62e31231209c084c3 Mon Sep 17 00:00:00 2001 From: Vladislav Nepogodin Date: Tue, 14 Jun 2022 04:01:40 +0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20update=20mounting=20step?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/misc.cpp | 11 ++++++----- src/misc.hpp | 2 +- src/tui.cpp | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/misc.cpp b/src/misc.cpp index 7cf17aa..87ab7a6 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -20,10 +20,10 @@ namespace fs = std::filesystem; namespace tui { // Revised to deal with partition sizes now being displayed to the user -bool confirm_mount([[maybe_unused]] const std::string_view& part_user) { +bool confirm_mount([[maybe_unused]] const std::string_view& part_user, bool quite) { #ifdef NDEVENV const auto& ret_status = utils::exec(fmt::format(FMT_COMPILE("mount | grep {}"), part_user), true); - if (ret_status != "0") { + if (!quite && (ret_status != "0")) { detail::infobox_widget("\nMount Failed!\n"); std::this_thread::sleep_for(std::chrono::seconds(2)); return false; @@ -35,9 +35,10 @@ bool confirm_mount([[maybe_unused]] const std::string_view& part_user) { auto& partitions = std::get>(config_data["PARTITIONS"]); auto& number_partitions = std::get(config_data["NUMBER_PARTITIONS"]); - detail::infobox_widget("\nMount Successful!\n"); - std::this_thread::sleep_for(std::chrono::seconds(2)); - + if (!quite) { + 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); diff --git a/src/misc.hpp b/src/misc.hpp index 557c71a..ab0fd82 100644 --- a/src/misc.hpp +++ b/src/misc.hpp @@ -4,7 +4,7 @@ #include // for string_view namespace tui { -bool confirm_mount([[maybe_unused]] const std::string_view& part_user); +bool confirm_mount([[maybe_unused]] const std::string_view& part_user, bool quite = false); void set_fsck_hook() noexcept; void set_cache() noexcept; void edit_configs() noexcept; diff --git a/src/tui.cpp b/src/tui.cpp index 55a17b3..6b5fa34 100644 --- a/src/tui.cpp +++ b/src/tui.cpp @@ -1099,7 +1099,7 @@ bool mount_current_partition(bool force) noexcept { #endif /* clang-format off */ - if (!force) { confirm_mount(fmt::format(FMT_COMPILE("{}{}"), mountpoint, mount_dev)); } + confirm_mount(fmt::format(FMT_COMPILE("{}{}"), mountpoint, mount_dev), force); /* clang-format on */ // Identify if mounted partition is type "crypt" (LUKS on LVM, or LUKS alone)