From ddedf565053ef9cd8b73f5fd64d0c104dfb567ea Mon Sep 17 00:00:00 2001 From: Dolorosus Date: Mon, 5 Jun 2023 13:11:03 +0200 Subject: [PATCH 1/2] Unique identification of client names bei pivp -on/-off --- scripts/wireguard/disableCONF.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/wireguard/disableCONF.sh b/scripts/wireguard/disableCONF.sh index 901256c..ec4f1b3 100755 --- a/scripts/wireguard/disableCONF.sh +++ b/scripts/wireguard/disableCONF.sh @@ -110,8 +110,8 @@ for CLIENT_NAME in "${CLIENTS_TO_CHANGE[@]}"; do # Disable the peer section from the server config echo "${CLIENT_NAME}" - sed_pattern="/### begin ${CLIENT_NAME}/," - sed_pattern="${sed_pattern}/end ${CLIENT_NAME}/ s/^/#\[disabled\] /" + sed_pattern="/### begin ${CLIENT_NAME} ###/," + sed_pattern="${sed_pattern}/end ${CLIENT_NAME} ###/ s/^/#\[disabled\] /" sed -e "${sed_pattern}" -i wg0.conf unset sed_pattern From 4b6ae387b79a4a2aa8e9629bacb8efcd732527e4 Mon Sep 17 00:00:00 2001 From: Dolorosus Date: Mon, 5 Jun 2023 13:11:30 +0200 Subject: [PATCH 2/2] Unique identification of client names in pivp -on/-off --- scripts/wireguard/disableCONF.sh | 2 +- scripts/wireguard/enableCONF.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/wireguard/disableCONF.sh b/scripts/wireguard/disableCONF.sh index ec4f1b3..f2112cd 100755 --- a/scripts/wireguard/disableCONF.sh +++ b/scripts/wireguard/disableCONF.sh @@ -97,7 +97,7 @@ for CLIENT_NAME in "${CLIENTS_TO_CHANGE[@]}"; do if ! grep -q "^${CLIENT_NAME} " configs/clients.txt; then echo -e "::: \e[1m${CLIENT_NAME}\e[0m does not exist" - elif grep -q "#\[disabled\] ### begin ${CLIENT_NAME}" wg0.conf; then + elif grep -q "#\[disabled\] ### begin ${CLIENT_NAME} ###" wg0.conf; then echo -e "::: \e[1m${CLIENT_NAME}\e[0m is already disabled" else if [[ -n "${CONFIRM}" ]]; then diff --git a/scripts/wireguard/enableCONF.sh b/scripts/wireguard/enableCONF.sh index 390b0a9..d20276d 100755 --- a/scripts/wireguard/enableCONF.sh +++ b/scripts/wireguard/enableCONF.sh @@ -110,8 +110,8 @@ for CLIENT_NAME in "${CLIENTS_TO_CHANGE[@]}"; do # Enable the peer section from the server config echo "${CLIENT_NAME}" - sed_pattern="/begin ${CLIENT_NAME}/," - sed_pattern="${sed_pattern}/end ${CLIENT_NAME}/ s/#\[disabled\] //" + sed_pattern="/### begin ${CLIENT_NAME} ###/," + sed_pattern="${sed_pattern}/### end ${CLIENT_NAME} ###/ s/#\[disabled\] //" sed -e "${sed_pattern}" -i wg0.conf unset sed_pattern