aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rwxr-xr-xsrc/wg-quick/darwin.bash9
-rwxr-xr-xsrc/wg-quick/freebsd.bash9
-rwxr-xr-xsrc/wg-quick/linux.bash9
-rwxr-xr-xsrc/wg-quick/openbsd.bash9
4 files changed, 20 insertions, 16 deletions
diff --git a/src/wg-quick/darwin.bash b/src/wg-quick/darwin.bash
index c938112..ed6aada 100755
--- a/src/wg-quick/darwin.bash
+++ b/src/wg-quick/darwin.bash
@@ -62,6 +62,7 @@ parse_options() {
stripped="${line%%\#*}"
key="${stripped%%=*}"; key="${key##*([[:space:]])}"; key="${key%%*([[:space:]])}"
value="${stripped#*=}"; value="${value##*([[:space:]])}"; value="${value%%*([[:space:]])}"
+ unstripped_value="${line#*=}"; unstripped_value="${unstripped_value##*([[:space:]])}"; unstripped_value="${unstripped_value%%*([[:space:]])}"
[[ $key == "["* ]] && interface_section=0
[[ $key == "[Interface]" ]] && interface_section=1
if [[ $interface_section -eq 1 ]]; then
@@ -72,10 +73,10 @@ parse_options() {
[[ $v =~ (^[0-9.]+$)|(^.*:.*$) ]] && DNS+=( $v ) || DNS_SEARCH+=( $v )
done; continue ;;
Table) TABLE="$value"; continue ;;
- PreUp) PRE_UP+=( "$value" ); continue ;;
- PreDown) PRE_DOWN+=( "$value" ); continue ;;
- PostUp) POST_UP+=( "$value" ); continue ;;
- PostDown) POST_DOWN+=( "$value" ); continue ;;
+ PreUp) PRE_UP+=( "$unstripped_value" ); continue ;;
+ PreDown) PRE_DOWN+=( "$unstripped_value" ); continue ;;
+ PostUp) POST_UP+=( "$unstripped_value" ); continue ;;
+ PostDown) POST_DOWN+=( "$unstripped_value" ); continue ;;
SaveConfig) read_bool SAVE_CONFIG "$value"; continue ;;
esac
fi
diff --git a/src/wg-quick/freebsd.bash b/src/wg-quick/freebsd.bash
index f72daf6..af5b174 100755
--- a/src/wg-quick/freebsd.bash
+++ b/src/wg-quick/freebsd.bash
@@ -80,6 +80,7 @@ parse_options() {
stripped="${line%%\#*}"
key="${stripped%%=*}"; key="${key##*([[:space:]])}"; key="${key%%*([[:space:]])}"
value="${stripped#*=}"; value="${value##*([[:space:]])}"; value="${value%%*([[:space:]])}"
+ unstripped_value="${line#*=}"; unstripped_value="${unstripped_value##*([[:space:]])}"; unstripped_value="${unstripped_value%%*([[:space:]])}"
[[ $key == "["* ]] && interface_section=0
[[ $key == "[Interface]" ]] && interface_section=1
if [[ $interface_section -eq 1 ]]; then
@@ -90,10 +91,10 @@ parse_options() {
[[ $v =~ (^[0-9.]+$)|(^.*:.*$) ]] && DNS+=( $v ) || DNS_SEARCH+=( $v )
done; continue ;;
Table) TABLE="$value"; continue ;;
- PreUp) PRE_UP+=( "$value" ); continue ;;
- PreDown) PRE_DOWN+=( "$value" ); continue ;;
- PostUp) POST_UP+=( "$value" ); continue ;;
- PostDown) POST_DOWN+=( "$value" ); continue ;;
+ PreUp) PRE_UP+=( "$unstripped_value" ); continue ;;
+ PreDown) PRE_DOWN+=( "$unstripped_value" ); continue ;;
+ PostUp) POST_UP+=( "$unstripped_value" ); continue ;;
+ PostDown) POST_DOWN+=( "$unstripped_value" ); continue ;;
SaveConfig) read_bool SAVE_CONFIG "$value"; continue ;;
esac
fi
diff --git a/src/wg-quick/linux.bash b/src/wg-quick/linux.bash
index acb015d..f56f6e4 100755
--- a/src/wg-quick/linux.bash
+++ b/src/wg-quick/linux.bash
@@ -51,6 +51,7 @@ parse_options() {
stripped="${line%%\#*}"
key="${stripped%%=*}"; key="${key##*([[:space:]])}"; key="${key%%*([[:space:]])}"
value="${stripped#*=}"; value="${value##*([[:space:]])}"; value="${value%%*([[:space:]])}"
+ unstripped_value="${line#*=}"; unstripped_value="${unstripped_value##*([[:space:]])}"; unstripped_value="${unstripped_value%%*([[:space:]])}"
[[ $key == "["* ]] && interface_section=0
[[ $key == "[Interface]" ]] && interface_section=1
if [[ $interface_section -eq 1 ]]; then
@@ -61,10 +62,10 @@ parse_options() {
[[ $v =~ (^[0-9.]+$)|(^.*:.*$) ]] && DNS+=( $v ) || DNS_SEARCH+=( $v )
done; continue ;;
Table) TABLE="$value"; continue ;;
- PreUp) PRE_UP+=( "$value" ); continue ;;
- PreDown) PRE_DOWN+=( "$value" ); continue ;;
- PostUp) POST_UP+=( "$value" ); continue ;;
- PostDown) POST_DOWN+=( "$value" ); continue ;;
+ PreUp) PRE_UP+=( "$unstripped_value" ); continue ;;
+ PreDown) PRE_DOWN+=( "$unstripped_value" ); continue ;;
+ PostUp) POST_UP+=( "$unstripped_value" ); continue ;;
+ PostDown) POST_DOWN+=( "$unstripped_value" ); continue ;;
SaveConfig) read_bool SAVE_CONFIG "$value"; continue ;;
esac
fi
diff --git a/src/wg-quick/openbsd.bash b/src/wg-quick/openbsd.bash
index b58ecf5..d12f70e 100755
--- a/src/wg-quick/openbsd.bash
+++ b/src/wg-quick/openbsd.bash
@@ -52,6 +52,7 @@ parse_options() {
stripped="${line%%\#*}"
key="${stripped%%=*}"; key="${key##*([[:space:]])}"; key="${key%%*([[:space:]])}"
value="${stripped#*=}"; value="${value##*([[:space:]])}"; value="${value%%*([[:space:]])}"
+ unstripped_value="${line#*=}"; unstripped_value="${unstripped_value##*([[:space:]])}"; unstripped_value="${unstripped_value%%*([[:space:]])}"
[[ $key == "["* ]] && interface_section=0
[[ $key == "[Interface]" ]] && interface_section=1
if [[ $interface_section -eq 1 ]]; then
@@ -62,10 +63,10 @@ parse_options() {
[[ $v =~ (^[0-9.]+$)|(^.*:.*$) ]] && DNS+=( $v ) || DNS_SEARCH+=( $v )
done; continue ;;
Table) TABLE="$value"; continue ;;
- PreUp) PRE_UP+=( "$value" ); continue ;;
- PreDown) PRE_DOWN+=( "$value" ); continue ;;
- PostUp) POST_UP+=( "$value" ); continue ;;
- PostDown) POST_DOWN+=( "$value" ); continue ;;
+ PreUp) PRE_UP+=( "$unstripped_value" ); continue ;;
+ PreDown) PRE_DOWN+=( "$unstripped_value" ); continue ;;
+ PostUp) POST_UP+=( "$unstripped_value" ); continue ;;
+ PostDown) POST_DOWN+=( "$unstripped_value" ); continue ;;
SaveConfig) read_bool SAVE_CONFIG "$value"; continue ;;
esac
fi