mirror of
https://github.com/CachyOS/New-Cli-Installer.git
synced 2025-01-23 22:42:31 +08:00
👷 add ability to edit pacman config from UI
This commit is contained in:
parent
d8ba5238e6
commit
3131a44da1
@ -80,10 +80,9 @@ Main Menu
|
||||
| ├── LUKS Encryption
|
||||
| ├── Logical Volume Management (WIP)
|
||||
| ├── Mount Partitions
|
||||
| ├── Configure Installer Mirrorlist (TODO)
|
||||
| ├── Configure Installer Mirrorlist
|
||||
| | ├── Edit Pacman Configuration
|
||||
| | ├── Edit Pacman Mirror Configuration
|
||||
| | └── Rank Mirrors by Speed
|
||||
| | └── Rank Mirrors by Speed (TODO)
|
||||
| |
|
||||
│ └── Refresh Pacman Keys
|
||||
|
|
||||
|
10
src/misc.cpp
10
src/misc.cpp
@ -201,6 +201,16 @@ void edit_configs() noexcept {
|
||||
detail::menu_widget(menu_entries, ok_callback, &selected, &screen, seeconf_body, {content_size, size(HEIGHT, GREATER_THAN, 1)});
|
||||
}
|
||||
|
||||
void edit_pacman_conf() noexcept {
|
||||
utils::exec("vim /etc/pacman.conf", true);
|
||||
|
||||
#ifdef NDEVENV
|
||||
// NOTE: don't care now, Will change in future..
|
||||
detail::infobox_widget("\nUpdating database ...\n");
|
||||
utils::exec("pacman -Syy", true);
|
||||
#endif
|
||||
}
|
||||
|
||||
void logs_menu() noexcept {
|
||||
#ifdef NDEVENV
|
||||
auto* config_instance = Config::instance();
|
||||
|
@ -8,6 +8,7 @@ bool confirm_mount([[maybe_unused]] const std::string_view& part_user);
|
||||
void set_fsck_hook() noexcept;
|
||||
void set_cache() noexcept;
|
||||
void edit_configs() noexcept;
|
||||
void edit_pacman_conf() noexcept;
|
||||
void logs_menu() noexcept;
|
||||
} // namespace tui
|
||||
|
||||
|
33
src/tui.cpp
33
src/tui.cpp
@ -1974,6 +1974,35 @@ void mount_partitions() noexcept {
|
||||
}
|
||||
}
|
||||
|
||||
void configure_mirrorlist() noexcept {
|
||||
const std::vector<std::string> menu_entries = {
|
||||
"Edit Pacman Configuration",
|
||||
"Rank mirrors by speed",
|
||||
"Back",
|
||||
};
|
||||
|
||||
auto screen = ScreenInteractive::Fullscreen();
|
||||
std::int32_t selected{};
|
||||
auto ok_callback = [&] {
|
||||
switch (selected) {
|
||||
case 0:
|
||||
screen.Suspend();
|
||||
tui::edit_pacman_conf();
|
||||
screen.Resume();
|
||||
break;
|
||||
case 1:
|
||||
SPDLOG_ERROR("Implement me!");
|
||||
break;
|
||||
default:
|
||||
screen.ExitLoopClosure()();
|
||||
break;
|
||||
}
|
||||
};
|
||||
static constexpr auto mirrorlist_body = "\nThe pacman configuration file can be edited\nto enable multilib and other repositories.\n";
|
||||
const auto& content_size = size(HEIGHT, LESS_THAN, 10) | size(WIDTH, GREATER_THAN, 40);
|
||||
detail::menu_widget(menu_entries, ok_callback, &selected, &screen, mirrorlist_body, {size(HEIGHT, LESS_THAN, 3), content_size});
|
||||
}
|
||||
|
||||
void create_partitions() noexcept {
|
||||
static constexpr std::string_view optwipe = "Securely Wipe Device (optional)";
|
||||
static constexpr std::string_view optauto = "Automatic Partitioning";
|
||||
@ -2215,9 +2244,11 @@ void prep_menu() noexcept {
|
||||
case 3:
|
||||
case 4:
|
||||
case 6:
|
||||
case 8:
|
||||
SPDLOG_ERROR("Implement me!");
|
||||
break;
|
||||
case 8:
|
||||
tui::configure_mirrorlist();
|
||||
break;
|
||||
case 9:
|
||||
#ifdef NDEVENV
|
||||
utils::arch_chroot("pacman-key --init;pacman-key --populate archlinux cachyos;pacman-key --refresh-keys;");
|
||||
|
Loading…
Reference in New Issue
Block a user