chore(hardware-setup): Only retrieve GPU info once

This commit is contained in:
RJ Trujillo 2023-09-09 12:37:24 -06:00
parent aea93df97b
commit 451b39359d

View File

@ -25,6 +25,7 @@ fi
# GLOBAL
SYS_ID="$(cat /sys/devices/virtual/dmi/id/product_name)"
GPU_ID=$(lspci -k | grep -A 3 -E "(VGA|3D)")
KARGS=$(rpm-ostree kargs)
NEEDED_KARGS=""
echo "Current kargs: $KARGS"
@ -83,7 +84,7 @@ elif [[ $IMAGE_NAME =~ "deck" ]]; then
systemctl --global disable --now sdgyrodsu.service
fi
if grep -qz "Kernel driver in use: radeon" <<< $(lspci -k | grep -A 3 -E "(VGA|3D)"); then
if grep -qz "Kernel driver in use: radeon" <<< $GPU_ID; then
if [[ ! $KARGS =~ "radeon.si_support" ]]; then
NEEDED_KARGS="$NEEDED_KARGS --append=radeon.si_support=0"
fi
@ -99,7 +100,7 @@ if grep -qz "Kernel driver in use: radeon" <<< $(lspci -k | grep -A 3 -E "(VGA|3
if [[ ! $KARGS =~ "amdgpu.cik_support" ]]; then
NEEDED_KARGS="$NEEDED_KARGS --append=amdgpu.cik_support=1"
fi
elif grep -qvz "Kernel driver in use: amdgpu" <<< $(lspci -k | grep -A 3 -E "(VGA|3D)"); then
elif grep -qvz "Kernel driver in use: amdgpu" <<< $GPU_ID; then
if [[ $KARGS =~ "radeon.si_support" ]]; then
NEEDED_KARGS="$NEEDED_KARGS --delete=radeon.si_support=0"
fi