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 () {
clear
# 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.
The files needed have just been written to $SCRIPTDIR/config/etc
@ -33,8 +33,8 @@ the required information that the QuickEMU project can hook into and use to add
######################################################################
#### In the future, when I have enough confirmation that this script works for other people.
#### This page will get replaced with a prompt asking if you want to apply the changes and make backups
#### of your current system config.
#### This page will get replaced with a prompt asking if you want to apply the changes and make backups
#### of your current system config.
######################################################################
"
@ -42,7 +42,7 @@ the required information that the QuickEMU project can hook into and use to add
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
}

View file

@ -9,9 +9,9 @@ function set_MODULES () {
# Generated by vfio-setup
vfio
vfio_iommu_type1
vfio_pci ids=$1
vfio_pci ids=%s
vfio_virqfd
" >> "$SCRIPTDIR/$MODULES"
" "$1" >> "$SCRIPTDIR/$MODULES"
# Write "/etc/initramfs-tools/modules"
printf "
@ -27,42 +27,42 @@ vfio_virqfd
# Update the kernel_args file
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
read -p "Do you want to force disable video output in linux on this card? [Y/n]: " DISABLE_VGA
case "${DISABLE_VGA}" in
[Yy]*)
GPU_DEVID="$GPU_DEVID disable_vga=1"
GPU_DEVID="${GPU_DEVID} disable_vga=1"
;;
[Nn]*)
echo ""
;;
*)
GPU_DEVID="$GPU_DEVID disable_vga=1"
GPU_DEVID="${GPU_DEVID} disable_vga=1"
;;
esac
# Write the vfio modprobe config
printf "# This is an autogenerated file that stubs your graphic card for use with vfio
# 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
softdep nvidia pre: vfio vfio_pci
softdep nouveau pre: vfio vfio_pci
softdep amdgpu 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"
}
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"