From c32112e42e8d6d57897caff48f2e842b73445135 Mon Sep 17 00:00:00 2001 From: Vladislav Nepogodin Date: Mon, 10 Jan 2022 03:48:57 +0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20add=20x86=5F64=5Fv3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tui.cpp | 2 ++ src/utils.cpp | 25 +++++++++++++++++++++++++ src/utils.hpp | 2 ++ 3 files changed, 29 insertions(+) diff --git a/src/tui.cpp b/src/tui.cpp index 4caf73d..306162a 100644 --- a/src/tui.cpp +++ b/src/tui.cpp @@ -828,6 +828,8 @@ void install_base() noexcept { spdlog::info(fmt::format("Preparing for pkgs to install: \"{}\"", packages)); #ifdef NDEVENV + utils::try_v3(); + // filter_packages const auto& hostcache = std::get(config_data["hostcache"]); if (hostcache) { diff --git a/src/utils.cpp b/src/utils.cpp index 8d17181..9941216 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -632,6 +632,31 @@ void show_iwctl() noexcept { } } +void try_v3() noexcept { + const auto& ret_status = utils::exec("/lib/ld-linux-x86-64.so.2 --help | grep \"x86-64-v3 (supported, searched)\" > /dev/null", true); + if (ret_status != "0") { + spdlog::warn("x86-64-v3 is not supported"); + return; + } + spdlog::info("x86-64-v3 is supported"); + +#ifdef NDEVENV + static constexpr auto pacman_conf = "/etc/pacman.conf"; + static constexpr auto pacman_conf_cachyos = "/etc/pacman-more.conf"; + static constexpr auto pacman_conf_path_backup = "/etc/pacman.conf.bak"; + std::error_code err{}; + + utils::exec(fmt::format("sed -i 's/Architecture = auto/#Architecture = auto/' {}", pacman_conf_cachyos)); + utils::exec(fmt::format("sed -i 's/#//g' {}", pacman_conf_cachyos)); + + spdlog::info("backup old config"); + fs::rename(pacman_conf, pacman_conf_path_backup, err); + + spdlog::info("CachyOS -v3 Repo changed"); + fs::rename(pacman_conf_cachyos, pacman_conf, err); +#endif +} + void set_keymap() noexcept { auto* config_instance = Config::instance(); auto& config_data = config_instance->data(); diff --git a/src/utils.hpp b/src/utils.hpp index 6a336b6..2b378e9 100644 --- a/src/utils.hpp +++ b/src/utils.hpp @@ -38,6 +38,8 @@ void id_system() noexcept; [[nodiscard]] bool handle_connection() noexcept; void show_iwctl() noexcept; +void try_v3() noexcept; + void set_keymap() noexcept; void parse_config() noexcept; void setup_luks_keyfile() noexcept;