From 98e5a7d0ae7f5a36ee6f96cb1cfcc5f90ba95a1f Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Thu, 10 Oct 2024 21:11:05 +0530 Subject: [PATCH 1/9] Add arch nvidia script --- core/tabs/system-setup/arch/nvidia-drivers.sh | 113 ++++++++++++++++++ core/tabs/system-setup/tab_data.toml | 7 ++ 2 files changed, 120 insertions(+) create mode 100755 core/tabs/system-setup/arch/nvidia-drivers.sh diff --git a/core/tabs/system-setup/arch/nvidia-drivers.sh b/core/tabs/system-setup/arch/nvidia-drivers.sh new file mode 100755 index 00000000..a6f2588b --- /dev/null +++ b/core/tabs/system-setup/arch/nvidia-drivers.sh @@ -0,0 +1,113 @@ +#!/bin/sh -e + +. ../../common-script.sh + +LIBVA_DIR="$HOME/linuxtoolbox/libva" + +installDeps() { + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm base-devel dkms ninja meson + + installed_kernels=$(pacman -Q | grep -E '^linux(| |-rt|-rt-lts|-hardened|-zen|-lts)[^-headers]' | cut -d ' ' -f 1) + + for kernel in $installed_kernels; do + header="${kernel}-headers" + printf "%b\n" "${CYAN}Installing headers for $kernel...${RC}" + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm "$header" + done + +} + +checkHardware() { + model=$(lspci -k | grep -A 2 -E "(VGA|3D)" | grep controller | cut -d ' ' -f 7 | cut -c 1-2 ) + case "$model" in + GM|GP|GV) return 1 ;; + TU|GA|AD) return 0 ;; + *) printf "%b\n" "${RED}Your hardware is not supported." && exit 1 ;; + esac +} + +promptUser() { + printf "%b" "Do you want to $1 ? [y/N]:" + read -r confirm + [ "$confirm" = "y" ] || [ "$confirm" = "Y" ] +} + +enableNvidiaModeset() { + PARAMETER="nvidia-drm.modeset=1" + + if grep -q "$PARAMETER" /etc/default/grub; then + printf "%b\n" "${YELLOW}NVIDIA modesetting is already enabled in GRUB.${RC}" + else + "$ESCALATION_TOOL" sed -i "/^GRUB_CMDLINE_LINUX_DEFAULT=/ s/\"$/ $PARAMETER\"/" /etc/default/grub + printf "%b\n" "${CYAN}Added $PARAMETER to /etc/default/grub.${RC}" + + "$ESCALATION_TOOL" grub-mkconfig -o /boot/grub/grub.cfg + fi +} + +setupHardwareAccelration() { + modeset=$("$ESCALATION_TOOL" cat /sys/module/nvidia_drm/parameters/modeset) + if [ ! "$modeset" = "Y" ]; then + enableNvidiaModeset + fi + + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm libva-nvidia-driver + + if pacman -Q | grep -q 'libva '; then + "$ESCALATION_TOOL" "$PACKAGER" -Rdd libva + fi + + mkdir -p "$HOME/linuxtoolbox" + if [ -d "$LIBVA_DIR" ]; then + rm -rf "$LIBVA_DIR" + fi + + printf "%b\n" "${YELLOW}Cloning libva from https://github.com/intel/libva in ${LIBVA_DIR}${RC}" + git clone https://github.com/intel/libva "$LIBVA_DIR" + + mkdir -p "$LIBVA_DIR/build" + cd "$LIBVA_DIR/build" && arch-meson .. -Dwith_legacy=nvctrl && ninja + "$ESCALATION_TOOL" ninja install + + "$ESCALATION_TOOL" sed -i '/^MOZ_DISABLE_RDD_SANDBOX/d' "/etc/environment" + "$ESCALATION_TOOL" sed -i '/^LIBVA_DRIVER_NAME/d' "/etc/environment" + + printf "LIBVA_DRIVER_NAME=nvidia\nMOZ_DISABLE_RDD_SANDBOX=1" | "$ESCALATION_TOOL" tee -a /etc/environment > /dev/null + + printf "%b\n" "${GREEN}Hardware Accelration setup completed successfully.${RC}" + + if promptUser "enable hardware accelration in mpv player"; then + if [ -f "$HOME/.config/mpv/mpv.conf" ];then + sed -i '/^hwdec/d' "$HOME/.config/mpv/mpv.conf" + fi + printf "hwdec=auto" | tee -a "$HOME/.config/mpv/mpv.conf" > /dev/null + printf "%b\n" "${GREEN}MPV Hardware Accelration enabled successfully.${RC}" + fi +} + +installDriver() { + if checkHardware && promptUser "install nvidia's open source drivers"; then + printf "%b\n" "${YELLOW}Installing nvidia open source driver...${RC}" + installDeps + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm nvidia-open-dkms + else + printf "%b\n" "${YELLOW}Installing nvidia proprietary driver...${RC}" + installDeps + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm nvidia-dkms + fi + + if echo "$XDG_CURRENT_DESKTOP" | grep -q "GNOME"; then + "$ESCALATION_TOOL" systemctl enable nvidia-suspend.service nvidia-hibernate.service nvidia-resume.service + fi + + printf "%b\n" "${GREEN}Driver installed successfully.${RC}" + if command_exists grub-mkconfig && promptUser "setup hardware accelration"; then + setupHardwareAccelration + fi + + printf "%b\n" "${GREEN}Please reboot your system for the changes to take effect.${RC}" +} + +checkEnv +checkEscalationTool +installDriver \ No newline at end of file diff --git a/core/tabs/system-setup/tab_data.toml b/core/tabs/system-setup/tab_data.toml index 080c06d9..80dcc33c 100644 --- a/core/tabs/system-setup/tab_data.toml +++ b/core/tabs/system-setup/tab_data.toml @@ -15,6 +15,13 @@ description = "This command installs a minimal arch server setup under 5 minutes script = "arch/server-setup.sh" task_list = "SI D" +[[data.entries]] +name = "Nvidia Drivers && Hardware Accelration" +description = "This script installs and configures nvidia drivers with Hardware Accelration" +script = "arch/nvidia-drivers.sh" +task_list = "I FM RP SS" + + [[data.entries]] name = "Paru AUR Helper" description = "Paru is your standard pacman wrapping AUR helper with lots of features and minimal interaction.\nTo know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers" From 641b30a07bc824c114f6dda39abf4ab60ff8db7c Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Thu, 10 Oct 2024 21:46:38 +0530 Subject: [PATCH 2/9] Update docs --- core/tabs/system-setup/tab_data.toml | 2 +- docs/userguide.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/tabs/system-setup/tab_data.toml b/core/tabs/system-setup/tab_data.toml index 80dcc33c..f35c272b 100644 --- a/core/tabs/system-setup/tab_data.toml +++ b/core/tabs/system-setup/tab_data.toml @@ -17,7 +17,7 @@ task_list = "SI D" [[data.entries]] name = "Nvidia Drivers && Hardware Accelration" -description = "This script installs and configures nvidia drivers with Hardware Accelration" +description = "This script installs and configures nvidia drivers with Hardware Accelration." script = "arch/nvidia-drivers.sh" task_list = "I FM RP SS" diff --git a/docs/userguide.md b/docs/userguide.md index 2b7ad82b..7010ae6e 100644 --- a/docs/userguide.md +++ b/docs/userguide.md @@ -101,6 +101,7 @@ For more information visit: https://christitus.com/linux-security-mistakes ### Arch Linux - **Arch Server Setup**: This command installs a minimal arch server setup under 5 minutes. +- **Nvidia Drivers && Hardware Accelration**: This script installs and configures nvidia drivers with Hardware Accelration. - **Paru AUR Helper**: Paru is your standard pacman wrapping AUR helper with lots of features and minimal interaction. To know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers - **Yay AUR Helper**: Yet Another Yogurt - An AUR Helper Written in Go. From 73248dea937cab38d36ba1d660bfdfe82fefbdbf Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Thu, 10 Oct 2024 21:50:30 +0530 Subject: [PATCH 3/9] Switch out hardcoded pacman --- core/tabs/system-setup/arch/nvidia-drivers.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/tabs/system-setup/arch/nvidia-drivers.sh b/core/tabs/system-setup/arch/nvidia-drivers.sh index a6f2588b..dcf85884 100755 --- a/core/tabs/system-setup/arch/nvidia-drivers.sh +++ b/core/tabs/system-setup/arch/nvidia-drivers.sh @@ -7,7 +7,7 @@ LIBVA_DIR="$HOME/linuxtoolbox/libva" installDeps() { "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm base-devel dkms ninja meson - installed_kernels=$(pacman -Q | grep -E '^linux(| |-rt|-rt-lts|-hardened|-zen|-lts)[^-headers]' | cut -d ' ' -f 1) + installed_kernels=$("$PACKAGER" -Q | grep -E '^linux(| |-rt|-rt-lts|-hardened|-zen|-lts)[^-headers]' | cut -d ' ' -f 1) for kernel in $installed_kernels; do header="${kernel}-headers" @@ -53,7 +53,7 @@ setupHardwareAccelration() { "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm libva-nvidia-driver - if pacman -Q | grep -q 'libva '; then + if "$PACKAGER" -Q | grep -q 'libva '; then "$ESCALATION_TOOL" "$PACKAGER" -Rdd libva fi From 2980eea0e6ed71069464843aac47cd0ae41736dd Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Thu, 10 Oct 2024 22:04:26 +0530 Subject: [PATCH 4/9] Stable libva --- core/tabs/system-setup/arch/nvidia-drivers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tabs/system-setup/arch/nvidia-drivers.sh b/core/tabs/system-setup/arch/nvidia-drivers.sh index dcf85884..401a3f91 100755 --- a/core/tabs/system-setup/arch/nvidia-drivers.sh +++ b/core/tabs/system-setup/arch/nvidia-drivers.sh @@ -63,7 +63,7 @@ setupHardwareAccelration() { fi printf "%b\n" "${YELLOW}Cloning libva from https://github.com/intel/libva in ${LIBVA_DIR}${RC}" - git clone https://github.com/intel/libva "$LIBVA_DIR" + git clone --branch=v2.22-branch --depth=1 https://github.com/intel/libva "$LIBVA_DIR" mkdir -p "$LIBVA_DIR/build" cd "$LIBVA_DIR/build" && arch-meson .. -Dwith_legacy=nvctrl && ninja From a27a21835e34a4ec7a8bf030f740a0d25f385240 Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Thu, 10 Oct 2024 22:14:41 +0530 Subject: [PATCH 5/9] Remove libva removal --- core/tabs/system-setup/arch/nvidia-drivers.sh | 4 ---- core/tabs/system-setup/tab_data.toml | 1 - 2 files changed, 5 deletions(-) diff --git a/core/tabs/system-setup/arch/nvidia-drivers.sh b/core/tabs/system-setup/arch/nvidia-drivers.sh index 401a3f91..2f573712 100755 --- a/core/tabs/system-setup/arch/nvidia-drivers.sh +++ b/core/tabs/system-setup/arch/nvidia-drivers.sh @@ -53,10 +53,6 @@ setupHardwareAccelration() { "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm libva-nvidia-driver - if "$PACKAGER" -Q | grep -q 'libva '; then - "$ESCALATION_TOOL" "$PACKAGER" -Rdd libva - fi - mkdir -p "$HOME/linuxtoolbox" if [ -d "$LIBVA_DIR" ]; then rm -rf "$LIBVA_DIR" diff --git a/core/tabs/system-setup/tab_data.toml b/core/tabs/system-setup/tab_data.toml index f35c272b..0ecf8ed1 100644 --- a/core/tabs/system-setup/tab_data.toml +++ b/core/tabs/system-setup/tab_data.toml @@ -21,7 +21,6 @@ description = "This script installs and configures nvidia drivers with Hardware script = "arch/nvidia-drivers.sh" task_list = "I FM RP SS" - [[data.entries]] name = "Paru AUR Helper" description = "Paru is your standard pacman wrapping AUR helper with lots of features and minimal interaction.\nTo know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers" From c111b07e1315f3821088d6cb36c8e4767f0f3d67 Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Thu, 10 Oct 2024 22:43:04 +0530 Subject: [PATCH 6/9] Typo formatting fixes, comments, remove service activations --- core/tabs/system-setup/arch/nvidia-drivers.sh | 28 ++++++++++--------- core/tabs/system-setup/tab_data.toml | 6 ++-- docs/userguide.md | 2 +- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/core/tabs/system-setup/arch/nvidia-drivers.sh b/core/tabs/system-setup/arch/nvidia-drivers.sh index 2f573712..30964fe2 100755 --- a/core/tabs/system-setup/arch/nvidia-drivers.sh +++ b/core/tabs/system-setup/arch/nvidia-drivers.sh @@ -14,15 +14,15 @@ installDeps() { printf "%b\n" "${CYAN}Installing headers for $kernel...${RC}" "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm "$header" done - } checkHardware() { + # Refer https://nouveau.freedesktop.org/CodeNames.html for model code names model=$(lspci -k | grep -A 2 -E "(VGA|3D)" | grep controller | cut -d ' ' -f 7 | cut -c 1-2 ) case "$model" in GM|GP|GV) return 1 ;; TU|GA|AD) return 0 ;; - *) printf "%b\n" "${RED}Your hardware is not supported." && exit 1 ;; + *) printf "%b\n" "${RED}Unsupported hardware." && exit 1 ;; esac } @@ -40,13 +40,18 @@ enableNvidiaModeset() { else "$ESCALATION_TOOL" sed -i "/^GRUB_CMDLINE_LINUX_DEFAULT=/ s/\"$/ $PARAMETER\"/" /etc/default/grub printf "%b\n" "${CYAN}Added $PARAMETER to /etc/default/grub.${RC}" - "$ESCALATION_TOOL" grub-mkconfig -o /boot/grub/grub.cfg fi } -setupHardwareAccelration() { +setupHardwareAcceleration() { + if ! command_exists grub-mkconfig; then + printf "%b\n" "${RED}Currently hardware acceleration is only available with GRUB.${RC}" + return; + fi + modeset=$("$ESCALATION_TOOL" cat /sys/module/nvidia_drm/parameters/modeset) + if [ ! "$modeset" = "Y" ]; then enableNvidiaModeset fi @@ -70,18 +75,19 @@ setupHardwareAccelration() { printf "LIBVA_DRIVER_NAME=nvidia\nMOZ_DISABLE_RDD_SANDBOX=1" | "$ESCALATION_TOOL" tee -a /etc/environment > /dev/null - printf "%b\n" "${GREEN}Hardware Accelration setup completed successfully.${RC}" + printf "%b\n" "${GREEN}Hardware Acceleration setup completed successfully.${RC}" - if promptUser "enable hardware accelration in mpv player"; then + if promptUser "enable hardware Acceleration in mpv player"; then if [ -f "$HOME/.config/mpv/mpv.conf" ];then sed -i '/^hwdec/d' "$HOME/.config/mpv/mpv.conf" fi printf "hwdec=auto" | tee -a "$HOME/.config/mpv/mpv.conf" > /dev/null - printf "%b\n" "${GREEN}MPV Hardware Accelration enabled successfully.${RC}" + printf "%b\n" "${GREEN}MPV Hardware Acceleration enabled successfully.${RC}" fi } installDriver() { + # Refer https://wiki.archlinux.org/title/NVIDIA for open-dkms or dkms driver selection if checkHardware && promptUser "install nvidia's open source drivers"; then printf "%b\n" "${YELLOW}Installing nvidia open source driver...${RC}" installDeps @@ -92,13 +98,9 @@ installDriver() { "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm nvidia-dkms fi - if echo "$XDG_CURRENT_DESKTOP" | grep -q "GNOME"; then - "$ESCALATION_TOOL" systemctl enable nvidia-suspend.service nvidia-hibernate.service nvidia-resume.service - fi - printf "%b\n" "${GREEN}Driver installed successfully.${RC}" - if command_exists grub-mkconfig && promptUser "setup hardware accelration"; then - setupHardwareAccelration + if promptUser "setup hardware Acceleration"; then + setupHardwareAcceleration fi printf "%b\n" "${GREEN}Please reboot your system for the changes to take effect.${RC}" diff --git a/core/tabs/system-setup/tab_data.toml b/core/tabs/system-setup/tab_data.toml index 0ecf8ed1..b237bbf4 100644 --- a/core/tabs/system-setup/tab_data.toml +++ b/core/tabs/system-setup/tab_data.toml @@ -16,10 +16,10 @@ script = "arch/server-setup.sh" task_list = "SI D" [[data.entries]] -name = "Nvidia Drivers && Hardware Accelration" -description = "This script installs and configures nvidia drivers with Hardware Accelration." +name = "Nvidia Drivers && Hardware Acceleration" +description = "This script installs and configures nvidia drivers with Hardware Acceleration." script = "arch/nvidia-drivers.sh" -task_list = "I FM RP SS" +task_list = "I FM" [[data.entries]] name = "Paru AUR Helper" diff --git a/docs/userguide.md b/docs/userguide.md index 7010ae6e..499681f1 100644 --- a/docs/userguide.md +++ b/docs/userguide.md @@ -101,7 +101,7 @@ For more information visit: https://christitus.com/linux-security-mistakes ### Arch Linux - **Arch Server Setup**: This command installs a minimal arch server setup under 5 minutes. -- **Nvidia Drivers && Hardware Accelration**: This script installs and configures nvidia drivers with Hardware Accelration. +- **Nvidia Drivers && Hardware Acceleration**: This script installs and configures nvidia drivers with Hardware Acceleration. - **Paru AUR Helper**: Paru is your standard pacman wrapping AUR helper with lots of features and minimal interaction. To know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers - **Yay AUR Helper**: Yet Another Yogurt - An AUR Helper Written in Go. From 6f89bca8d1f21e9ce1dcbea8963679bf51fd5b0c Mon Sep 17 00:00:00 2001 From: JEEVITHA KANNAN K S Date: Fri, 11 Oct 2024 09:39:59 +0530 Subject: [PATCH 7/9] Update caps --- core/tabs/system-setup/arch/nvidia-drivers.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/tabs/system-setup/arch/nvidia-drivers.sh b/core/tabs/system-setup/arch/nvidia-drivers.sh index 30964fe2..595c905b 100755 --- a/core/tabs/system-setup/arch/nvidia-drivers.sh +++ b/core/tabs/system-setup/arch/nvidia-drivers.sh @@ -77,7 +77,7 @@ setupHardwareAcceleration() { printf "%b\n" "${GREEN}Hardware Acceleration setup completed successfully.${RC}" - if promptUser "enable hardware Acceleration in mpv player"; then + if promptUser "enable Hardware Acceleration in MPV player"; then if [ -f "$HOME/.config/mpv/mpv.conf" ];then sed -i '/^hwdec/d' "$HOME/.config/mpv/mpv.conf" fi @@ -99,7 +99,7 @@ installDriver() { fi printf "%b\n" "${GREEN}Driver installed successfully.${RC}" - if promptUser "setup hardware Acceleration"; then + if promptUser "setup Hardware Acceleration"; then setupHardwareAcceleration fi From 1fe1bffe1f491d93ebbae5a5ad63d44ffe9f7fa9 Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Sat, 12 Oct 2024 10:49:02 +0530 Subject: [PATCH 8/9] Remove modeset and add preserve memory --- core/tabs/system-setup/arch/nvidia-drivers.sh | 14 ++++++-------- core/tabs/system-setup/tab_data.toml | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/core/tabs/system-setup/arch/nvidia-drivers.sh b/core/tabs/system-setup/arch/nvidia-drivers.sh index 595c905b..52cc6fe5 100755 --- a/core/tabs/system-setup/arch/nvidia-drivers.sh +++ b/core/tabs/system-setup/arch/nvidia-drivers.sh @@ -32,8 +32,8 @@ promptUser() { [ "$confirm" = "y" ] || [ "$confirm" = "Y" ] } -enableNvidiaModeset() { - PARAMETER="nvidia-drm.modeset=1" +setKernelParam() { + PARAMETER="$1" if grep -q "$PARAMETER" /etc/default/grub; then printf "%b\n" "${YELLOW}NVIDIA modesetting is already enabled in GRUB.${RC}" @@ -50,12 +50,6 @@ setupHardwareAcceleration() { return; fi - modeset=$("$ESCALATION_TOOL" cat /sys/module/nvidia_drm/parameters/modeset) - - if [ ! "$modeset" = "Y" ]; then - enableNvidiaModeset - fi - "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm libva-nvidia-driver mkdir -p "$HOME/linuxtoolbox" @@ -98,6 +92,10 @@ installDriver() { "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm nvidia-dkms fi + # Refer https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks#Preserve_video_memory_after_suspend + setKernelParam "nvidia.NVreg_PreserveVideoMemoryAllocations=1" + "$ESCALATION_TOOL" systemctl enable nvidia-suspend.service nvidia-hibernate.service nvidia-resume.service + printf "%b\n" "${GREEN}Driver installed successfully.${RC}" if promptUser "setup Hardware Acceleration"; then setupHardwareAcceleration diff --git a/core/tabs/system-setup/tab_data.toml b/core/tabs/system-setup/tab_data.toml index b237bbf4..88a79a17 100644 --- a/core/tabs/system-setup/tab_data.toml +++ b/core/tabs/system-setup/tab_data.toml @@ -19,7 +19,7 @@ task_list = "SI D" name = "Nvidia Drivers && Hardware Acceleration" description = "This script installs and configures nvidia drivers with Hardware Acceleration." script = "arch/nvidia-drivers.sh" -task_list = "I FM" +task_list = "I FM SS" [[data.entries]] name = "Paru AUR Helper" From e3e2ad0f37e589251d2cd9d29eb02748ce1da19b Mon Sep 17 00:00:00 2001 From: Jeevitha Kannan K S Date: Sat, 12 Oct 2024 15:18:24 +0530 Subject: [PATCH 9/9] Update model fetching --- core/tabs/system-setup/arch/nvidia-drivers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tabs/system-setup/arch/nvidia-drivers.sh b/core/tabs/system-setup/arch/nvidia-drivers.sh index 52cc6fe5..3c8b7c09 100755 --- a/core/tabs/system-setup/arch/nvidia-drivers.sh +++ b/core/tabs/system-setup/arch/nvidia-drivers.sh @@ -18,7 +18,7 @@ installDeps() { checkHardware() { # Refer https://nouveau.freedesktop.org/CodeNames.html for model code names - model=$(lspci -k | grep -A 2 -E "(VGA|3D)" | grep controller | cut -d ' ' -f 7 | cut -c 1-2 ) + model=$(lspci -k | grep -A 2 -E "(VGA|3D)" | grep NVIDIA | sed 's/.*Corporation //;s/ .*//' | cut -c 1-2) case "$model" in GM|GP|GV) return 1 ;; TU|GA|AD) return 0 ;;