fix device labeling

This commit is contained in:
Ward Nakchbandi (Cosmic Fusion) 2023-07-01 16:49:05 +03:00
parent d860ce1847
commit cbe37794c4

View File

@ -2,7 +2,7 @@
if [[ $1 == "version" ]]
then
apt-cache show $2 | grep Version: | cut -d":" -f2 | head -n1
echo "Version: $(apt-cache show $2 | grep Version: | cut -d":" -f2 | head -n1)"
else
if [[ $1 == "description" ]]
then
@ -12,15 +12,26 @@ else
then
if echo "$2" | grep -i -E 'pika-rocm-meta|vulkan-amdgpu-pro|amf-amdgpu-pro|amdvlk|opencl-legacy-amdgpu-pro-icd|amdgpu-pro-oglp' &> /dev/null
then
echo "Device: $(lspci | grep -i -E 'vga|display|3d' | cut -d":" -f3 | grep -i AMD)"
DEVICE="$(lspci | grep -i -E 'vga|display|3d' | cut -d":" -f3 | grep -i AMD)"
else
if echo "$2" | grep -i -E 'xone' &> /dev/null
then
echo "Device: $(lsusb | grep -i xbox | cut -d":" -f3)"
DEVICE="$(lsusb | grep -i xbox | cut -d":" -f3)"
else
ubuntu-drivers devices | sed ':a;N;$!ba;s/\nmodel/ /g' | grep vendor | grep -i $2 | sed 's/vendor/Device:/'
if echo "$2" | grep -i -E 'nvidia' &> /dev/null
then
DEVICE="$(lspci | grep -i -E 'vga|display|3d' | cut -d":" -f3 | grep -i nvidia)"
else
DEVICE="$(ubuntu-drivers devices | sed ':a;N;$!ba;s/\nmodel/ /g' | grep vendor | grep -i $2 | sed 's/vendor/Device:/')"
fi
fi
fi
fi
if [[ ! -z $DEVICE ]]
then
echo "Device: $DEVICE"
else
echo "Device: UNKNOWN!"
fi
fi
fi