add directory paths into a config file

This commit is contained in:
HikariKnight 2022-02-27 17:18:59 +01:00
parent 3b6f09ab59
commit 6b773a22e2
No known key found for this signature in database
GPG key ID: E8B239063B022F5A
4 changed files with 74 additions and 16 deletions

View file

@ -2,6 +2,9 @@
function get_GROUP () {
clear
# Get the config paths
source "$SCRIPTDIR/lib/paths.sh"
printf "
For this card to be passthrough-able, it must contain only:
* The GPU/Graphic card
@ -27,18 +30,18 @@ read -p "Enter the ids for all devices you want to passthrough: " GPU_DEVID
if [[ $GPU_DEVID =~ : ]];
then
# Make the directory
mkdir "$SCRIPTDIR/config"
# Get the PCI ids
PCI_ID=$($SCRIPTDIR/utils/ls-iommu | grep -i "group $1" | cut -d " " -f 4 | perl -pe "s/\n/ /" | perl -pe "s/\s$//")
echo "# This is an autogenerated file that stubs your graphic card for use with vfio" > "$SCRIPTDIR/config/vfio.conf"
echo "options vfio_pci ids=$GPU_DEVID" >> "$SCRIPTDIR/config/vfio.conf"
echo "GPU_PCI_ID=($PCI_ID)" > "$SCRIPTDIR/config/qemu-vfio_vars.conf"
echo "USB_CTL_ID=\"\"" >> "$SCRIPTDIR/config/qemu-vfio_vars.conf"
local PCI_ID=$($SCRIPTDIR/utils/ls-iommu | grep -i "group $1" | cut -d " " -f 4 | perl -pe "s/\n/ /" | perl -pe "s/\s$//")
exec "$SCRIPTDIR/lib/get_USB_CTL.sh"
# Write the currently unused vfio config for quickemu
printf "GPU_PCI_ID=($PCI_ID)
USB_CTL_ID=\"\"" > "$SCRIPTDIR/$QUICKEMU/qemu-vfio_vars.conf"
# Get the PCI_ID
local ROM_PCI_ID=$($SCRIPTDIR/utils/ls-iommu | grep -i "vga" | grep -i "group $1" | cut -d " " -f 4)
"$SCRIPTDIR/lib/get_GPU_ROM.sh" "$ROM_PCI_ID"
exec "$SCRIPTDIR/lib/set_MODULES.sh" $GPU_DEVID
else
exec "$SCRIPTDIR/lib/get_GPU.sh"
fi
@ -46,8 +49,9 @@ fi
}
function main () {
SCRIPTDIR=$(dirname `which $0`)
SCRIPTDIR=$(dirname `which $0` | perl -pe "s/\/\.\.\/lib//")
SCRIPTDIR="$SCRIPTDIR/.."
get_GROUP $1
}