Add script and config file

This commit is contained in:
Quad 2022-03-18 20:30:58 +01:00
parent 0b4af34801
commit 418315aa36
2 changed files with 40 additions and 0 deletions

10
egpu.conf Normal file
View File

@ -0,0 +1,10 @@
Section "Device"
Identifier "Device0"
Driver "amdgpu"
BusID "PCI:06:00:0" # Edit to match the PCI address of your AMD GPU
EndSection
Section "Module"
# Loading this allows offloading to the Intel GPU if you for some reason want that
Load "modesetting"
EndSection

30
egpu.sh Normal file
View File

@ -0,0 +1,30 @@
#! /usr/bin/bash
##
#
# Update EGPU_NAME to a string which can be used to find your eGPU via lspci.
# If EGPU_NAME is found in the output of lspci, CONFIG_FILE will be copied to TARGET_FILE.
# If it is not found, it will delete TARGET_FILE. So keep that in mind to make sure it does not delete any important config file.
# Ensure the paths in both of those variables look correct.
#
##
EGPU_NAME="Example string"
CONFIG_FILE="/opt/config/egpu.conf"
TARGET_FILE="/etc/X11/xorg.conf.d/egpu.conf"
SCRIPT_NAME="eGPU script"
echo "${SCRIPT_NAME}: Checking for GPU..."
EGPU_DETECTION=`lspci | grep "$EGPU_NAME"`
if [ -z "${EGPU_DETECTION}" ]; then
echo "${SCRIPT_NAME}: No GPU found, clearing config..."
rm -f $TARGET_FILE
else
echo "${SCRIPT_NAME}: GPU found, setting as main gpu..."
cp $CONFIG_FILE $TARGET_FILE
fi
echo "${SCRIPT_NAME}: Done, proceeding."