From 7f9b4457d024a7e501ff0f9518b0c19902bb88a5 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 12 May 2021 12:02:58 +0200 Subject: [PATCH] Fix --- README.md | 4 ++-- scripts/_common.sh | 3 --- scripts/install | 17 +++-------------- scripts/restore | 20 ++++++++++---------- scripts/upgrade | 26 ++++++++++++-------------- 5 files changed, 27 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 3654176..e670670 100644 --- a/README.md +++ b/README.md @@ -92,8 +92,8 @@ Reload PHP-FPM with `sudo service php*php_version*-fpm reload`. #### Supported architectures -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/flarum%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/flarum/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/flarum%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/flarum/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/flarum.svg)](https://ci-apps.yunohost.org/ci/apps/flarum/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/flarum.svg)](https://ci-apps-arm.yunohost.org/ci/apps/flarum/) ## Links diff --git a/scripts/_common.sh b/scripts/_common.sh index 264bb9b..1515bdd 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -2,9 +2,6 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -pkg_dependencies="" - swap_needed=1024 YNH_PHP_VERSION="7.3" diff --git a/scripts/install b/scripts/install index e8c2dd0..9b9d0b4 100644 --- a/scripts/install +++ b/scripts/install @@ -60,15 +60,6 @@ ynh_app_setting_set --app=$app --key=project_version --value=$project_version ynh_app_setting_set --app=$app --key=core_version --value=$core_version ynh_app_setting_set --app=$app --key=ldap_version --value=$ldap_version -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing dependencies..." --weight=2 - -ynh_install_app_dependencies $pkg_dependencies - #================================================= # CREATE A MYSQL DATABASE #================================================= @@ -103,8 +94,6 @@ ynh_script_progression --message="Configuring system user..." --weight=1 # Create a system user ynh_system_user_create --username=$app --home_dir=$final_path -# Adding it to www-data group -usermod -a -G www-data $app #================================================= # PHP-FPM CONFIGURATION @@ -146,9 +135,9 @@ ynh_exec_warn_less ynh_composer_exec --phpversion=$phpversion --workdir=$final_p ynh_script_progression --message="Securing files and directories..." # Set permissions to app files -chown -R $app:www-data $final_path -chmod -R ug+rw,o-rwx $final_path -chmod -R ug+x $final_path/flarum +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" #================================================= # FLARUM POST-INSTALL diff --git a/scripts/restore b/scripts/restore index bb6af6b..dfc9a87 100644 --- a/scripts/restore +++ b/scripts/restore @@ -51,13 +51,6 @@ ynh_script_progression --message="Restoring the nginx configuration..." ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RESTORE THE APP MAIN DIR -#================================================= -ynh_script_progression --message="Restoring the app main directory..." --weight=1 - -ynh_restore_file --origin_path="$final_path" - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -66,15 +59,22 @@ ynh_script_progression --message="Recreating the dedicated system user..." --wei # Create the dedicated user (if not existing) ynh_system_user_create --username=$app +#================================================= +# RESTORE THE APP MAIN DIR +#================================================= +ynh_script_progression --message="Restoring the app main directory..." --weight=1 + +ynh_restore_file --origin_path="$final_path" + #================================================= # RESTORE USER RIGHTS #================================================= ynh_script_progression --message="Restoring user rights..." # Set right permissions -chown -R $app:www-data $final_path -chmod -R ug+rw,o-rwx $final_path -chmod -R ug+x $final_path/flarum +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" #================================================= # RESTORE THE PHP-FPM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 3693082..396be85 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -75,6 +75,14 @@ if [ ! -z "$ssowat_extension" ]; then ynh_app_setting_delete --app=$app --key=ssowat_extension fi +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir=$final_path + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -127,7 +135,7 @@ fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1 +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 # Create a dedicated nginx config ynh_add_nginx_config @@ -139,16 +147,6 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=2 ynh_install_app_dependencies $pkg_dependencies -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir=$final_path -# Adding it to www-data group -usermod -a -G www-data $app - #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -249,9 +247,9 @@ ynh_use_logrotate --non-append ynh_script_progression --message="Securing files and directories..." # Set permissions on app files -chown -R $app:www-data $final_path -chmod -R ug+rw,o-rwx $final_path -chmod -R ug+x $final_path/flarum +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" #================================================= # RELOAD NGINX