mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-20 03:40:17 +00:00
disabled in square brackets
This commit is contained in:
parent
49a9314325
commit
6009e52e74
3 changed files with 18 additions and 18 deletions
|
@ -4,8 +4,8 @@ _pivpn()
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
dashopts="-a -c -d -l -qr -r -h -u -up -bk -dis -ena"
|
dashopts="-a -c -d -l -qr -r -h -u -up -bk -off -on"
|
||||||
opts="add clients debug list qrcode remove help uninstall update backup disable enable"
|
opts="add clients debug list qrcode remove help uninstall update backup (temp) off (temp) on"
|
||||||
if [ "${#COMP_WORDS[@]}" -eq 2 ]
|
if [ "${#COMP_WORDS[@]}" -eq 2 ]
|
||||||
then
|
then
|
||||||
if [[ ${cur} == -* ]] ; then
|
if [[ ${cur} == -* ]] ; then
|
||||||
|
|
|
@ -46,13 +46,13 @@ done
|
||||||
|
|
||||||
cd /etc/wireguard
|
cd /etc/wireguard
|
||||||
if [ ! -s configs/clients.txt ]; then
|
if [ ! -s configs/clients.txt ]; then
|
||||||
echo "::: There are no clients to remove"
|
echo "::: There are no clients to change"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ "$DISPLAY_DISABLED" ]; then
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ for CLIENT_NAME in "${CLIENTS_TO_CHANGE[@]}"; do
|
||||||
|
|
||||||
if ! grep -q "^${CLIENT_NAME} " configs/clients.txt; then
|
if ! grep -q "^${CLIENT_NAME} " configs/clients.txt; then
|
||||||
echo -e "::: \e[1m${CLIENT_NAME}\e[0m does not exist"
|
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"
|
echo -e "::: \e[1m${CLIENT_NAME}\e[0m is already disabled"
|
||||||
else
|
else
|
||||||
if [ -n "$CONFIRM" ]; then
|
if [ -n "$CONFIRM" ]; then
|
||||||
|
@ -99,7 +99,7 @@ for CLIENT_NAME in "${CLIENTS_TO_CHANGE[@]}"; do
|
||||||
|
|
||||||
# Disable the peer section from the server config
|
# Disable the peer section from the server config
|
||||||
echo "${CLIENT_NAME}"
|
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"
|
echo "::: Updated server config"
|
||||||
|
|
||||||
((CHANGED_COUNT++))
|
((CHANGED_COUNT++))
|
||||||
|
|
|
@ -93,7 +93,7 @@ showHelp(){
|
||||||
echo "::: -qr, qrcode Show the qrcode of a client for use with the mobile app"
|
echo "::: -qr, qrcode Show the qrcode of a client for use with the mobile app"
|
||||||
echo "::: -r, remove Remove a client"
|
echo "::: -r, remove Remove a client"
|
||||||
echo "::: -off, off Disable a user"
|
echo "::: -off, off Disable a user"
|
||||||
echo "::: -on , on Enable a user"
|
echo "::: -on, on Enable a user"
|
||||||
echo "::: -h, help Show this help dialog"
|
echo "::: -h, help Show this help dialog"
|
||||||
echo "::: -u, uninstall Uninstall pivpn from your system!"
|
echo "::: -u, uninstall Uninstall pivpn from your system!"
|
||||||
echo "::: -up, update Updates PiVPN Scripts"
|
echo "::: -up, update Updates PiVPN Scripts"
|
||||||
|
|
Loading…
Reference in a new issue