Start some pacification of shellcheck

not overly obsessive but focussing on safety
This commit is contained in:
Phil 2022-03-04 00:37:46 +00:00
parent d1044e1b40
commit 7fe88321e6
2 changed files with 15 additions and 15 deletions

View file

@ -3,9 +3,9 @@
function set_CMDLINE () { function set_CMDLINE () {
clear clear
# Get the config paths # Get the config paths
source "$SCRIPTDIR/lib/paths.sh" source "${SCRIPTDIR}/lib/paths.sh"
local CMDLINE=$(cat "$SCRIPTDIR/config/kernel_args") local CMDLINE=$(cat "${SCRIPTDIR}/config/kernel_args")
printf "Configuration is now complete, however no changes have been done to your system. printf "Configuration is now complete, however no changes have been done to your system.
The files needed have just been written to $SCRIPTDIR/config/etc The files needed have just been written to $SCRIPTDIR/config/etc
@ -42,7 +42,7 @@ the required information that the QuickEMU project can hook into and use to add
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$//")
set_CMDLINE set_CMDLINE
} }

View file

@ -9,9 +9,9 @@ function set_MODULES () {
# Generated by vfio-setup # Generated by vfio-setup
vfio vfio
vfio_iommu_type1 vfio_iommu_type1
vfio_pci ids=$1 vfio_pci ids=%s
vfio_virqfd vfio_virqfd
" >> "$SCRIPTDIR/$MODULES" " "$1" >> "$SCRIPTDIR/$MODULES"
# Write "/etc/initramfs-tools/modules" # Write "/etc/initramfs-tools/modules"
printf " printf "
@ -27,42 +27,42 @@ vfio_virqfd
# Update the kernel_args file # Update the kernel_args file
CMDLINE=$(cat "$SCRIPTDIR/config/kernel_args") CMDLINE=$(cat "$SCRIPTDIR/config/kernel_args")
echo "$CMDLINE vfio_pci.ids=$GPU_DEVID" > "$SCRIPTDIR/config/kernel_args" echo "${CMDLINE} vfio_pci.ids=$GPU_DEVID" > "$SCRIPTDIR/config/kernel_args"
# Ask if we shall disable video output on this card # Ask if we shall disable video output on this card
read -p "Do you want to force disable video output in linux on this card? [Y/n]: " DISABLE_VGA read -p "Do you want to force disable video output in linux on this card? [Y/n]: " DISABLE_VGA
case "${DISABLE_VGA}" in case "${DISABLE_VGA}" in
[Yy]*) [Yy]*)
GPU_DEVID="$GPU_DEVID disable_vga=1" GPU_DEVID="${GPU_DEVID} disable_vga=1"
;; ;;
[Nn]*) [Nn]*)
echo "" echo ""
;; ;;
*) *)
GPU_DEVID="$GPU_DEVID disable_vga=1" GPU_DEVID="${GPU_DEVID} disable_vga=1"
;; ;;
esac esac
# Write the vfio modprobe config # Write the vfio modprobe config
printf "# This is an autogenerated file that stubs your graphic card for use with vfio printf "# This is an autogenerated file that stubs your graphic card for use with vfio
# This file should be placed inside /etc/modprobe.d/ # This file should be placed inside /etc/modprobe.d/
options vfio_pci ids=$GPU_DEVID options vfio_pci ids=%s
# Make sure vfio_pci is loaded before these modules: nvidia, nouveau, amdgpu and radeon # Make sure vfio_pci is loaded before these modules: nvidia, nouveau, amdgpu and radeon
softdep nvidia pre: vfio vfio_pci softdep nvidia pre: vfio vfio_pci
softdep nouveau pre: vfio vfio_pci softdep nouveau pre: vfio vfio_pci
softdep amdgpu pre: vfio vfio_pci softdep amdgpu pre: vfio vfio_pci
softdep radeon pre: vfio vfio_pci softdep radeon pre: vfio vfio_pci
" > "$SCRIPTDIR/$MODPROBE/vfio.conf" " "${GPU_DEVID}" > "$SCRIPTDIR/$MODPROBE/vfio.conf"
exec "$SCRIPTDIR/lib/get_USB_CTL.sh" exec "$SCRIPTDIR/lib/get_USB_CTL.sh"
} }
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$//")
set_MODULES $1 set_MODULES "$1"
} }
main $1 main "$1"