change to case switches

This commit is contained in:
HikariKnight 2022-02-28 20:30:08 +01:00
parent 8faf631c96
commit 73739548a3
No known key found for this signature in database
GPG key ID: E8B239063B022F5A
2 changed files with 36 additions and 34 deletions

View file

@ -27,8 +27,8 @@ 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
if [[ ${YESNO} =~ [Yy]* ]];
then
case "${YESNO}" in
[Yy]*)
# Get the hardware ids from the selected group
local 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/")
@ -48,10 +48,11 @@ USB_CTL_ID=()
# Start setting up modules
exec "$SCRIPTDIR/lib/set_MODULES.sh" $GPU_DEVID
else
;;
*)
exec "$SCRIPTDIR/lib/get_GPU.sh"
fi
;;
esac
}
function main () {

View file

@ -22,18 +22,19 @@ To return to the previous page just press ENTER.
"
read -p "Do you want to use the displayed devices for passthrough? [y/N]: " YESNO
if [[ ${YESNO} =~ [Yy]* ]];
then
case "${YESNO}" in
[Yy]*)
# Get the PCI ids
local PCI_ID=$($SCRIPTDIR/utils/ls-iommu | grep -i "group $1" | cut -d " " -f 4 | perl -pe "s/\n/ /" | perl -pe "s/\s$//")
# Replace the blank USB_CTL_ID with the PCI_ID for the usb controller the user wants to pass through
perl -pi -e "s/USB_CTL_ID=\(\)/USB_CTL_ID=\($PCI_ID\)/" "$SCRIPTDIR/$QUICKEMU/qemu-vfio_vars.conf"
exec "$SCRIPTDIR/lib/set_CMDLINE.sh"
else
;;
*)
exec "$SCRIPTDIR/lib/get_USB_CTL.sh"
fi
;;
esac
}
function main () {