diff --git a/scripts/upgrade b/scripts/upgrade index e2ec6d3..8908f70 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,7 +1,7 @@ #!/bin/bash #================================================= -# GENERIC STARTING +# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= +ynh_print_info "Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -29,6 +30,7 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= +ynh_print_info "Ensuring downward compatibility..." # If port doesn't exist, create it if [ -z "$port" ]; then @@ -39,6 +41,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= +ynh_print_info "Backing up the app before upgrading... (may take a while)" # Backup the current version of the app ynh_backup_before_upgrade @@ -53,7 +56,8 @@ ynh_abort_if_errors # CHECK THE PATH #================================================= -path_url=$(ynh_normalize_url_path $path_url) # Vérifie et corrige la syntaxe du path. +# Normalize the URL path syntax +path_url=$(ynh_normalize_url_path $path_url) #================================================= # ACTIVATE MAINTENANCE MODE @@ -66,29 +70,38 @@ ynh_maintenance_mode_ON #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_print_info "Upgrading source files..." if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_setup_source "$final_path" # Télécharge la source, décompresse et copie dans $final_path + # Download, check integrity, uncompress and patch the source from app.src + ynh_setup_source "$final_path" fi -#================================================= -# UPGRADE DEPENDENCIES -#================================================= - -ynh_install_app_dependencies python-virtualenv sqlite3 zlib1g-dev - #================================================= # NGINX CONFIGURATION #================================================= +ynh_print_info "Upgrading nginx configuration..." +# Create a dedicated nginx config ynh_add_nginx_config +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_print_info "Upgrading dependencies..." + +ynh_install_app_dependencies python-virtualenv sqlite3 zlib1g-dev + + #================================================= # CREATE DEDICATED USER #================================================= +ynh_print_info "Making sure dedicated system user exists..." + +# Create a dedicated user (if not existing) +ynh_system_user_create $app -ynh_system_user_create $app # Create the dedicated user, if not exist #================================================= # SPECIFIC UPGRADE @@ -108,17 +121,18 @@ ynh_store_file_checksum "/etc/systemd/system/$app.service" systemctl daemon-reload #================================================= -# GENERIC FINALISATION +# GENERIC FINALIZATION #================================================= -#================================================= -# SECURING FILES AND DIRECTORIES +# SECURE FILES AND DIRECTORIES #================================================= +# Set permissions on app files chown -R $app:root $final_path #================================================= # SETUP SSOWAT #================================================= +ynh_print_info "Upgrading SSOwat configuration..." # Make app public ynh_app_setting_set $app skipped_uris "/" @@ -126,6 +140,7 @@ ynh_app_setting_set $app skipped_uris "/" #================================================= # RELOAD NGINX #================================================= +ynh_print_info "Reloading nginx..." ynh_system_reload --service_name=nginx @@ -141,3 +156,9 @@ ynh_system_reload --service_name=$app --action=restart #================================================= ynh_maintenance_mode_OFF + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Upgrade of $app completed"