From 41350edf3eb08b2007a287b74b9f905fb9cb1f59 Mon Sep 17 00:00:00 2001 From: Wanjohi <71614375+wanjohiryan@users.noreply.github.com> Date: Fri, 29 Mar 2024 18:02:18 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(server):=20Add=20Nvidia=20gpu?= =?UTF-8?q?=20configuration=20script=20(#3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description **What(what issue does this code solve/what feature does it add):** Add a way to configure the Nvidia GPU, by installing the necessary packages for Proton to work. **How(how does it solve it):** We made a script `.scripts/gpu` when called like `gpu -c` it will install Vulkan and proprietry nvidia drivers. ## Required Checklist: - [ ] I have added any necessary documentation and comments in my code (where appropriate) - [ ] I have added tests to make sure my code runs in all contexts ## Further comments --- .github/workflows/server.yml | 2 ++ .scripts/gpu | 48 ++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 .scripts/gpu diff --git a/.github/workflows/server.yml b/.github/workflows/server.yml index 1f5b122c..bf21cb61 100644 --- a/.github/workflows/server.yml +++ b/.github/workflows/server.yml @@ -6,6 +6,7 @@ on: pull_request: paths: - "server.Dockerfile" + - ".scripts/**" - ".github/workflows/server.yml" schedule: - cron: 0 0 * * * # At the end of everyday @@ -13,6 +14,7 @@ on: branches: [main] paths: - "server.Dockerfile" + - ".scripts/**" - ".github/workflows/server.yml" tags: - v*.*.* diff --git a/.scripts/gpu b/.scripts/gpu new file mode 100644 index 00000000..2ae69586 --- /dev/null +++ b/.scripts/gpu @@ -0,0 +1,48 @@ +#!/bin/bash +# Version 0.0.1 + +#TODO: install nvidia vulkan drivers, or AMD/Intel Mesa drivers +#TODO: install dependencies for gpu-installer + +# https://aur.archlinux.org/packages/gpu-screen-recorder-git +# https://github.com/lutris/docs/blob/master/InstallingDrivers.md#amd--intel +# https://github.com/lutris/docs/blob/master/InstallingDrivers.md#nvidia + +# https://discourse.ubuntu.com/t/enabling-gpu-acceleration-on-ubuntu-on-wsl2-with-the-nvidia-cuda-platform/26604 + +xarg="$1" + +xnstll() { + if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root or via sudo!" + exit 1 + else + add-apt-repository ppa:graphics-drivers/ppa + dpkg --add-architecture i386 + apt update -y + apt upgrade -y + apt install -y nvidia-driver-535 libvulkan1 libvulkan1:i386 + rm -rf /var/lib/apt/lists/* + fi +} + +usage() { + echo -e "\n$(basename $0): ERROR - $*" 1>&2 + echo -e "\nusage: $(basename $0)\n [-c,--configure] \n \n (configure) install dependencies and configure your GPU \n \n" 1>&2 +} + +if [[ $# -lt 1 ]]; then + usage "one option required!" +else + case $xarg in + -c | --configure) + # install wine + xnstll + ;; + -* | \* | *) + # do_usage + usage "invalid option $1" + exit 1 + ;; + esac +fi