Some shellcheck fixes.
This commit is contained in:
parent
6bbbd9ad56
commit
0b7e24c081
1 changed files with 7 additions and 8 deletions
15
qemu-vm-net
15
qemu-vm-net
|
@ -2,9 +2,6 @@
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
BASE_BRIDGE_NAME=br-q
|
|
||||||
BASE_TAP_NAME=tap-q
|
|
||||||
|
|
||||||
randstr() {
|
randstr() {
|
||||||
dd if=/dev/urandom count=1 bs=3 2>/dev/null | xxd -p -g 0
|
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
|
nft delete rule $table $chain handle \$handle
|
||||||
"
|
"
|
||||||
else
|
else
|
||||||
echo "Warning: Don't know how to reverse 'nft $@'" 1>&2
|
echo "Warning: Don't know how to reverse 'nft $*'" 1>&2
|
||||||
nft "$@"
|
nft "$@"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
@ -171,9 +168,11 @@ create() {
|
||||||
ip addr
|
ip addr
|
||||||
dnsmasq -d --interface="$bridge_name" --bind-interface --dhcp-range="$dhcp_range" &
|
dnsmasq -d --interface="$bridge_name" --bind-interface --dhcp-range="$dhcp_range" &
|
||||||
dnsmasq_pid="$!"
|
dnsmasq_pid="$!"
|
||||||
echo "bridge_name='$bridge_name'" >> "$NET_CONF_FILE"
|
{
|
||||||
echo "tap_name='$tap_name'" >> "$NET_CONF_FILE"
|
echo "bridge_name='$bridge_name'"
|
||||||
echo "dnsmasq_pid='$dnsmasq_pid'" >> "$NET_CONF_FILE"
|
echo "tap_name='$tap_name'"
|
||||||
|
echo "dnsmasq_pid='$dnsmasq_pid'"
|
||||||
|
} >> "$NET_CONF_FILE"
|
||||||
disown -h "$dnsmasq_pid"
|
disown -h "$dnsmasq_pid"
|
||||||
|
|
||||||
echo "nft_ruleset='$(nft -s list ruleset)'" >> "$NET_CONF_FILE"
|
echo "nft_ruleset='$(nft -s list ruleset)'" >> "$NET_CONF_FILE"
|
||||||
|
@ -216,7 +215,7 @@ if [[ -z "$NET_CONF_FILE" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "EUID" -ne 0 ]]; then
|
if [[ "$EUID" -ne 0 ]]; then
|
||||||
echo "Please run as root" >&2
|
echo "Please run as root" >&2
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue