Script that detects and applies Xorg config for an eGPU
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
867 B

#! /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."