From 1fc9c56c8fe5f1a2aa2c95a6f0bfde47667473bd Mon Sep 17 00:00:00 2001 From: Kroese Date: Sun, 14 Jan 2024 16:01:15 +0100 Subject: [PATCH] style: Quote variables (#565) --- src/disk.sh | 26 +++++++++++++------------- src/display.sh | 4 ++-- src/install.sh | 2 +- src/network.sh | 16 ++++++++-------- src/print.sh | 2 +- src/proc.sh | 8 ++++---- src/reset.sh | 18 +++++++++--------- src/serial.sh | 10 +++++----- 8 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/disk.sh b/src/disk.sh index 17bce7c..25d90b3 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:='raw'}" # Disk file format, 'raw' by default for best performance -: "${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:="raw"}" # Disk file format, 'raw' by default for best performance +: "${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.boot.img" SYSTEM="$STORAGE/$BASE.system.img" @@ -472,14 +472,14 @@ fi DISK4_FILE="/storage4/data4" -: "${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" "3" "0xc" || exit $? diff --git a/src/display.sh b/src/display.sh index b30424b..1b4fb3c 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 if [[ "$GPU" != [Yy1]* ]] || [[ "$ARCH" != "amd64" ]]; then diff --git a/src/install.sh b/src/install.sh index 0fa6bcc..788580e 100644 --- a/src/install.sh +++ b/src/install.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -Eeuo pipefail -: "${URL:=''}" # URL of the PAT file to be downloaded. +: "${URL:=""}" # URL of the PAT file to be downloaded. if [ -f "$STORAGE/dsm.ver" ]; then BASE=$(<"$STORAGE/dsm.ver") diff --git a/src/network.sh b/src/network.sh index 05bcc04..314542d 100644 --- a/src/network.sh +++ b/src/network.sh @@ -3,17 +3,17 @@ set -Eeuo pipefail # Docker environment variables -: "${DHCP:='N'}" -: "${MAC:='02:11:32:AA:BB:CC'}" +: "${DHCP:="N"}" +: "${MAC:="02:11:32:AA:BB:CC"}" -: "${VM_NET_DEV:=''}" -: "${VM_NET_TAP:='dsm'}" +: "${VM_NET_DEV:=""}" +: "${VM_NET_TAP:="dsm"}" : "${VM_NET_MAC:="$MAC"}" -: "${VM_NET_HOST:='VirtualDSM'}" +: "${VM_NET_HOST:="VirtualDSM"}" -: "${DNSMASQ_OPTS:=''}" -: "${DNSMASQ:='/usr/sbin/dnsmasq'}" -: "${DNSMASQ_CONF_DIR:='/etc/dnsmasq.d'}" +: "${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/print.sh b/src/print.sh index 8dd9df6..95d7b9e 100644 --- a/src/print.sh +++ b/src/print.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -Eeuo pipefail -: "${DHCP:='N'}" +: "${DHCP:="N"}" info () { printf "%b%s%b" "\E[1;34m❯ \E[1;36m" "$1" "\E[0m\n" >&2; } error () { printf "%b%s%b" "\E[1;31m❯ " "ERROR: $1" "\E[0m\n" >&2; } diff --git a/src/proc.sh b/src/proc.sh index 3dc50a6..3c81892 100644 --- a/src/proc.sh +++ b/src/proc.sh @@ -3,10 +3,10 @@ set -Eeuo pipefail # Docker environment variables -: "${KVM:='Y'}" -: "${HOST_CPU:=''}" -: "${CPU_MODEL:='host'}" -: "${CPU_FEATURES:='+ssse3,+sse4.1,+sse4.2'}" +: "${KVM:="Y"}" +: "${HOST_CPU:=""}" +: "${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 1a7908e..3ba47eb 100644 --- a/src/reset.sh +++ b/src/reset.sh @@ -11,15 +11,15 @@ trap 'error "Status $? while: $BASH_COMMAND (line $LINENO/$BASH_LINENO)"' ERR # Docker environment variables -: "${TZ:=''}" # System local timezone -: "${DEBUG:='N'}" # Disable debugging mode -: "${COUNTRY:=''}" # Country code for mirror -: "${CONSOLE:='N'}" # Disable console mode -: "${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 +: "${TZ:=""}" # System local timezone +: "${DEBUG:="N"}" # Disable debugging mode +: "${COUNTRY:=""}" # Country code for mirror +: "${CONSOLE:="N"}" # Disable console mode +: "${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 diff --git a/src/serial.sh b/src/serial.sh index 581f10c..e572298 100644 --- a/src/serial.sh +++ b/src/serial.sh @@ -3,11 +3,11 @@ set -Eeuo pipefail # Docker environment variables -: "${HOST_MAC:=''}" -: "${HOST_DEBUG:=''}" -: "${HOST_SERIAL:=''}" -: "${HOST_MODEL:=''}" -: "${GUEST_SERIAL:=''}" +: "${HOST_MAC:=""}" +: "${HOST_DEBUG:=""}" +: "${HOST_SERIAL:=""}" +: "${HOST_MODEL:=""}" +: "${GUEST_SERIAL:=""}" HOST_ARGS=() HOST_ARGS+=("-cpu=$CPU_CORES")