From 33cbe00cef95fb59a2032b7bfcf80c991c00ff35 Mon Sep 17 00:00:00 2001 From: HgO Date: Sat, 7 Dec 2019 17:22:49 +0100 Subject: [PATCH 1/8] Fix checkout renew_cert when directory already exists --- manifest.json | 4 ++-- scripts/upgrade | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 821eb78..2ce165e 100644 --- a/manifest.json +++ b/manifest.json @@ -2,10 +2,10 @@ "name": "Neutrinet", "id": "neutrinet", "description": { - "en": "Auto renewall for the Neutrinet vpn-certificates", + "en": "Auto renewal for the Neutrinet vpn-certificates", "fr": "Renouvellement automatique des certificats vpn Neutrinet" }, - "version": "0.3.0~ynh1", + "version": "0.3.0~ynh2", "license": "GPL-3+", "maintainer": { "name": "ilja", diff --git a/scripts/upgrade b/scripts/upgrade index 9f4eead..5548136 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -128,6 +128,8 @@ renew_cert_cron_script="renew_cert_cron.sh" if [[ ! -e $renew_cert_path ]]; then git clone $renew_cert_repo $renew_cert_path +else + git -C $renew_cert_path fetch -t fi git -C $renew_cert_path checkout $renew_cert_version -- GitLab From a5f359994ba0d78f7b8e747858215aefc7aef86c Mon Sep 17 00:00:00 2001 From: HgO Date: Sat, 7 Dec 2019 19:11:51 +0100 Subject: [PATCH 2/8] remove old python2 virtualenv --- scripts/upgrade | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 5548136..f233fc5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -123,7 +123,7 @@ renew_cert_repo="https://github.com/neutrinet/renew_cert" renew_cert_version=$(jq .version ../manifest.json -r -e | cut -d '~' -f 1) renew_cert_path="$opt_path/renew_cert" renew_cert_virtualenv="$renew_cert_path/ve" -renew_cert_python="$renew_cert_virtualenv/bin/python3" +renew_cert_python="$renew_cert_virtualenv/bin/python" renew_cert_cron_script="renew_cert_cron.sh" if [[ ! -e $renew_cert_path ]]; then @@ -141,7 +141,9 @@ cp $renew_cert_cron_script $renew_cert_path/$renew_cert_cron_script # From now on we work in the renew_cert directory cd $renew_cert_path -if [[ ! -e $renew_cert_virtualenv || $version < "0.3.0~ynh1" ]]; then +if [[ ! -e $renew_cert_python \ + || $($renew_cert_python --version 2>&1 | grep -q "Python 2") ]]; then + rm -f $renew_cert_virtualenv # We need system site packages otherwise moulinette is broken python3 -m venv $renew_cert_virtualenv --system-site-packages fi -- GitLab From e413e6615fa3d4d38e4beeff0c411a80edbd4323 Mon Sep 17 00:00:00 2001 From: HgO Date: Sat, 7 Dec 2019 19:22:18 +0100 Subject: [PATCH 3/8] Removing a folder with the -r option is more effecient --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index f233fc5..347162b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -143,7 +143,7 @@ cd $renew_cert_path if [[ ! -e $renew_cert_python \ || $($renew_cert_python --version 2>&1 | grep -q "Python 2") ]]; then - rm -f $renew_cert_virtualenv + rm -rf $renew_cert_virtualenv # We need system site packages otherwise moulinette is broken python3 -m venv $renew_cert_virtualenv --system-site-packages fi -- GitLab From d4994cc43d2b40b97553084e3dbd5d0c602a513c Mon Sep 17 00:00:00 2001 From: HgO Date: Sat, 7 Dec 2019 19:25:50 +0100 Subject: [PATCH 4/8] Bump version in manifest --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 2ce165e..2519a87 100644 --- a/manifest.json +++ b/manifest.json @@ -5,7 +5,7 @@ "en": "Auto renewal for the Neutrinet vpn-certificates", "fr": "Renouvellement automatique des certificats vpn Neutrinet" }, - "version": "0.3.0~ynh2", + "version": "0.3.0~ynh3", "license": "GPL-3+", "maintainer": { "name": "ilja", -- GitLab From 1590c2f99b713c13d70174f5dd87438d962ed00f Mon Sep 17 00:00:00 2001 From: HgO Date: Tue, 10 Dec 2019 19:10:43 +0100 Subject: [PATCH 5/8] fix 404 error on static page --- conf/nginx.conf | 2 +- scripts/install | 2 ++ scripts/upgrade | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 1ab95fd..af87669 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,4 +1,4 @@ -location PATHTOCHANGE/ { +location PATHTOCHANGE { alias ALIASTOCHANGE; index index.html; } diff --git a/scripts/install b/scripts/install index 38da003..be10161 100644 --- a/scripts/install +++ b/scripts/install @@ -42,6 +42,8 @@ fi # Normalize the url path syntax path_url=$(ynh_normalize_url_path $path_url) +# Trim trailing slashes +path_url=$(sed 's@*/$@@' <<< $path_url) # Check web path availability if ! ynh_webpath_available $domain $path_url diff --git a/scripts/upgrade b/scripts/upgrade index 347162b..a587cfb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -63,6 +63,12 @@ if [[ -z $path_url ]]; then fi fi +if [[ $path_url == */ ]]; then + # Trim trailing slashes + path_url=$(sed 's@/*$@@' <<< $path_url) + ynh_app_setting_set $app path_url $path_url +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -- GitLab From a983003e110d843dce5fcafc64d1e110684adce3 Mon Sep 17 00:00:00 2001 From: HgO Date: Thu, 12 Dec 2019 21:37:27 +0100 Subject: [PATCH 6/8] register web path during upgrade --- scripts/upgrade | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index a587cfb..24fca90 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -100,6 +100,17 @@ if [[ $version < "0.3.0~ynh1" ]]; then ynh_install_app_dependencies python3-venv libssl-dev libffi-dev python3-dev fi +if [[ $version < "0.3.0~ynh4" ]]; then + # Check web path availability + if ! ynh_webpath_available $domain $path_url + then + ynh_die "$domain$path_url is not available" + fi + + # Register (book) web path + ynh_webpath_register $app $domain $path_url +fi + #================================================= # PULL CHANGES AND SPECIFIC SETUP #================================================= -- GitLab From 2f4290b2b7b108bcf9e3978ca9aa8e999e39ff2d Mon Sep 17 00:00:00 2001 From: HgO Date: Thu, 12 Dec 2019 21:38:51 +0100 Subject: [PATCH 7/8] bump manifest version --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 2519a87..2f37189 100644 --- a/manifest.json +++ b/manifest.json @@ -5,7 +5,7 @@ "en": "Auto renewal for the Neutrinet vpn-certificates", "fr": "Renouvellement automatique des certificats vpn Neutrinet" }, - "version": "0.3.0~ynh3", + "version": "0.3.0~ynh4", "license": "GPL-3+", "maintainer": { "name": "ilja", -- GitLab From 76f0462bd36e97f77b45036d44d8f1854a781a70 Mon Sep 17 00:00:00 2001 From: HgO Date: Sat, 14 Dec 2019 09:30:18 +0100 Subject: [PATCH 8/8] remove webpath registration --- scripts/upgrade | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 1d5eba7..605b5b8 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -103,17 +103,6 @@ if [[ $version < "0.3.0~ynh4" ]]; then ynh_install_app_dependencies python3-openssl python3-requests fi -if [[ $version < "0.3.0~ynh4" ]]; then - # Check web path availability - if ! ynh_webpath_available $domain $path_url - then - ynh_die "$domain$path_url is not available" - fi - - # Register (book) web path - ynh_webpath_register $app $domain $path_url -fi - #================================================= # PULL CHANGES AND SPECIFIC SETUP #================================================= -- GitLab