From f3e3b01ab54ff6b8827683f451323fdb8d9ce5cf Mon Sep 17 00:00:00 2001 From: nachoparker Date: Sat, 18 Sep 2021 18:57:56 -0600 Subject: letsencrypt: improve active status check Signed-off-by: nachoparker --- bin/ncp/NETWORKING/letsencrypt.sh | 2 +- changelog.md | 4 +++- etc/library.sh | 15 ++++++++++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/bin/ncp/NETWORKING/letsencrypt.sh b/bin/ncp/NETWORKING/letsencrypt.sh index 06cfe5a4..a70b06c1 100644 --- a/bin/ncp/NETWORKING/letsencrypt.sh +++ b/bin/ncp/NETWORKING/letsencrypt.sh @@ -15,7 +15,7 @@ letsencrypt=/usr/bin/letsencrypt is_active() { - [[ $( find /etc/letsencrypt/live/ -maxdepth 0 -empty | wc -l ) == 0 ]] + [[ "${ACTIVE}" == "yes" ]] && [[ $( find /etc/letsencrypt/live/ -maxdepth 0 -empty | wc -l ) == 0 ]] } tmpl_letsencrypt_domain() { diff --git a/changelog.md b/changelog.md index 9255f50b..6b935d61 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,7 @@ -[v1.39.2](https://github.com/nextcloud/nextcloudpi/commit/9598430) (2021-09-18) nextcloud-domain: make sure redis is running before it starts +[v1.39.3](https://github.com/nextcloud/nextcloudpi/commit/295144c) (2021-09-18) letsencrypt: improve active status check + +[v1.39.2 ](https://github.com/nextcloud/nextcloudpi/commit/fb5a2f3) (2021-09-18) nextcloud-domain: make sure redis is running before it starts [v1.39.1 ](https://github.com/nextcloud/nextcloudpi/commit/6290c1f) (2021-09-09) nc-static-IP: take into account httpsonly diff --git a/etc/library.sh b/etc/library.sh index b382bad0..01677652 100644 --- a/etc/library.sh +++ b/etc/library.sh @@ -246,7 +246,20 @@ function is_active_app() # function unset is_active source "$script" - [[ $( type -t is_active ) == function ]] && { is_active; return $?; } + [[ $( type -t is_active ) == function ]] && { + # read cfg parameters + [[ -f "$cfg_file" ]] && { + local cfg="$( cat "$cfg_file" )" + local len="$(jq '.params | length' <<<"$cfg")" + for (( i = 0 ; i < len ; i++ )); do + local var="$(jq -r ".params[$i].id" <<<"$cfg")" + local val="$(jq -r ".params[$i].value" <<<"$cfg")" + eval "$var=$val" + done + } + is_active + return $?; + } # config [[ -f "$cfg_file" ]] || return 1 -- cgit v1.2.3