30 lines
724 B
Bash
30 lines
724 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
# . CONFIG.sh
|
||
|
|
||
|
# set -o xtrace ## To debug scripts
|
||
|
# set -o errexit ## To exit on error
|
||
|
# set -o errunset ## To exit if a variable is referenced but not set
|
||
|
|
||
|
|
||
|
function main() {
|
||
|
SCRIPTPATH="$( cd "$(dirname "")" >/dev/null 2>&1 ; pwd -P )"
|
||
|
cd "${SCRIPTPATH}"
|
||
|
echo "Working Dir: " $(pwd)
|
||
|
|
||
|
|
||
|
for i in /sys/bus/pci/devices/*/boot_vga; do
|
||
|
if [ $(cat "$i") -eq 0 ]; then
|
||
|
GPU="${i%/boot_vga}"
|
||
|
AUDIO="$(echo "$GPU" | sed -e "s/0$/1/")"
|
||
|
echo "vfio-pci" > "$GPU/driver_override"
|
||
|
if [ -d "$AUDIO" ]; then
|
||
|
echo "vfio-pci" > "$AUDIO/driver_override"
|
||
|
fi
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
modprobe -i vfio-pci
|
||
|
}
|
||
|
main $@;
|