diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index d9d1fdc..f40c8ac 100755 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -47,7 +47,8 @@ case "$1" in ;; 'purge') cd /etc/wireguard - rm *.conf *.png + rm *.conf *.png 2>/dev/null + echo "Removed all configuration files" exit 0 ;; 'help') diff --git a/scripts/ls-configs.sh b/scripts/ls-configs.sh index bd7ac89..444a0cf 100755 --- a/scripts/ls-configs.sh +++ b/scripts/ls-configs.sh @@ -1,6 +1,10 @@ #!/bin/bash -echo "Configurations - sorted by creation date" -echo -echo "Server" -cat "$DEVICE.conf" | grep -e "# Client" -e "# <-" | grep -a "#" | sed "s/# //" | sed "s/<- //" | sed "s/\(.*\)\([0-9]\{4\}\)/Created: \1\2\n/" +if [ ! -f "$DEVICE.conf" ]; then + echo "No configuration: Use command 'init' to create configuration files" +else + echo "Configurations - sorted by creation date" + echo + echo "Server" + cat "$DEVICE.conf" | grep -e "# Client" -e "# <-" | grep -a "#" | sed "s/# //" | sed "s/<- //" | sed "s/\(.*\)\([0-9]\{4\}\)/Created: \1\2\n/" +fi