mirror of
https://github.com/CachyOS/New-Cli-Installer.git
synced 2025-02-02 22:07:13 +08:00
🚧 drivers: use literals where possible
This commit is contained in:
parent
d9edacc85c
commit
23e95bd0e5
@ -15,6 +15,7 @@
|
|||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
using namespace std::string_view_literals;
|
||||||
|
|
||||||
#ifdef NDEVENV
|
#ifdef NDEVENV
|
||||||
#include "follow_process_log.hpp"
|
#include "follow_process_log.hpp"
|
||||||
@ -34,7 +35,7 @@ static void install_ati() noexcept {
|
|||||||
|
|
||||||
#ifdef NDEVENV
|
#ifdef NDEVENV
|
||||||
static void install_all_drivers() noexcept {
|
static void install_all_drivers() noexcept {
|
||||||
static constexpr auto packages = "xf86-input-libinput xf86-video-fbdev xf86-video-vesa xf86-video-amdgpu xf86-video-ati xf86-video-intel xf86-video-nouveau";
|
static constexpr auto packages = "xf86-input-libinput xf86-video-fbdev xf86-video-vesa xf86-video-amdgpu xf86-video-ati xf86-video-intel xf86-video-nouveau"sv;
|
||||||
|
|
||||||
auto* config_instance = Config::instance();
|
auto* config_instance = Config::instance();
|
||||||
auto& config_data = config_instance->data();
|
auto& config_data = config_instance->data();
|
||||||
@ -54,8 +55,8 @@ static void setup_graphics_card() noexcept {
|
|||||||
|
|
||||||
/// TODO(vnepogodin): parse toml DBs
|
/// TODO(vnepogodin): parse toml DBs
|
||||||
{
|
{
|
||||||
static constexpr auto UseSpaceBar = "\nUse [Spacebar] to de/select options listed.\n";
|
static constexpr auto UseSpaceBar = "\nUse [Spacebar] to de/select options listed.\n"sv;
|
||||||
const auto& profile_names = ::detail::chwd::get_available_profile_names("graphic_drivers");
|
const auto& profile_names = ::detail::chwd::get_available_profile_names("graphic_drivers"sv);
|
||||||
if (!profile_names.has_value()) {
|
if (!profile_names.has_value()) {
|
||||||
spdlog::error("failed to get profile names");
|
spdlog::error("failed to get profile names");
|
||||||
return;
|
return;
|
||||||
@ -86,13 +87,13 @@ static void setup_graphics_card() noexcept {
|
|||||||
std::ofstream{fmt::format(FMT_COMPILE("{}/.video_installed"), mountpoint)};
|
std::ofstream{fmt::format(FMT_COMPILE("{}/.video_installed"), mountpoint)};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
graphics_card = utils::exec("lspci | grep -i \"vga\" | sed 's/.*://' | sed 's/(.*//' | sed 's/^[ \\t]*//'");
|
graphics_card = utils::exec("lspci | grep -i \"vga\" | sed 's/.*://' | sed 's/(.*//' | sed 's/^[ \\t]*//'"sv);
|
||||||
|
|
||||||
// All non-NVIDIA cards / virtualization
|
// All non-NVIDIA cards / virtualization
|
||||||
if (!(utils::exec(fmt::format(FMT_COMPILE("echo \"{}\" | grep -i 'ati'"), graphics_card)).empty())) {
|
if (!(utils::exec(fmt::format(FMT_COMPILE("echo \"{}\" | grep -i 'ati'"), graphics_card)).empty())) {
|
||||||
install_ati();
|
install_ati();
|
||||||
#ifdef NDEVENV
|
#ifdef NDEVENV
|
||||||
} else if (driver == "video-nouveau") {
|
} else if (driver == "video-nouveau"sv) {
|
||||||
utils::exec(fmt::format(FMT_COMPILE("sed -i 's/MODULES=\"\"/MODULES=\"nouveau\"/' {}/etc/mkinitcpio.conf"), mountpoint));
|
utils::exec(fmt::format(FMT_COMPILE("sed -i 's/MODULES=\"\"/MODULES=\"nouveau\"/' {}/etc/mkinitcpio.conf"), mountpoint));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -117,11 +118,11 @@ static void install_graphics_menu() noexcept {
|
|||||||
switch (selected) {
|
switch (selected) {
|
||||||
#ifdef NDEVENV
|
#ifdef NDEVENV
|
||||||
case 0:
|
case 0:
|
||||||
utils::arch_chroot("chwd -a pci free 0300");
|
utils::arch_chroot("chwd -a pci free 0300"sv);
|
||||||
std::ofstream{fmt::format(FMT_COMPILE("{}/.video_installed"), mountpoint)};
|
std::ofstream{fmt::format(FMT_COMPILE("{}/.video_installed"), mountpoint)};
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
utils::arch_chroot("chwd -a pci nonfree 0300");
|
utils::arch_chroot("chwd -a pci nonfree 0300"sv);
|
||||||
std::ofstream{fmt::format(FMT_COMPILE("{}/.video_installed"), mountpoint)};
|
std::ofstream{fmt::format(FMT_COMPILE("{}/.video_installed"), mountpoint)};
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user