From c10bdf2e159638244f7e3f476a6b2e489ae2bbed Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 17 Mar 2021 22:40:05 +0100 Subject: [PATCH 1/3] Cleaning up --- README.md | 2 +- manifest.json | 14 +------------- scripts/change_url | 17 +++++++++++++++++ scripts/install | 1 - scripts/upgrade | 17 +++++++---------- 5 files changed, 26 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 0b2600a..9cc54f7 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ *[Lire ce readme en français.](./README_fr.md)* -> *This package allow you to install anarchism quickly and simply on a YunoHost server. +> *This package allow you to install Anarchism quickly and simply on a YunoHost server. If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* ## Overview diff --git a/manifest.json b/manifest.json index ab87fd1..fe8459f 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "pierre@kayou.io" }, "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.1.7" }, "multi_instance": true, "services": [ @@ -25,29 +25,17 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain name for Anarchism", - "fr": "Choisissez un nom de domaine pour Anarchism" - }, "example": "example.com" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for Anarchism", - "fr": "Choisissez un chemin pour Anarchism" - }, "example": "/anarchism", "default": "/anarchism" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public application?", - "fr": "Est-ce une application publique ?" - }, "help": { "en": "If enabled, Anarchism will be accessible by people who do not have an account. This can be changed later via the webadmin.", "fr": "Si cette case est cochée, Anarchism sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." diff --git a/scripts/change_url b/scripts/change_url index df2740f..0f2e999 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -29,6 +29,23 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --time --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 #================================================= diff --git a/scripts/install b/scripts/install index 1cdf864..7c8aa2e 100755 --- a/scripts/install +++ b/scripts/install @@ -48,7 +48,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= # STANDARD MODIFICATIONS diff --git a/scripts/upgrade b/scripts/upgrade index 2466371..4dcf663 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,7 +18,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= @@ -32,15 +31,6 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# Fix is_public as a boolean value -if [ "$is_public" = "Yes" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=1 - is_public=1 -elif [ "$is_public" = "No" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=0 - is_public=0 -fi - # If this folder exists, delete the old version of anarchism, and replace it with the new way to installing it. if [ -d "/usr/share/doc/anarchism/html" ]; then ynh_remove_app_dependencies anarchism @@ -54,6 +44,13 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= From 80fecfea76cf3d952b3b698173682f59eb091a5a Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 22 Apr 2021 22:59:22 +0200 Subject: [PATCH 2/3] Fix Badges --- README.md | 4 ++-- README_fr.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9cc54f7..d8d65b4 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,8 @@ This is an anarchist FAQ. Its aim is to present what anarchism really stands for #### Supported architectures -* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/anarchism%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/anarchism/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/anarchism%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/anarchism/) +* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/anarchism.svg)](https://ci-apps.yunohost.org/ci/apps/anarchism/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/anarchism.svg)](https://ci-apps-arm.yunohost.org/ci/apps/anarchism/) ## Links diff --git a/README_fr.md b/README_fr.md index 013a5b2..1d89afa 100644 --- a/README_fr.md +++ b/README_fr.md @@ -34,8 +34,8 @@ Ceci est une FAQ anarchiste. Son objectif est de présenter ce que représente v #### Architectures supportées -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/anarchism%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/anarchism/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/anarchism%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/anarchism/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/anarchism.svg)](https://ci-apps.yunohost.org/ci/apps/anarchism/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/anarchism.svg)](https://ci-apps-arm.yunohost.org/ci/apps/anarchism/) ## Liens From a420110903910b1f483912c74ff413686be77a44 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 24 Apr 2021 23:47:32 +0200 Subject: [PATCH 3/3] Fix path --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d8d65b4..7f95c9d 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ *[Lire ce readme en français.](./README_fr.md)* > *This package allow you to install Anarchism quickly and simply on a YunoHost server. -If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* +If you don't have YunoHost, please see [here](https://yunohost.org/install) to know how to install and enjoy it.* ## Overview This is an anarchist FAQ. Its aim is to present what anarchism really stands for and indicate why you should become an anarchist. diff --git a/README_fr.md b/README_fr.md index 1d89afa..96061cf 100644 --- a/README_fr.md +++ b/README_fr.md @@ -6,7 +6,7 @@ *[Read this readme in english.](./README.md)* > *Ce package vous permet d'installer Anarchism rapidement et simplement sur un serveur YunoHost. -Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.* +Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/install) pour apprendre comment l'installer.* ## Vue d'ensemble Ceci est une FAQ anarchiste. Son objectif est de présenter ce que représente vraiment l'anarchisme et d'indiquer pourquoi vous devriez devenir anarchiste.