big shellcheck cleanup and disabling the shellchecks we will ignore

This commit is contained in:
HikariKnight 2022-03-13 12:53:13 +01:00
parent f90e35f647
commit 6e0fd90dd7
No known key found for this signature in database
GPG key ID: E8B239063B022F5A
13 changed files with 31 additions and 14 deletions

View file

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
# shellcheck disable=SC1091
function make_BACKUP () { function make_BACKUP () {
local BACKUPDIR local BACKUPDIR
@ -127,7 +128,7 @@ unless a backup already exist.
Then the files above will be copied to your system followed by running followed by updating your Then the files above will be copied to your system followed by running followed by updating your
initramfs and then attempt adding new kernel arguments to your bootloader." initramfs and then attempt adding new kernel arguments to your bootloader."
read -p "Do you want to proceed with the installation of the files? (no=quit) [Y/n]: " YESNO read -r -p "Do you want to proceed with the installation of the files? (no=quit) [Y/n]: " YESNO
case "${YESNO}" in case "${YESNO}" in
[Nn]*) [Nn]*)

View file

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
# shellcheck disable=SC1091
function get_GPU_GROUP () { function get_GPU_GROUP () {
clear clear

View file

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
# shellcheck disable=SC1091,SC2024
function get_GPU_ROM () { function get_GPU_ROM () {
clear clear

View file

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
# shellcheck disable=SC1091
function get_USB_CTL_GROUP () { function get_USB_CTL_GROUP () {
clear clear
@ -26,7 +27,7 @@ To return to the previous page just press ENTER.
[Yy]*) [Yy]*)
# 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$//")
# Replace the blank USB_CTL_ID with the PCI_ID for the usb controller the user wants to pass through # 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" perl -pi -e "s/USB_CTL_ID=\(\)/USB_CTL_ID=\($PCI_ID\)/" "$SCRIPTDIR/$QUICKEMU/qemu-vfio_vars.conf"

View file

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
# shellcheck disable=SC2034
MODPROBE="config/etc/modprobe.d" MODPROBE="config/etc/modprobe.d"
INITRAMFS="config/etc/initramfs-tools" INITRAMFS="config/etc/initramfs-tools"
ETCMODULES="config/etc/modules" ETCMODULES="config/etc/modules"

View file

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
# shellcheck disable=SC1091
# Function to configure systemd-boot using kernelstub # Function to configure systemd-boot using kernelstub
function set_KERNELSTUB () { function set_KERNELSTUB () {
@ -51,13 +52,13 @@ function set_GRUB () {
if grep -q "GRUB_CMDLINE_LINUX_DEFAULT=" "$SCRIPTDIR/$DEFAULT/grub" ; if grep -q "GRUB_CMDLINE_LINUX_DEFAULT=" "$SCRIPTDIR/$DEFAULT/grub" ;
then then
# Update the GRUB_CMDLINE_LINUX_DEFAULT line # Update the GRUB_CMDLINE_LINUX_DEFAULT line
GRUB_CMDLINE=$(cat "/etc/default/grub" | grep -P "^GRUB_CMDLINE_LINUX_DEFAULT" | perl -pe "s/GRUB_CMDLINE_LINUX_DEFAULT=\"(.+)\"/\1/" | perl -pe "s/iommu=(pt|on)|amd_iommu=on|vfio_pci.ids=.+|vfio_pci.disable_vga=\d{1}//g" | perl -pe "s/(^\s+|\s+$)//g") GRUB_CMDLINE=$(grep -P "^GRUB_CMDLINE_LINUX_DEFAULT" "/etc/default/grub" | perl -pe "s/GRUB_CMDLINE_LINUX_DEFAULT=\"(.+)\"/\1/" | perl -pe "s/iommu=(pt|on)|amd_iommu=on|vfio_pci.ids=.+|vfio_pci.disable_vga=\d{1}//g" | perl -pe "s/(^\s+|\s+$)//g")
GRUB_CMDLINE_LINUX=$(cat "/etc/default/grub" | grep -P "^GRUB_CMDLINE_LINUX_DEFAULT") GRUB_CMDLINE_LINUX=$(grep -P "^GRUB_CMDLINE_LINUX_DEFAULT" "/etc/default/grub")
perl -pi -e "s/${GRUB_CMDLINE_LINUX}/GRUB_CMDLINE_LINUX_DEFAULT=\"${GRUB_CMDLINE} ${CMDLINE}\"/" "${SCRIPTDIR}/$DEFAULT/grub" perl -pi -e "s/${GRUB_CMDLINE_LINUX}/GRUB_CMDLINE_LINUX_DEFAULT=\"${GRUB_CMDLINE} ${CMDLINE}\"/" "${SCRIPTDIR}/$DEFAULT/grub"
else else
# Update the GRUB_CMDLINE_LINUX line # Update the GRUB_CMDLINE_LINUX line
GRUB_CMDLINE=$(cat "/etc/default/grub" | grep -P "^GRUB_CMDLINE_LINUX" | perl -pe "s/GRUB_CMDLINE_LINUX=\"(.+)\"/\1/" | perl -pe "s/iommu=(pt|on)|amd_iommu=on|vfio_pci.ids=.+|vfio_pci.disable_vga=\d{1}//g" | perl -pe "s/(^\s+|\s+$)//g") GRUB_CMDLINE=$(grep -P "^GRUB_CMDLINE_LINUX" "/etc/default/grub" | perl -pe "s/GRUB_CMDLINE_LINUX=\"(.+)\"/\1/" | perl -pe "s/iommu=(pt|on)|amd_iommu=on|vfio_pci.ids=.+|vfio_pci.disable_vga=\d{1}//g" | perl -pe "s/(^\s+|\s+$)//g")
GRUB_CMDLINE_LINUX=$(cat "/etc/default/grub" | grep -P "^GRUB_CMDLINE_LINUX") GRUB_CMDLINE_LINUX=$(grep -P "^GRUB_CMDLINE_LINUX" "/etc/default/grub")
perl -pi -e "s/${GRUB_CMDLINE_LINUX}/GRUB_CMDLINE_LINUX=\"${GRUB_CMDLINE} ${CMDLINE}\"/" "${SCRIPTDIR}/$DEFAULT/grub" perl -pi -e "s/${GRUB_CMDLINE_LINUX}/GRUB_CMDLINE_LINUX=\"${GRUB_CMDLINE} ${CMDLINE}\"/" "${SCRIPTDIR}/$DEFAULT/grub"
fi fi

View file

@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
# shellcheck disable=SC1091
function set_DRACUT () { function set_DRACUT () {
# Get the config paths # Get the config paths
source "$SCRIPTDIR/lib/paths.sh" source "$SCRIPTDIR/lib/paths.sh"

View file

@ -1,12 +1,13 @@
#!/bin/bash #!/bin/bash
# shellcheck disable=SC1091
function insert_INITRAMFSTOOLS() { function insert_INITRAMFSTOOLS() {
# Get the header and enabled modules separately from the /etc/modules file # Get the header and enabled modules separately from the /etc/modules file
local MODULES_HEADER local MODULES_HEADER
local MODULES_ENABLED local MODULES_ENABLED
local VENDOR_RESET local VENDOR_RESET
MODULES_HEADER=$(head -n $1 "$2" | grep -P "^#" | grep -v "# Added by quickpassthrough") MODULES_HEADER=$(head -n "$1" "$2" | grep -P "^#" | grep -v "# Added by quickpassthrough")
MODULES_ENABLED=$(cat "$2" | grep -vP "^#" | grep -v "vendor-reset") MODULES_ENABLED=$(grep -vP "^#" "$2" | grep -v "vendor-reset" | perl -pe "s/^\n//")
VENDOR_RESET=0 VENDOR_RESET=0
# If vendor-reset is present # If vendor-reset is present

View file

@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
# shellcheck disable=SC1091
function set_MKINITCPIO () { function set_MKINITCPIO () {
# Get the config paths # Get the config paths
source "$SCRIPTDIR/lib/paths.sh" source "$SCRIPTDIR/lib/paths.sh"

View file

@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
# shellcheck disable=SC1091
function set_MODPROBE () { function set_MODPROBE () {
# Get the config paths # Get the config paths
source "$SCRIPTDIR/lib/paths.sh" source "$SCRIPTDIR/lib/paths.sh"

View file

@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
# shellcheck disable=SC1091
function set_VFIO () { function set_VFIO () {
# Get the config paths # Get the config paths
source "$SCRIPTDIR/lib/paths.sh" source "$SCRIPTDIR/lib/paths.sh"

View file

@ -1,14 +1,15 @@
#!/bin/bash #!/bin/bash
# shellcheck disable=SC1091
# Get the scripts directory # Get the scripts directory
SCRIPTDIR=$(dirname "$(realpath "$0")") SCRIPTDIR=$(dirname "$(realpath "$0")")
cd "$SCRIPTDIR" cd "$SCRIPTDIR" || exit
# Get the config paths # Get the config paths
source "$SCRIPTDIR/lib/paths.sh" source "$SCRIPTDIR/lib/paths.sh"
# Get the CPU Vendor # Get the CPU Vendor
CPU_VENDOR=$(cat /proc/cpuinfo | grep vendor | head -1 | cut -f 2 | cut -d " " -f 2) CPU_VENDOR=$(grep "vendor_id" /proc/cpuinfo | head -1 | cut -f 2 | cut -d " " -f 2)
CMDLINE="iommu=pt" CMDLINE="iommu=pt"
# Adjust our kernel_args based on cpu vendor # Adjust our kernel_args based on cpu vendor

View file

@ -1,18 +1,19 @@
#!/bin/bash #!/bin/bash
# shellcheck disable=SC2002,SC2164
# Get the scripts directory # Get the scripts directory
SCRIPTDIR=$(dirname "$(which $0)") SCRIPTDIR=$(dirname "$(which "$0")")
cd "$SCRIPTDIR" cd "$SCRIPTDIR"
# If there is a config generated, then $SCRIPTDIR/config/kernel_args # If there is a config generated, then $SCRIPTDIR/config/kernel_args
# should exist, which contains all the info we need # should exist, which contains all the info we need
if [ -f $SCRIPTDIR/config/kernel_args ]; if [ -f "$SCRIPTDIR/config/kernel_args" ];
then then
# Fetch part of the device id we need # Fetch part of the device id we need
DEVID=$(cat $SCRIPTDIR/config/kernel_args | cut -d " " -f 3 | cut -d "=" -f 2 | perl -pe "s/^([0-9a-f]{4}:).*/\1/") DEVID=$(cat "$SCRIPTDIR/config/kernel_args" | cut -d " " -f 3 | cut -d "=" -f 2 | perl -pe "s/^([0-9a-f]{4}:).*/\1/")
echo "#------------------------------------------#" echo "#------------------------------------------#"
# List info about the vfio gpu and what kernel driver is being used # List info about the vfio gpu and what kernel driver is being used
lspci -d $DEVID -v | grep -iP "kernel driver|amd|radeon|nvidia|nouveau" | grep -vi "kernel modules" lspci -d "$DEVID" -v | grep -iP "kernel driver|amd|radeon|nvidia|nouveau" | grep -vi "kernel modules"
echo "#------------------------------------------#" echo "#------------------------------------------#"
printf " printf "