👷 simplify

This commit is contained in:
Vladislav Nepogodin 2022-02-24 02:34:46 +04:00
parent 833de6f064
commit efffe9e113
No known key found for this signature in database
GPG Key ID: B62C3D10C54D5DA9

View File

@ -45,41 +45,37 @@ bool exit_done() noexcept {
auto* config_instance = Config::instance();
auto& config_data = config_instance->data();
static constexpr auto CloseInstBody = "Close installer?";
const auto& mountpoint = std::get<std::string>(config_data["MOUNTPOINT"]);
const auto& target_mnt = fmt::format(FMT_COMPILE("findmnt --list -o TARGET | grep {} 2>/dev/null"), mountpoint);
static constexpr auto close_inst_body = "\nClose installer?\n";
const auto& mountpoint = std::get<std::string>(config_data["MOUNTPOINT"]);
const auto& target_mnt = fmt::format(FMT_COMPILE("findmnt --list -o TARGET | grep {} 2>/dev/null"), mountpoint);
if (!target_mnt.empty()) {
utils::final_check();
const auto& checklist = std::get<std::string>(config_data["CHECKLIST"]);
const auto& do_close = detail::yesno_widget(fmt::format(FMT_COMPILE("\n{}\n{}\n"), CloseInstBody, checklist), size(HEIGHT, LESS_THAN, 20) | size(WIDTH, LESS_THAN, 40));
const auto& do_close = detail::yesno_widget(fmt::format(FMT_COMPILE("{}{}\n"), close_inst_body, checklist), size(HEIGHT, LESS_THAN, 20) | size(WIDTH, LESS_THAN, 40));
/* clang-format off */
if (!do_close) { return false; }
/* clang-format on */
spdlog::info("exit installer.");
static constexpr auto LogInfo = "Would you like to save\nthe installation-log to the installed system?\nIt will be copied to\n";
static constexpr auto LogInfo = "Would you like to save\nthe installation-log\nto the installed system?\nIt will be copied to\n";
const auto& do_save_log = detail::yesno_widget(fmt::format(FMT_COMPILE("\n{} {}/cachyos-install.log\n"), LogInfo, mountpoint), size(HEIGHT, LESS_THAN, 20) | size(WIDTH, LESS_THAN, 40));
if (do_save_log) {
std::filesystem::copy_file("/tmp/cachyos-install.log", fmt::format(FMT_COMPILE("{}/cachyos-install.log"), mountpoint), fs::copy_options::overwrite_existing);
}
utils::umount_partitions();
utils::clear_screen();
return true;
} else {
const auto& do_close = detail::yesno_widget(fmt::format(FMT_COMPILE("\n{}\n"), CloseInstBody), size(HEIGHT, LESS_THAN, 10) | size(WIDTH, LESS_THAN, 40));
/* clang-format off */
if (!do_close) { return false; }
/* clang-format on */
utils::umount_partitions();
utils::clear_screen();
return true;
}
return false;
#else
return true;
const auto& do_close = detail::yesno_widget(close_inst_body, size(HEIGHT, LESS_THAN, 10) | size(WIDTH, LESS_THAN, 40));
/* clang-format off */
if (!do_close) { return false; }
/* clang-format on */
utils::umount_partitions();
utils::clear_screen();
#endif
return true;
}
void btrfs_subvolumes() noexcept {