From a8a7d70e3d02a32cc2ba109817f61e061b1a8bf2 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 28 Apr 2021 23:49:17 +0200 Subject: [PATCH] Cleaning up --- README.md | 8 ++++---- README_fr.md | 8 ++++---- manifest.json | 22 +--------------------- pull_request_template.md | 4 +--- scripts/change_url | 23 ++++++++++++++++++++--- scripts/install | 7 +++---- scripts/restore | 4 ++-- scripts/upgrade | 19 ++++++++----------- 8 files changed, 43 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 163bc16..e5a9c4b 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ *[Lire ce readme en français.](./README_fr.md)* > *This package allow you to install FluxBB 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 @@ -30,7 +30,7 @@ How to configure this app: by the admin panel. ## Documentation * Official documentation: https://fluxbb.org/docs/ - * YunoHost documentation: https://yunohost.org/#/app_fluxbb + * YunoHost documentation: https://yunohost.org/en/app_fluxbb ## YunoHost specific features @@ -41,8 +41,8 @@ How to configure this app: by the admin panel. #### Supported architectures -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/fluxbb%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/fluxbb/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/fluxbb%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/fluxbb/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/fluxbb.svg)](https://ci-apps.yunohost.org/ci/apps/fluxbb/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/fluxbb.svg)](https://ci-apps-arm.yunohost.org/ci/apps/fluxbb/) ## Limitations diff --git a/README_fr.md b/README_fr.md index 6443baf..9088bae 100644 --- a/README_fr.md +++ b/README_fr.md @@ -7,7 +7,7 @@ *[Read this readme in english.](./README.md)* > *Ce package vous permet d'installer FluxBB rapidement et simplement sur un serveur Yunohost. -Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* +Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/install) pour savoir comment l'installer et en profiter.* ## Vue d'ensemble @@ -30,7 +30,7 @@ Comment configurer cette application : via le panneau d'administration. ## Documentation * Documentation officielle: https://fluxbb.org/docs/ - * Documentation YunoHost: https://yunohost.org/#/app_fluxbb + * Documentation YunoHost: https://yunohost.org/fr/app_fluxbb ## Caractéristiques spécifiques YunoHost @@ -41,8 +41,8 @@ Comment configurer cette application : via le panneau d'administration. #### Architectures supportées -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/fluxbb%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/fluxbb/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/fluxbb%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/fluxbb/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/fluxbb.svg)](https://ci-apps.yunohost.org/ci/apps/fluxbb/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/fluxbb.svg)](https://ci-apps-arm.yunohost.org/ci/apps/fluxbb/) ## Limitations diff --git a/manifest.json b/manifest.json index cb6285a..7a47020 100644 --- a/manifest.json +++ b/manifest.json @@ -15,7 +15,7 @@ "url": "https://miaou.org" }, "requirements": { - "yunohost": ">= 4.0.0" + "yunohost": ">= 4.1.7" }, "multi_instance": true, "services": [ @@ -28,38 +28,22 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain name for FluxBB", - "fr": "Choisissez un nom de domaine pour FluxBB" - }, "example": "example.com" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for FluxBB", - "fr": "Choisissez un chemin pour FluxBB" - }, "example": "/forum", "default": "/fluxbb" }, { "name": "admin", "type": "user", - "ask": { - "en": "Choose an admin user", - "fr": "Choisissez l’administrateur" - }, "example": "johndoe" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public application?", - "fr": "Est-ce une application publique ?" - }, "help": { "en": "Visibility of the forum", "fr": "La visibilité du forum" @@ -79,10 +63,6 @@ { "name": "password", "type": "password", - "ask": { - "en": "Set the administrator password", - "fr": "Définissez le mot de passe administrateur" - } } ] } diff --git a/pull_request_template.md b/pull_request_template.md index 1d15a15..6c28fc5 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -13,6 +13,4 @@ ## Package_check results --- -*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results* - -[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/fluxbb_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/fluxbb_ynh%20PR-NUM-%20(USERNAME)/) +* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"* diff --git a/scripts/change_url b/scripts/change_url index b553ee3..a8dce33 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -24,11 +24,28 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get $app final_path) +#================================================= +# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." + +# 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 THE SYNTAX OF THE PATHS #================================================= @@ -59,7 +76,7 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_print_info "Updating nginx web server configuration..." +ynh_script_progression --message="Updating nginx web server configuration..." nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -90,7 +107,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_print_info "Reloading NGINX web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/install b/scripts/install index cf3d38e..9628152 100755 --- a/scripts/install +++ b/scripts/install @@ -51,7 +51,6 @@ ynh_script_progression --message="Storing installation settings..." 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=admin --value=$admin -ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=language --value=$language #================================================= @@ -110,7 +109,7 @@ chown -R $app: $final_path #================================================= # Set the app as temporarily public for cURL call -ynh_permission_update --permission "main" --add "visitors" +ynh_permission_update --permission="main" --add="visitors" # Reload NGINX ynh_systemd_action --service_name=nginx --action=reload @@ -131,11 +130,11 @@ yunohost service add $app --description="Fast, light, user-friendly forum softwa #================================================= # SETUP SSOWAT #================================================= -ynh_print_info "Configuring SSOwat..." +ynh_print_info "Configuring permissions..." if [ $is_public -eq 0 ] then - ynh_permission_update --permission "main" --remove "visitors" + ynh_permission_update --permission="main" --remove="visitors" fi #================================================= diff --git a/scripts/restore b/scripts/restore index 8cce013..aeaf963 100755 --- a/scripts/restore +++ b/scripts/restore @@ -101,8 +101,8 @@ yunohost service add $app --description="Fast, light, user-friendly forum softwa #================================================= ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." -systemctl reload php$phpversion-fpm -systemctl reload nginx +ynh_systemd_action --service_name=php$phpversion-fpm --action=reload +ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/upgrade b/scripts/upgrade index 44a39b6..367cabd 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,7 +19,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) admin=$(ynh_app_setting_get --app=$app --key=admin) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) language=$(ynh_app_setting_get --app=$app --key=language) db_name=$(ynh_app_setting_get --app=$app --key=db_name) @@ -30,15 +29,6 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= ynh_print_info "Ensuring downward compatibility..." -# Fix is_public as a boolean value -if [ "$is_public" = "Yes" ]; then - ynh_app_setting_set $app is_public 1 - is_public=1 -elif [ "$is_public" = "No" ]; then - ynh_app_setting_set $app is_public 0 - is_public=0 -fi - # If db_name doesn't exist, create it if [ -z $db_name ]; then db_name=$(ynh_sanitize_dbid $app) @@ -51,6 +41,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 #================================================= @@ -78,7 +75,7 @@ ynh_setup_source "$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info "Upgrading nginx web server configuration..." +ynh_print_info "Upgrading NGINX web server configuration..." # Create a dedicated nginx config ynh_add_nginx_config