General cleanup and add missing quotes

This commit is contained in:
HikariKnight 2022-03-12 14:25:55 +01:00
parent 0cfea988e5
commit 8668c738c5
No known key found for this signature in database
GPG key ID: E8B239063B022F5A

View file

@ -24,32 +24,32 @@ To use any of these devices for passthrough ALL of them has to be passed through
To return to the previous page just press ENTER without typing in anything. To return to the previous page just press ENTER without typing in anything.
" "
read -p "Do you want to use these devices for passthrough? [y/N]: " YESNO read -r -p "Do you want to use these devices for passthrough? [y/N]: " YESNO
case "${YESNO}" in case "${YESNO}" in
[Yy]*) [Yy]*)
# Get the hardware ids from the selected group # Get the hardware ids from the selected group
local GPU_DEVID local GPU_DEVID
GPU_DEVID=$($SCRIPTDIR/utils/ls-iommu | grep -i "group $1" | perl -pe "s/.+\[([0-9a-f]{4}:[0-9a-f]{4})\].+/\1/" | perl -pe "s/\n/,/" | perl -pe "s/,$/\n/") GPU_DEVID=$("$SCRIPTDIR/utils/ls-iommu" | grep -i "group $1" | perl -pe "s/.+\[([0-9a-f]{4}:[0-9a-f]{4})\].+/\1/" | perl -pe "s/\n/,/" | perl -pe "s/,$/\n/")
# Get the PCI ids # Get the PCI ids
local PCI_ID local PCI_ID
PCI_ID=$($SCRIPTDIR/utils/ls-iommu | grep -i "group $1" | cut -d " " -f 4 | perl -pe "s/([0-9a-f]{2}:[0-9a-f]{2}.[0-9a-f]{1})\n/\"\1\" /" | perl -pe "s/\s$//") PCI_ID=$("$SCRIPTDIR/utils/ls-iommu" | grep -i "group $1" | cut -d " " -f 4 | perl -pe "s/([0-9a-f]{2}:[0-9a-f]{2}.[0-9a-f]{1})\n/\"\1\" /" | perl -pe "s/\s$//")
# Write the GPU_PCI_IDs to the config that quickemu might make use of in the future # Write the GPU_PCI_IDs to the config that quickemu might make use of in the future
printf "GPU_PCI_ID=($PCI_ID) echo "GPU_PCI_ID=($PCI_ID)
USB_CTL_ID=() USB_CTL_ID=()
" > "$SCRIPTDIR/$QUICKEMU/qemu-vfio_vars.conf" " > "$SCRIPTDIR/$QUICKEMU/qemu-vfio_vars.conf"
# Get the rom PCI_ID # Get the rom PCI_ID
local ROM_PCI_ID local ROM_PCI_ID
ROM_PCI_ID=$($SCRIPTDIR/utils/ls-iommu | grep -i "vga" | grep -i "group $1" | cut -d " " -f 4) ROM_PCI_ID=$("$SCRIPTDIR/utils/ls-iommu" | grep -i "vga" | grep -i "group $1" | cut -d " " -f 4)
# Get the GPU ROM # Get the GPU ROM
"$SCRIPTDIR/lib/get_GPU_ROM.sh" "$ROM_PCI_ID" "$SCRIPTDIR/lib/get_GPU_ROM.sh" "$ROM_PCI_ID"
# Start setting up modules # Start setting up modules
exec "$SCRIPTDIR/lib/set_INITRAMFSTOOLS.sh" $GPU_DEVID exec "$SCRIPTDIR/lib/set_INITRAMFSTOOLS.sh" "$GPU_DEVID"
;; ;;
*) *)
exec "$SCRIPTDIR/lib/get_GPU.sh" exec "$SCRIPTDIR/lib/get_GPU.sh"
@ -60,7 +60,7 @@ USB_CTL_ID=()
function main () { function main () {
SCRIPTDIR=$(dirname "$(which $0)" | perl -pe "s/\/\.\.\/lib//" | perl -pe "s/\/lib$//") SCRIPTDIR=$(dirname "$(which $0)" | perl -pe "s/\/\.\.\/lib//" | perl -pe "s/\/lib$//")
get_GROUP $1 get_GROUP "$1"
} }
main $1 main "$1"