From cadf56ae69a2881067ad116adf7b6d39a1d0ca7f Mon Sep 17 00:00:00 2001 From: Christoph Hummer Date: Sat, 18 Jan 2025 11:19:14 +0100 Subject: [PATCH] 02 - nvidia.sh aktualisiert --- 02 - nvidia.sh | 55 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 18 deletions(-) diff --git a/02 - nvidia.sh b/02 - nvidia.sh index 150033d..762f7c5 100644 --- a/02 - nvidia.sh +++ b/02 - nvidia.sh @@ -1,5 +1,16 @@ # This script has to be executed manually as root with reboots in between +if [ -z "${1}" ]; then + LAT_VERSIONS="$(wget -qO- https://www.nvidia.com/en-us/drivers/unix/ | tidy -quiet -wrap 4096 2>/dev/null | grep -A8 "Linux x86_64/AMD64/EM64T" | grep -e "Latest Production Branch" -e "Latest New Feature Branch" -e "Latest Beta Version")" + NV_LAT="$(echo "$LAT_VERSIONS" | grep "Latest Production Branch" | cut -d '>' -f4 | cut -d '<' -f1)" + NV_NFB="$(echo "$LAT_VERSIONS" | grep "Latest New Feature Branch" | cut -d '>' -f4 | cut -d '<' -f1)" + NV_BETA="$(echo "$LAT_VERSIONS" | grep "Latest Beta Version" | cut -d '>' -f4 | cut -d '<' -f1)" + echo -e "Available versions:\n---------------------------------\n" + echo -e "Production Branch (prb): ${NV_LAT}\nNew Feature Branch (nfb): ${NV_NFB}\nBeta Branch (beta): ${NV_BETA}" + echo -e "\nPlease use the sciprt with: ./nvidia.sh \n ./nvidia.sh nfb" + exit 0 +fi + if [ ! -d ~/nvidia ]; then # Make sure that i386 architecture is available dpkg --add-architecture i386 @@ -9,30 +20,37 @@ if [ ! -d ~/nvidia ]; then apt-get -y autoremove apt-get -y install linux-headers-$(uname -r) build-essential libglvnd-dev pkg-config tidy mkdir -p ~/nvidia && cd ~/nvidia - if [ -z "$1" ]; then - NV_DRV_V="$(wget -qO- https://github.com/ich777/versions/raw/master/nvidia_versions | grep "CUR_PRB=" | cut -d '=' -f2)" + LAT_VERSIONS="$(wget -qO- https://www.nvidia.com/en-us/drivers/unix/ | tidy -quiet -wrap 4096 2>/dev/null | grep -A8 "Linux x86_64/AMD64/EM64T" | grep -e "Latest Production Branch" -e "Latest New Feature Branch" -e "Latest Beta Version")" + if [ -z "${LAT_VERSIONS}" ]; then + echo "ERROR: Something went wrong while grabbing the latest driver versions! Abort!" + rm -rf ~/nvidia + exit 1 + fi + if [ "$1" == "prb" ]; then + NV_DRV_V="$(echo "$LAT_VERSIONS" | grep "Latest Production Branch" | cut -d '>' -f4 | cut -d '<' -f1)" + elif [ "$1" == "nfb" ]; then + NV_DRV_V="$(echo "$LAT_VERSIONS" | grep "Latest New Feature Branch" | cut -d '>' -f4 | cut -d '<' -f1)" + elif [ "$1" == "beta" ]; then + NV_DRV_V="$(echo "$LAT_VERSIONS" | grep "Latest Beta Version" | cut -d '>' -f4 | cut -d '<' -f1)" else - LAT_VERSIONS="$(wget -qO- https://www.nvidia.com/en-us/drivers/unix/ | tidy -quiet -wrap 4096 2>/dev/null | grep -A8 "Linux x86_64/AMD64/EM64T" | grep -e "Latest Production Branch" -e "Latest New Feature Branch" -e "Latest Beta Version")" - if [ "$1" == "latest" ]; then - NV_DRV_V="$(echo "$LAT_VERSIONS" | grep "Latest Production Branch" | cut -d '>' -f4 | cut -d '<' -f1)" - elif [ "$1" == "nfb" ]; then - NV_DRV_V="$(echo "$LAT_VERSIONS" | grep "Latest New Feature Branch" | cut -d '>' -f4 | cut -d '<' -f1)" - elif [ "$1" == "beta" ]; then - NV_DRV_V="$(echo "$LAT_VERSIONS" | grep "Latest Beta Version" | cut -d '>' -f4 | cut -d '<' -f1)" - else - echo "$1 is not a valid option, valid options are:" - echo - echo "latest = Latest Production branch" - echo "nfb = Latest New Feature branch" - echo "beta = Latest Beta branch" - exit 1 - fi + echo "ERROR: \"$1\" is not a valid option, valid options are:" + echo + echo -e "prb = Latest Production branch\nnfb = Latest New Feature branch\nbeta = Latest Beta branch" + rm -rf ~/nvidia + exit 1 fi if [ -z "${NV_DRV_V}" ]; then echo "Error: Something went wrong while fetching driver version!" + rm -rf ~/nvidia exit 1 fi wget http://download.nvidia.com/XFree86/Linux-x86_64/${NV_DRV_V}/NVIDIA-Linux-x86_64-${NV_DRV_V}.run + EXIT_STATUS=$? + if [ "${EXIT_STATUS}" != "0" ]; then + echo "ERROR: something went wrong with the download! Abort!" + rm -rf ~/nvidia + exit 1 + fi chmod +x NVIDIA-Linux-x86_64-${NV_DRV_V}.run echo "blacklist nouveau options nouveau modeset=0" > /etc/modprobe.d/blacklist-nouveau.conf @@ -55,10 +73,11 @@ cd ~/nvidia --install-compat32-libs \ --silent +# At the installer select "Yes" at "Install 32-bit compatibility libraries" systemctl set-default graphical.target rm -rf ~/nvidia # If running a Secure Boot environment then you have to enroll the key: # mokutil --import /usr/share/nvidia/.der -reboot now \ No newline at end of file +reboot now