From e056804820adf7026cd086ce46b8dc1f98a9e3e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9rard=20Collin?= Date: Thu, 28 Sep 2023 10:56:24 +0200 Subject: [PATCH 1/3] Fix for backup error --- manifest.json | 2 +- scripts/backup | 7 +++++-- scripts/upgrade | 21 ++++++++++++++------- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/manifest.json b/manifest.json index 4b9eb4f..f9e059d 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "An advanced https proxy allowing you to call other websites from your own web application.", "fr": "Un proxy https avancé vous permettant d'appeler d'autres sites depuis votre propre application web." }, - "version": "1.2.0~ynh1", + "version": "1.2.0~ynh2", "url": "https://github.com/gcollin/cookie-aware-cors-proxy", "upstream": { "license": "MIT", diff --git a/scripts/backup b/scripts/backup index 26b95b8..9737690 100755 --- a/scripts/backup +++ b/scripts/backup @@ -30,6 +30,7 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) +public_key=$(ynh_app_setting_get --app=$app --key=public_key) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -56,8 +57,10 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # SPECIFIC BACKUP #================================================= -ynh_backup --src_path="/etc/sudoers.d/$app-sudoers" - +if [ -n "$public_key" ] +then + ynh_backup --src_path="/etc/sudoers.d/$app-sudoers" +fi # BACKUP LOGROTATE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 66d1d60..ff0d7e5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -38,17 +38,24 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 +# There is an issue in previous backup file in case of non public_key, so backup only in case of public_key +if [ -n "$public_key" ] +then + + ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 + + # Backup the current version of the app + ynh_backup_before_upgrade + ynh_clean_setup () { + # Restore it if the upgrade fails + ynh_restore_upgradebackup + } +fi -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - # Restore it if the upgrade fails - ynh_restore_upgradebackup -} # Exit if an error occurs during the execution of the script ynh_abort_if_errors + #================================================= # STANDARD UPGRADE STEPS #================================================= From f14ed877c478ceb5beb61f203bc5231e07c4c6a3 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 28 Sep 2023 08:56:46 +0000 Subject: [PATCH 2/3] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 10c572b..1fb0185 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ With Cookie Aware Cors Proxy, you can call a website not supporting CORS from yo - Two engines: a lightweight and one based on chrome to support websites running javascript -**Shipped version:** 1.2.0~ynh1 +**Shipped version:** 1.2.0~ynh2 ## Screenshots diff --git a/README_fr.md b/README_fr.md index c00a3ad..4552b5e 100644 --- a/README_fr.md +++ b/README_fr.md @@ -27,7 +27,7 @@ With Cookie Aware Cors Proxy, you can call a website not supporting CORS from yo - Two engines: a lightweight and one based on chrome to support websites running javascript -**Version incluse :** 1.2.0~ynh1 +**Version incluse :** 1.2.0~ynh2 ## Captures d’écran From cf01d3f9ab2f307fce610fe39aa0f271340bd763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9rard=20Collin?= Date: Thu, 28 Sep 2023 11:28:10 +0200 Subject: [PATCH 3/3] Better fix by creating expected file --- scripts/upgrade | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index ff0d7e5..73aad75 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -38,18 +38,25 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -# There is an issue in previous backup file in case of non public_key, so backup only in case of public_key -if [ -n "$public_key" ] +# There is an issue in previous backup file in case of non public_key, so we create the missing directory +if [ ! -f "/etc/sudoers.d/$app-sudoers" ] then + touch "/etc/sudoers.d/$app-sudoers" +fi - ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 - # Backup the current version of the app - ynh_backup_before_upgrade - ynh_clean_setup () { - # Restore it if the upgrade fails - ynh_restore_upgradebackup - } +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # Restore it if the upgrade fails + ynh_restore_upgradebackup +} + +# Removes the directory created only for backup if not necessary +if [ ! -n "$public_key" ] +then + rm "/etc/sudoers.d/$app-sudoers" fi # Exit if an error occurs during the execution of the script