From a8081b7fe38a55c843a0a6fead64c81fae31b54e Mon Sep 17 00:00:00 2001 From: Tobias Cudnik Date: Mon, 8 May 2023 16:04:38 +0200 Subject: [PATCH] nm-certs.sh - config fixes - crontab symlink --- scripts/nm-certs.sh | 7 +++++-- scripts/nm-quick.sh | 44 ++++++++++++++++++++------------------------ 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/scripts/nm-certs.sh b/scripts/nm-certs.sh index 4e2215ed..6cb8ffea 100755 --- a/scripts/nm-certs.sh +++ b/scripts/nm-certs.sh @@ -2,7 +2,7 @@ CONFIG_FILE=netmaker.env # TODO make sure this doesnt break, parse `certbot certificates` if yes -CERT_DIR=/etc/letsencrypt/live/stun.$NM_DOMAIN/ +CERT_DIR=/etc/letsencrypt/live/stun.$NM_DOMAIN SCRIPT_DIR=$(dirname "$(realpath "$0")") # get and check the config @@ -11,7 +11,7 @@ if [ ! -f "$SCRIPT_DIR/$CONFIG_FILE" ]; then exit 1 fi source "$SCRIPT_DIR/$CONFIG_FILE" -if [[ -n "$NM_DOMAIN" || -n "$NM_EMAIL" ]]; then +if [ -z "$NM_DOMAIN" ] || [ -z "$NM_EMAIL" ]; then echo "Config not valid" exit 1 fi @@ -60,3 +60,6 @@ if [ "$RESTART_CADDY" = true ]; then echo "Starting Caddy..." docker-compose -f /root/docker-compose.yml start caddy fi + +# install crontab +ln -sfn "$SCRIPT_DIR"/nm-certs.sh /etc/cron.monthly/nm-certs.sh diff --git a/scripts/nm-quick.sh b/scripts/nm-quick.sh index c703f774..185739d1 100755 --- a/scripts/nm-quick.sh +++ b/scripts/nm-quick.sh @@ -6,25 +6,6 @@ SCRIPT_DIR=$(dirname "$(realpath "$0")") CONFIG_PATH="$SCRIPT_DIR/$CONFIG_FILE" LATEST=$(curl -s https://api.github.com/repos/gravitl/netmaker/releases/latest | grep "tag_name" | cut -d : -f 2,3 | tr -d [:space:],\") -print_logo() { ( - cat <<"EOF" -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - __ __ ______ ______ __ __ ______ __ __ ______ ______ -/\ "-.\ \ /\ ___\ /\__ _\ /\ "-./ \ /\ __ \ /\ \/ / /\ ___\ /\ == \ -\ \ \-. \ \ \ __\ \/_/\ \/ \ \ \-./\ \ \ \ __ \ \ \ _"-. \ \ __\ \ \ __< - \ \_\\"\_\ \ \_____\ \ \_\ \ \_\ \ \_\ \ \_\ \_\ \ \_\ \_\ \ \_____\ \ \_\ \_\ - \/_/ \/_/ \/_____/ \/_/ \/_/ \/_/ \/_/\/_/ \/_/\/_/ \/_____/ \/_/ /_/ - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -EOF -); } - if [ $(id -u) -ne 0 ]; then echo "This script must be run as root" exit 1 @@ -94,6 +75,26 @@ print_logo() { \/_/ \/_/ \/_____/ \/_/ \/_/ \/_/ \/_/\/_/ \/_/\/_/ \/_____/ \/_/ /_/ +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +EOF +} + +# print_logo - prints the netmaker logo +print_logo() { + cat <<"EOF" +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + __ __ ______ ______ __ __ ______ __ __ ______ ______ +/\ "-.\ \ /\ ___\ /\__ _\ /\ "-./ \ /\ __ \ /\ \/ / /\ ___\ /\ == \ +\ \ \-. \ \ \ __\ \/_/\ \/ \ \ \-./\ \ \ \ __ \ \ \ _"-. \ \ __\ \ \ __< + \ \_\\"\_\ \ \_____\ \ \_\ \ \_\ \ \_\ \ \_\ \_\ \ \_\ \_\ \ \_____\ \ \_\ \_\ + \/_/ \/_/ \/_____/ \/_/ \/_/ \/_/ \/_/\/_/ \/_/\/_/ \/_____/ \/_/ /_/ + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -334,11 +335,6 @@ install_dependencies() { OS="TurrisOS" update_cmd='opkg update' install_cmd='opkg install' - elif [ -f /etc/openwrt_release ]; then - dependencies="git wireguard-tools bash jq docker.io certbot docker-compose" - OS="OpenWRT" - update_cmd='opkg update' - install_cmd='opkg install' else install_cmd='' fi