From 278c5c78694273f9d4be910a10b88d4580b22488 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 27 May 2021 17:16:06 +0200 Subject: [PATCH] Add templates --- manifest.json | 12 ++++++++++-- scripts/install | 13 +++++-------- scripts/restore | 25 +++++++++++-------------- scripts/upgrade | 27 ++++++++++++--------------- 4 files changed, 38 insertions(+), 39 deletions(-) diff --git a/manifest.json b/manifest.json index 8fb76b7..c941523 100644 --- a/manifest.json +++ b/manifest.json @@ -6,15 +6,23 @@ "en": "Simple, Fast, Secure, Flat-File CMS", "fr": "CMS simple, rapide, sécurisé et à fichier plat" }, - "version": "3.13.1~ynh3", + "version": "3.13.1~ynh4", "url": "www.bludit.com", + "upstream": { + "license": "MIT", + "website": "www.bludit.com", + "demo": "https://demo.example.com", + "admindoc": "https://docs.bludit.com/en/", + "userdoc": "https://yunohost.org/en/app_bludit", + "code": "https://github.com/bludit/bludit" + }, "license": "MIT", "maintainer": { "name": "eric_G", "email": "" }, "requirements": { - "yunohost": ">= 4.1.7" + "yunohost": ">= 4.2.4" }, "multi_instance": true, "services": [ diff --git a/scripts/install b/scripts/install index 94e6c63..cd5c221 100644 --- a/scripts/install +++ b/scripts/install @@ -51,7 +51,7 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_script_progression --message="Configuring system user..." --weight=1 # Create a system user -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -62,6 +62,10 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= @@ -79,13 +83,6 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=2 ynh_add_fpm_config --package="$extra_php_dependencies" phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions to app files -chown -R $app: $final_path - #================================================= # SETUP SSOWAT #================================================= diff --git a/scripts/restore b/scripts/restore index 33d914d..0b183a0 100644 --- a/scripts/restore +++ b/scripts/restore @@ -45,6 +45,14 @@ test ! -d $final_path \ 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..." --weight=3 + +# Create the dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -52,20 +60,9 @@ ynh_script_progression --message="Restoring Bludit main directory..." --weight=2 ynh_restore_file --origin_path="$final_path" -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=3 - -# Create the dedicated user (if not existing) -ynh_system_user_create --username=$app - -#================================================= -# RESTORE USER RIGHTS -#================================================= - -# Set permissions to app files -chown -R $app: $final_path +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 0546bca..9633952 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -67,21 +67,13 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 - -# Create a dedicated PHP-FPM config -ynh_add_fpm_config --package="$extra_php_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 +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # SPECIFIC UPGRADE @@ -100,12 +92,9 @@ then ynh_setup_source --dest_dir=$final_path fi -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions to app files -chown -R $app: $final_path +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" #================================================= # RELOAD NGINX @@ -114,6 +103,14 @@ ynh_script_progression --message="Reloading NGINX web server..." --weight=2 ynh_systemd_action --service_name=nginx --action=reload +#================================================= +# PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 + +# Create a dedicated PHP-FPM config +ynh_add_fpm_config --package="$extra_php_dependencies" + #================================================= # END OF SCRIPT #=================================================