From 2010081fe4ffac6a03adca7112e72b19159e4369 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 10 Apr 2021 00:46:33 +0200 Subject: [PATCH] Apply example_ynh --- README.md | 4 ++-- README_fr.md | 4 ++-- check_process | 2 +- manifest.json | 2 +- scripts/install | 33 ++++++++++++++++----------------- scripts/restore | 30 +++++++++++++----------------- scripts/upgrade | 25 ++++++++----------------- 7 files changed, 43 insertions(+), 57 deletions(-) diff --git a/README.md b/README.md index 537e27e..175a8ca 100644 --- a/README.md +++ b/README.md @@ -48,8 +48,8 @@ The admin interface is accessible at the address: `your.domain.fr/api/admin` #### Supported architectures -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/funkwhale%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/funkwhale/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/funkwhale%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/funkwhale/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/funkwhale.svg)](https://ci-apps.yunohost.org/ci/apps/funkwhale/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/funkwhale.svg)](https://ci-apps-arm.yunohost.org/ci/apps/funkwhale/) ## Links diff --git a/README_fr.md b/README_fr.md index 3f7a8cc..5075921 100644 --- a/README_fr.md +++ b/README_fr.md @@ -44,8 +44,8 @@ L'interface d'administration est accessible à l'adresse : votre.domaine.fr/api/ #### Architectures supportées -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/funkwhale%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/funkwhale/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/funkwhale%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/funkwhale/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/funkwhale.svg)](https://ci-apps.yunohost.org/ci/apps/funkwhale/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/funkwhale.svg)](https://ci-apps-arm.yunohost.org/ci/apps/funkwhale/) ## Liens diff --git a/check_process b/check_process index ea05a96..f2bb656 100644 --- a/check_process +++ b/check_process @@ -24,7 +24,7 @@ multi_instance=1 incorrect_path=0 port_already_use=0 - change_url=0 + change_url=1 ;;; Options Email=cda@rootkey.co.uk Notification=all diff --git a/manifest.json b/manifest.json index e81660e..22a20a8 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Modern, convivial and free music server", "fr": "Serveur de musique moderne, convivial et gratuit" }, - "version": "1.1~ynh2", + "version": "1.1~ynh3", "url": "https://funkwhale.audio", "license": "AGPL-3.0-or-later", "maintainer": { diff --git a/scripts/install b/scripts/install index 2f845c1..4a919f0 100644 --- a/scripts/install +++ b/scripts/install @@ -72,6 +72,14 @@ ynh_script_progression --message="Installing dependencies..." ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." + +# Create a system user +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # CREATE A POSTGRESQL DATABASE #================================================= @@ -103,11 +111,19 @@ pushd $final_path mkdir -p config popd +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R root:$app "$final_path" + mkdir -p $datadir pushd $datadir mkdir -p static media music popd +chmod 750 "$datadir" +chmod -R o-rwx "$datadir" +chown -R root:$app "$datadir" + #================================================= # NGINX CONFIGURATION #================================================= @@ -116,14 +132,6 @@ ynh_script_progression --message="Configuring NGINX web server..." # Create a dedicated NGINX config ynh_add_nginx_config "datadir" -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." - -# Create a system user -ynh_system_user_create --username=$app --home_dir=$final_path - #================================================= # SPECIFIC SETUP #================================================= @@ -185,15 +193,6 @@ ynh_add_systemd_config --service="${app}-beat" --template="funkwhale-beat.serv #================================================= # GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Securing files and directories..." - -# Set permissions to app files -chown -R $app: $final_path -chown -R $app: $datadir - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= diff --git a/scripts/restore b/scripts/restore index 6fb0d91..1eaff2d 100644 --- a/scripts/restore +++ b/scripts/restore @@ -23,7 +23,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -54,6 +54,14 @@ ynh_script_progression --message="Restoring the NGINX web server configuration.. ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +#================================================= +# RECREATE THE DEDICATED USER +#================================================= +ynh_script_progression --message="Recreating the dedicated system user..." + +# Create the dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -61,21 +69,9 @@ ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$final_path" -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." - -# Create the dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir=$final_path - -#================================================= -# RESTORE USER RIGHTS -#================================================= -ynh_script_progression --message="Restoring user rights..." - -# Restore permissions on app files -chown -R $app: $final_path +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R root:$app "$final_path" #================================================= # SPECIFIC RESTORATION @@ -131,7 +127,7 @@ ynh_systemd_action --service_name="${app}-worker" --action="start" --log_path="s #================================================= # RESTORE VARIOUS FILES #================================================= -ynh_script_progression --message="Restoring the various files..." +ynh_script_progression --message="Restoring various files..." ynh_restore_file --origin_path="$datadir" --not_mandatory diff --git a/scripts/upgrade b/scripts/upgrade index 695722e..f48c800 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -127,6 +127,14 @@ if [ -z "$datadir" ]; then upgrade_type="UPGRADE_APP" fi +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -157,14 +165,6 @@ ynh_script_progression --message="Upgrading dependencies..." ynh_install_app_dependencies $pkg_dependencies -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir=$final_path - #================================================= # SPECIFIC UPGRADE #================================================= @@ -238,15 +238,6 @@ ynh_add_systemd_config --service="${app}-beat" --template="funkwhale-beat.serv #================================================= # GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Securing files and directories..." - -# Set permissions on app files -chown -R $app: $final_path -chown -R $app: $datadir - #================================================= # INTEGRATE SERVICE IN YUNOHOST #=================================================