From 526548647cd61f4c31fee72922cb0fe68e60a222 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sun, 14 Jan 2024 01:22:50 +0100 Subject: [PATCH] style: Quote variables (#323) --- .github/workflows/check.yml | 2 +- src/boot.sh | 2 +- src/disk.sh | 26 +++++++++++++------------- src/display.sh | 4 ++-- src/network.sh | 24 ++++++++++++------------ src/proc.sh | 6 +++--- src/reset.sh | 14 +++++++------- 7 files changed, 39 insertions(+), 39 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 5381a9bb..edb0477b 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -11,4 +11,4 @@ jobs: - name: Run ShellCheck uses: ludeeus/action-shellcheck@master env: - SHELLCHECK_OPTS: -x --source-path=src -e SC2001 -e SC2223 -e SC2034 -e SC2064 -e SC2317 -e SC2153 + SHELLCHECK_OPTS: -x --source-path=src -e SC2001 -e SC2034 -e SC2064 -e SC2317 -e SC2153 diff --git a/src/boot.sh b/src/boot.sh index a9b5a9ce..4fb050d6 100644 --- a/src/boot.sh +++ b/src/boot.sh @@ -3,7 +3,7 @@ set -Eeuo pipefail # Docker environment variables -: ${BOOT_MODE:='legacy'} # Boot mode +: "${BOOT_MODE:='legacy'}" # Boot mode SECURE="" BOOT_OPTS="" diff --git a/src/disk.sh b/src/disk.sh index c849803a..c0876fe7 100644 --- a/src/disk.sh +++ b/src/disk.sh @@ -3,12 +3,12 @@ set -Eeuo pipefail # Docker environment variables -: ${DISK_IO:='native'} # I/O Mode, can be set to 'native', 'threads' or 'io_turing' -: ${DISK_FMT:=''} # Disk file format, can be set to "raw" or "qcow2" (default) -: ${DISK_FLAGS:=''} # Specifies the options for use with the qcow2 disk format -: ${DISK_CACHE:='none'} # Caching mode, can be set to 'writeback' for better performance -: ${DISK_DISCARD:='on'} # Controls whether unmap (TRIM) commands are passed to the host. -: ${DISK_ROTATION:='1'} # Rotation rate, set to 1 for SSD storage and increase for HDD +: "${DISK_IO:='native'}" # I/O Mode, can be set to 'native', 'threads' or 'io_turing' +: "${DISK_FMT:=''}" # Disk file format, can be set to "raw" or "qcow2" (default) +: "${DISK_FLAGS:=''}" # Specifies the options for use with the qcow2 disk format +: "${DISK_CACHE:='none'}" # Caching mode, can be set to 'writeback' for better performance +: "${DISK_DISCARD:='on'}" # Controls whether unmap (TRIM) commands are passed to the host. +: "${DISK_ROTATION:='1'}" # Rotation rate, set to 1 for SSD storage and increase for HDD BOOT="$STORAGE/$BASE" DRIVERS="$STORAGE/drivers.img" @@ -449,14 +449,14 @@ else DISK_ALLOC="preallocation=falloc" fi -: ${DISK2_SIZE:=''} -: ${DISK3_SIZE:=''} -: ${DISK4_SIZE:=''} +: "${DISK2_SIZE:=''}" +: "${DISK3_SIZE:=''}" +: "${DISK4_SIZE:=''}" -: ${DEVICE:=''} # Docker variables to passthrough a block device, like /dev/vdc1. -: ${DEVICE2:=''} -: ${DEVICE3:=''} -: ${DEVICE4:=''} +: "${DEVICE:=''}" # Docker variables to passthrough a block device, like /dev/vdc1. +: "${DEVICE2:=''}" +: "${DEVICE3:=''}" +: "${DEVICE4:=''}" if [ -n "$DEVICE" ]; then addDevice "userdata" "$DEVICE" "device" "1" "0xa" || exit $? diff --git a/src/display.sh b/src/display.sh index 4cee13fa..1eca8075 100644 --- a/src/display.sh +++ b/src/display.sh @@ -3,8 +3,8 @@ set -Eeuo pipefail # Docker environment variables -: ${GPU:='N'} # GPU passthrough -: ${DISPLAY:='none'} # Display type +: "${GPU:='N'}" # GPU passthrough +: "${DISPLAY:='none'}" # Display type case "${DISPLAY,,}" in vnc) diff --git a/src/network.sh b/src/network.sh index 47f97790..016e807d 100644 --- a/src/network.sh +++ b/src/network.sh @@ -3,18 +3,18 @@ set -Eeuo pipefail # Docker environment variables -: ${DHCP:='N'} -: ${HOST_PORTS:=''} -: ${MAC:='82:cf:d0:5e:57:66'} - -: ${VM_NET_DEV:=''} -: ${VM_NET_TAP:='qemu'} -: ${VM_NET_MAC:="$MAC"} -: ${VM_NET_HOST:='QEMU'} - -: ${DNSMASQ_OPTS:=''} -: ${DNSMASQ:='/usr/sbin/dnsmasq'} -: ${DNSMASQ_CONF_DIR:='/etc/dnsmasq.d'} +: "${DHCP:='N'}" +: "${HOST_PORTS:=''}" +: "${MAC:='82:cf:d0:5e:57:66'}" + +: "${VM_NET_DEV:=''}" +: "${VM_NET_TAP:='qemu'}" +: "${VM_NET_MAC:="$MAC"}" +: "${VM_NET_HOST:='QEMU'}" + +: "${DNSMASQ_OPTS:=''}" +: "${DNSMASQ:='/usr/sbin/dnsmasq'}" +: "${DNSMASQ_CONF_DIR:='/etc/dnsmasq.d'}" ADD_ERR="Please add the following setting to your container:" diff --git a/src/proc.sh b/src/proc.sh index ef65e014..65d5e535 100644 --- a/src/proc.sh +++ b/src/proc.sh @@ -3,9 +3,9 @@ set -Eeuo pipefail # Docker environment variables -: ${KVM:='Y'} -: ${CPU_MODEL:='host'} -: ${CPU_FEATURES:='+ssse3,+sse4.1,+sse4.2'} +: "${KVM:='Y'}" +: "${CPU_MODEL:='host'}" +: "${CPU_FEATURES:='+ssse3,+sse4.1,+sse4.2'}" [ "$ARCH" != "amd64" ] && KVM="N" diff --git a/src/reset.sh b/src/reset.sh index 8b1cb5de..054c71c4 100644 --- a/src/reset.sh +++ b/src/reset.sh @@ -11,13 +11,13 @@ trap 'error "Status $? while: $BASH_COMMAND (line $LINENO/$BASH_LINENO)"' ERR # Docker environment variables -: ${BOOT:=''} # URL of the ISO file -: ${DEBUG:='N'} # Disable debugging -: ${ALLOCATE:=''} # Preallocate diskspace -: ${ARGUMENTS:=''} # Extra QEMU parameters -: ${CPU_CORES:='1'} # Amount of CPU cores -: ${RAM_SIZE:='1G'} # Maximum RAM amount -: ${DISK_SIZE:='16G'} # Initial data disk size +: "${BOOT:=''}" # URL of the ISO file +: "${DEBUG:='N'}" # Disable debugging +: "${ALLOCATE:=''}" # Preallocate diskspace +: "${ARGUMENTS:=''}" # Extra QEMU parameters +: "${CPU_CORES:='1'}" # Amount of CPU cores +: "${RAM_SIZE:='1G'}" # Maximum RAM amount +: "${DISK_SIZE:='16G'}" # Initial data disk size # Helper variables