From 0b7e24c081dc45a30bcbfed1111dc6d662b7139f Mon Sep 17 00:00:00 2001 From: redxef Date: Tue, 14 May 2024 21:02:42 +0200 Subject: [PATCH] Some shellcheck fixes. --- qemu-vm-net | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/qemu-vm-net b/qemu-vm-net index 9a3acbe..d3b1b5b 100755 --- a/qemu-vm-net +++ b/qemu-vm-net @@ -2,9 +2,6 @@ set -euo pipefail -BASE_BRIDGE_NAME=br-q -BASE_TAP_NAME=tap-q - randstr() { dd if=/dev/urandom count=1 bs=3 2>/dev/null | xxd -p -g 0 } @@ -92,7 +89,7 @@ nft_rev() { nft delete rule $table $chain handle \$handle " else - echo "Warning: Don't know how to reverse 'nft $@'" 1>&2 + echo "Warning: Don't know how to reverse 'nft $*'" 1>&2 nft "$@" return 0 fi @@ -171,9 +168,11 @@ create() { ip addr dnsmasq -d --interface="$bridge_name" --bind-interface --dhcp-range="$dhcp_range" & dnsmasq_pid="$!" - echo "bridge_name='$bridge_name'" >> "$NET_CONF_FILE" - echo "tap_name='$tap_name'" >> "$NET_CONF_FILE" - echo "dnsmasq_pid='$dnsmasq_pid'" >> "$NET_CONF_FILE" + { + echo "bridge_name='$bridge_name'" + echo "tap_name='$tap_name'" + echo "dnsmasq_pid='$dnsmasq_pid'" + } >> "$NET_CONF_FILE" disown -h "$dnsmasq_pid" echo "nft_ruleset='$(nft -s list ruleset)'" >> "$NET_CONF_FILE" @@ -216,7 +215,7 @@ if [[ -z "$NET_CONF_FILE" ]]; then exit 1 fi -if [[ "EUID" -ne 0 ]]; then +if [[ "$EUID" -ne 0 ]]; then echo "Please run as root" >&2 exit 2 fi