From 9e33abd061ee8c1609a6d406255909f28e45aa84 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 26 May 2021 12:16:06 +0200 Subject: [PATCH] Reorder --- check_process | 1 - manifest.json | 2 +- scripts/install | 32 ++++++++++---------------------- scripts/remove | 14 +++++++------- scripts/restore | 14 +++++--------- scripts/upgrade | 31 ++++++++++++------------------- 6 files changed, 35 insertions(+), 59 deletions(-) diff --git a/check_process b/check_process index dd5eafe..c587673 100644 --- a/check_process +++ b/check_process @@ -14,7 +14,6 @@ upgrade=1 from_commit=73f74039fb63adc555222d73ded6b43a64d41456 backup_restore=1 multi_instance=0 - port_already_use=0 change_url=1 ;;; Upgrade options ; commit=73f74039fb63adc555222d73ded6b43a64d41456 diff --git a/manifest.json b/manifest.json index 7b18649..fe2a240 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Modern HTTP web server index for NGINX.", "fr": "Serveur moderne d'index pour NGINX." }, - "version": "0.30.0~ynh1", + "version": "0.30.0~ynh2", "url": "https://larsjung.de/h5ai/", "upstream": { "license": "MIT", diff --git a/scripts/install b/scripts/install index 34b51ad..6c7ce89 100644 --- a/scripts/install +++ b/scripts/install @@ -45,20 +45,27 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url test ! -e "$final_path" || ynh_die "This path already contains a folder" #================================================= -# STORE SETTINGS FROM MANIFEST +# CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Storing installation settings..." --weight=1 +ynh_script_progression --message="Configuring system user..." --weight=1 -ynh_app_setting_set --app=$app --key=final_path --value=$final_path +# Create a system user +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=4 +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 "$final_path" +# Restore permissions on app files +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= @@ -67,25 +74,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1 # Create a dedicated nginx config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=1 - -# Create a system user -ynh_system_user_create --username=$app - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Restore permissions on app files -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" - #================================================= # SETUP SSOWAT #================================================= diff --git a/scripts/remove b/scripts/remove index 09f0850..734f57e 100644 --- a/scripts/remove +++ b/scripts/remove @@ -26,6 +26,13 @@ ynh_script_progression --message="Removing $app main directory..." --weight=3 # Remove sources ynh_secure_remove --file="$final_path" +#================================================= +# REMOVE THE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 + +ynh_remove_nginx_config + #================================================= # REMOVE DEDICATED USER #================================================= @@ -34,13 +41,6 @@ ynh_script_progression --message="Removing the dedicated system user..." --weigh # Delete a system user ynh_system_user_delete --username=$app -#================================================= -# REMOVE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - -ynh_remove_nginx_config - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 062c192..8dd74e8 100644 --- a/scripts/restore +++ b/scripts/restore @@ -44,24 +44,20 @@ test ! -d $final_path \ 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=4 - -ynh_restore_file --origin_path="$final_path" - #================================================= # RECREATE THE DEDICATED USER #================================================= ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= -# RESTORE USER RIGHTS +# RESTORE THE APP MAIN DIR #================================================= +ynh_script_progression --message="Restoring the app main directory..." --weight=4 + +ynh_restore_file --origin_path="$final_path" # Restore permissions on app files chmod 750 "$final_path" diff --git a/scripts/upgrade b/scripts/upgrade index 63f4e5d..facb0ac 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -49,6 +49,13 @@ if ynh_legacy_permissions_exists; then ynh_app_setting_delete --app=$app --key=is_public 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 @@ -76,6 +83,11 @@ then ynh_setup_source --dest_dir="$final_path" fi +# Set permissions on app files +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= @@ -84,25 +96,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# 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 - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions on app files -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" - #================================================= # RELOAD NGINX #=================================================