mirror of
https://github.com/CachyOS/New-Cli-Installer.git
synced 2025-01-23 14:32:22 +08:00
👷 add interactive chroot menu option
This commit is contained in:
parent
5efa3b4c06
commit
a9b42495ea
26
src/tui.cpp
26
src/tui.cpp
@ -561,6 +561,26 @@ void rm_pgs() noexcept {
|
||||
#endif
|
||||
}
|
||||
|
||||
void chroot_interactive() noexcept {
|
||||
static constexpr auto chroot_return = "\nYou will now chroot into your installed system.\nYou can do changes almost as if you had booted into your installation.\n \nType \"exit\" to exit chroot.\n";
|
||||
detail::infobox_widget(chroot_return);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
|
||||
#ifdef NDEVENV
|
||||
auto* config_instance = Config::instance();
|
||||
auto& config_data = config_instance->data();
|
||||
const auto& mountpoint = std::get<std::string>(config_data["MOUNTPOINT"]);
|
||||
|
||||
utils::clear_screen();
|
||||
std::cout << '\0' << std::flush;
|
||||
const auto& cmd_formatted = fmt::format("arch-chroot {} bash", mountpoint);
|
||||
utils::exec(cmd_formatted, true);
|
||||
#else
|
||||
utils::clear_screen();
|
||||
utils::exec("bash", true);
|
||||
#endif
|
||||
}
|
||||
|
||||
void install_grub_uefi() noexcept {
|
||||
static constexpr auto content = "\nInstall UEFI Bootloader GRUB.\n";
|
||||
const auto& do_install_uefi = detail::yesno_widget(content, size(HEIGHT, LESS_THAN, 15) | size(WIDTH, LESS_THAN, 75));
|
||||
@ -1961,6 +1981,12 @@ void install_core_menu() noexcept {
|
||||
}
|
||||
// tweaks_menu
|
||||
break;
|
||||
case 7:
|
||||
if (!utils::check_base()) {
|
||||
screen.ExitLoopClosure()();
|
||||
}
|
||||
tui::chroot_interactive();
|
||||
break;
|
||||
default:
|
||||
screen.ExitLoopClosure()();
|
||||
break;
|
||||
|
@ -101,7 +101,7 @@ void arch_chroot(const std::string_view& command, bool follow) noexcept {
|
||||
auto& config_data = config_instance->data();
|
||||
|
||||
const auto& mountpoint = std::get<std::string>(config_data["MOUNTPOINT"]);
|
||||
const auto& cmd_formatted = fmt::format("arch-chroot {} \"{}\"", mountpoint, command);
|
||||
const auto& cmd_formatted = fmt::format("arch-chroot {} {}", mountpoint, command);
|
||||
if (follow) {
|
||||
tui::detail::follow_process_log_widget({"/bin/sh", "-c", cmd_formatted});
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user