more linting and whitespace

This commit is contained in:
Phil 2022-03-04 02:08:10 +00:00
parent 7fe88321e6
commit 08e4da4575
6 changed files with 25 additions and 25 deletions

View file

@ -33,8 +33,8 @@ DO NOT use any of the files from $SCRIPTDIR/config !
}
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_GPU
}

View file

@ -45,7 +45,7 @@ USB_CTL_ID=()
# Get the GPU ROM
"$SCRIPTDIR/lib/get_GPU_ROM.sh" "$ROM_PCI_ID"
# Start setting up modules
exec "$SCRIPTDIR/lib/set_MODULES.sh" $GPU_DEVID
;;
@ -56,8 +56,8 @@ USB_CTL_ID=()
}
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
}

View file

@ -5,7 +5,7 @@ function get_GPU_ROM () {
# Get the config paths
source "$SCRIPTDIR/lib/paths.sh"
VBIOS_PATH=$(find /sys/devices -name rom | grep $1)
VBIOS_PATH=$(find /sys/devices -name rom | grep "$1")
printf "We will now attempt to dump the vbios of your selected GPU.
Passing a VBIOS rom to the card used for passthrough is required for some cards, but not all.
Some cards also requires you to patch your VBIOS romfile, check online if this is neccessary for your card.
@ -20,14 +20,14 @@ echo 0 | sudo tee $VBIOS_PATH
read -p "Do you want to dump the VBIOS, choosing N will skip this step [y/N]: " YESNO
case "${YESNO}" in
[Yy]*)
echo 1 | sudo tee $VBIOS_PATH
sudo cat $VBIOS_PATH > "$SCRIPTDIR/$QUICKEMU/vfio_card.rom"
sudo md5sum $VBIOS_PATH | cut -d " " -f 1 > "$SCRIPTDIR/$QUICKEMU/vfio_card.rom.md5"
local ROM_MD5=$(sudo md5sum $VBIOS_PATH | cut -d " " -f 1)
echo 0 | sudo tee $VBIOS_PATH
echo 1 | sudo tee "$VBIOS_PATH"
sudo cat "$VBIOS_PATH" > "$SCRIPTDIR/$QUICKEMU/vfio_card.rom"
sudo md5sum "$VBIOS_PATH" | cut -d " " -f 1 > "$SCRIPTDIR/$QUICKEMU/vfio_card.rom.md5"
local ROM_MD5=$(sudo md5sum "$VBIOS_PATH" | cut -d " " -f 1)
echo 0 | sudo tee "$VBIOS_PATH"
local ROMFILE_MD5=$(md5sum "$SCRIPTDIR/$QUICKEMU/vfio_card.rom" | cut -d " " -f 1)
if [ -f $SCRIPTDIR/$QUICKEMU/vfio_card.rom ];
if [ -f "$SCRIPTDIR"/$QUICKEMU/vfio_card.rom ];
then
if [ "$ROM_MD5" == "$ROMFILE_MD5" ];
then
@ -59,8 +59,8 @@ echo 0 | sudo tee $VBIOS_PATH
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_GPU_ROM $1
}

View file

@ -10,7 +10,7 @@ is only needed if you intend to use other devices than just mouse and keyboard w
"
echo "#------------------------------------------#"
exec "$SCRIPTDIR/utils/ls-iommu" | grep -i "usb controller" | cut -d " " -f 1-4,8-
echo "#------------------------------------------#"
echo "#------------------------------------------#"
printf "
Press q to quit
"
@ -31,7 +31,7 @@ Press q to quit
}
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_USB_CTL
}

View file

@ -14,7 +14,7 @@ if you do not know what you are doing.
echo "#------------------------------------------#"
exec "$SCRIPTDIR/utils/ls-iommu" | grep -i "group $1" | cut -d " " -f 1-4,8- | perl -pe "s/\[[0-9a-f]{4}\]: //"
echo "#------------------------------------------#"
printf "
To use any of the devices shown for passthrough, all of them have to be passed through
@ -26,7 +26,7 @@ To return to the previous page just press ENTER.
[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"
@ -38,8 +38,8 @@ To return to the previous page just press ENTER.
}
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_USB_CTL_GROUP $1
}

View file

@ -1,8 +1,8 @@
#!/bin/bash
# Get the scripts directory
SCRIPTDIR=$(dirname `which $0`)
cd $SCRIPTDIR
SCRIPTDIR=$(dirname "$(which $0)")
cd "$SCRIPTDIR"
# Get the config paths
source "$SCRIPTDIR/lib/paths.sh"
@ -41,11 +41,11 @@ A full documentation for debian/ubuntu systems can be found here: https://github
Press ENTER to continue once you have made a backup of your system.
"
read ENTER
clear
clear
printf "This script assumes a few things:
* You have already enabled IOMMU, VT-d and/or AMD-v inside your UEFI/BIOS advanced settings.
* You have already added \"$CMDLINE\" to your
* You have already added \"$CMDLINE\" to your
kernel boot arguments and booted your system with these kernel arguments active.
* You are comfortable with navigating and changing settings in your UEFI/BIOS.
* You know how edit your bootloader configuration and kernel arguments.
@ -113,7 +113,7 @@ then
else
touch "$SCRIPTDIR/$INITRAMFS"
fi
# Run ls-iommu so we can verify that IOMMU properly working
LS_IOMMU=$($SCRIPTDIR/utils/ls-iommu)