wg-quick: allow config files without trailing newline
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
b20702bfa3
commit
a9bcd0d401
|
@ -31,7 +31,7 @@ parse_options() {
|
||||||
((($(stat -c '%#a' "$CONFIG_FILE") & 0007) == 0)) || echo "Warning: \`$CONFIG_FILE' is world accessible" >&2
|
((($(stat -c '%#a' "$CONFIG_FILE") & 0007) == 0)) || echo "Warning: \`$CONFIG_FILE' is world accessible" >&2
|
||||||
INTERFACE="${BASH_REMATCH[1]}"
|
INTERFACE="${BASH_REMATCH[1]}"
|
||||||
shopt -s nocasematch
|
shopt -s nocasematch
|
||||||
while read -r line; do
|
while read -r line || [[ -n $line ]]; do
|
||||||
key="${line%%=*}"; key="${key##*( )}"; key="${key%%*( )}"
|
key="${line%%=*}"; key="${key##*( )}"; key="${key%%*( )}"
|
||||||
value="${line#*=}"; value="${value##*( )}"; value="${value%%*( )}"
|
value="${line#*=}"; value="${value##*( )}"; value="${value%%*( )}"
|
||||||
[[ $key == "["* ]] && interface_section=0
|
[[ $key == "["* ]] && interface_section=0
|
||||||
|
|
Loading…
Reference in New Issue