mirror of
https://github.com/pivpn/pivpn.git
synced 2025-04-23 15:50:11 +00:00
disabled in square brackets
This commit is contained in:
parent
49a9314325
commit
6009e52e74
3 changed files with 18 additions and 18 deletions
|
@ -46,13 +46,13 @@ done
|
|||
|
||||
cd /etc/wireguard
|
||||
if [ ! -s configs/clients.txt ]; then
|
||||
echo "::: There are no clients to remove"
|
||||
echo "::: There are no clients to change"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
if [ "$DISPLAY_DISABLED" ]; then
|
||||
grep 'disabled### begin' wg0.conf | sed 's/#//g; s/begin//'
|
||||
grep '\[disabled\] ### begin' wg0.conf | sed 's/#//g; s/begin//'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -86,7 +86,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
|
||||
|
@ -99,7 +99,7 @@ for CLIENT_NAME in "${CLIENTS_TO_CHANGE[@]}"; do
|
|||
|
||||
# Disable the peer section from the server config
|
||||
echo "${CLIENT_NAME}"
|
||||
sed -e "/### begin ${CLIENT_NAME}/,/end ${CLIENT_NAME}/ s/^/#disabled/" -i wg0.conf
|
||||
sed -e "/### begin ${CLIENT_NAME}/,/end ${CLIENT_NAME}/ s/^/#\[disabled\] /" -i wg0.conf
|
||||
echo "::: Updated server config"
|
||||
|
||||
((CHANGED_COUNT++))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue