Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: Quote variables #563

Merged
merged 11 commits into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 -e SC2028
SHELLCHECK_OPTS: -x --source-path=src -e SC2001 -e SC2034 -e SC2064 -e SC2317 -e SC2153 -e SC2028
26 changes: 13 additions & 13 deletions src/disk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 $?
Expand Down
4 changes: 2 additions & 2 deletions src/display.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/install.sh
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
18 changes: 9 additions & 9 deletions src/network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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_MAC:="$MAC"}
: ${VM_NET_HOST:='VirtualDSM'}
: "${VM_NET_DEV:=''}"
: "${VM_NET_TAP:='dsm'}"
: "${VM_NET_MAC:="$MAC"}"
: "${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:"

Expand Down
2 changes: 1 addition & 1 deletion src/print.sh
Original file line number Diff line number Diff line change
@@ -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; }
Expand Down
8 changes: 4 additions & 4 deletions src/proc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
18 changes: 9 additions & 9 deletions src/reset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions src/serial.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down