From 8b95e6704df35282f44b36e765fab8426e574415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 20 Mar 2021 18:33:05 +0100 Subject: [PATCH] Testing (#6) * Update change_url * Update manifest.json --- manifest.json | 16 ++-------------- scripts/change_url | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/manifest.json b/manifest.json index f3b92d6..1d746f4 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Minimalist pastebin where the server has zero knowledge of pasted data", "fr": "Pastebin minimaliste où le serveur n'a aucune connaissance des données copiées" }, - "version": "1.3.4~ynh2", + "version": "1.3.4~ynh3", "url": "https://github.com/PrivateBin/PrivateBin", "license": "Zlib", "maintainer": { @@ -14,7 +14,7 @@ "email": "julien.malik@paraiso.me" }, "requirements": { - "yunohost": ">= 4.0.0" + "yunohost": ">= 4.1.7" }, "multi_instance": true, "services": [ @@ -26,29 +26,17 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain for PrivateBin", - "fr": "Choisissez un domaine pour PrivateBin" - }, "example": "domain.org" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for PrivateBin", - "fr": "Choisissez un chemin pour PrivateBin" - }, "example": "/privatebin", "default": "/privatebin" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public site?", - "fr": "Est-ce un site public ?" - }, "help": { "en": "If private, only YunoHost users can create a paste, but everyone can read it.", "fr": "Si privé, seul les utilisateurs YunoHost peuvent créer un paste, mais tout le monde peut lire." diff --git a/scripts/change_url b/scripts/change_url index ac2c77f..d7240ac 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -30,6 +30,23 @@ ynh_script_progression --message="Loading installation settings..." final_path=$(ynh_app_setting_get --app=$app --key=final_path) is_public=$(ynh_app_setting_get --app=$app --key=is_public) +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. + ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" + + # Restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED #================================================= @@ -80,7 +97,7 @@ fi #================================================= # UPDATE SSOWAT #================================================= -ynh_script_progression --message="Reconfiguring SSOwat..." +ynh_script_progression --message="Reconfiguring permissions..." if [ $is_public -eq 0 ] then