1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/anarchism_ynh.git synced 2024-09-03 18:05:55 +02:00

Merge pull request #10 from YunoHost-Apps/patch

Cleaning up
This commit is contained in:
Éric Gaspar 2021-04-24 23:44:21 +02:00 committed by GitHub
commit 3f459152be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 29 deletions

View file

@ -5,7 +5,7 @@
*[Lire ce readme en français.](./README_fr.md)* *[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.* If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
## Overview ## Overview
@ -34,8 +34,8 @@ This is an anarchist FAQ. Its aim is to present what anarchism really stands for
#### Supported architectures #### 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/) * 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%20%28Apps%29.svg)](https://ci-apps-arm.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 ## Links

View file

@ -34,8 +34,8 @@ Ceci est une FAQ anarchiste. Son objectif est de présenter ce que représente v
#### Architectures supportées #### 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/) * 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%20%28Apps%29.svg)](https://ci-apps-arm.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 ## Liens

View file

@ -14,7 +14,7 @@
"email": "pierre@kayou.io" "email": "pierre@kayou.io"
}, },
"requirements": { "requirements": {
"yunohost": ">= 3.8.1" "yunohost": ">= 4.1.7"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
@ -25,29 +25,17 @@
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain",
"ask": {
"en": "Choose a domain name for Anarchism",
"fr": "Choisissez un nom de domaine pour Anarchism"
},
"example": "example.com" "example": "example.com"
}, },
{ {
"name": "path", "name": "path",
"type": "path", "type": "path",
"ask": {
"en": "Choose a path for Anarchism",
"fr": "Choisissez un chemin pour Anarchism"
},
"example": "/anarchism", "example": "/anarchism",
"default": "/anarchism" "default": "/anarchism"
}, },
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",
"ask": {
"en": "Is it a public application?",
"fr": "Est-ce une application publique ?"
},
"help": { "help": {
"en": "If enabled, Anarchism will be accessible by people who do not have an account. This can be changed later via the webadmin.", "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 nayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." "fr": "Si cette case est cochée, Anarchism sera accessible aux personnes nayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."

View file

@ -29,6 +29,23 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config" # Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path) 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 # CHECK WHICH PARTS SHOULD BE CHANGED
#================================================= #=================================================

View file

@ -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=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url 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 # STANDARD MODIFICATIONS

View file

@ -18,7 +18,6 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) 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) 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 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 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 if [ -d "/usr/share/doc/anarchism/html" ]; then
ynh_remove_app_dependencies anarchism 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 ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi 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 # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================