From 5e814bee595d1ea3c5e40b413720272d77883576 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sun, 17 Feb 2019 20:54:53 +0100 Subject: [PATCH] Add progression with ynh_print_info --- scripts/backup | 9 +++++++++ scripts/install | 12 ++++++++++++ scripts/remove | 9 +++++++++ scripts/restore | 10 ++++++++++ scripts/upgrade | 13 +++++++++++++ 5 files changed, 53 insertions(+) diff --git a/scripts/backup b/scripts/backup index 05aa5dc..2e8c22f 100755 --- a/scripts/backup +++ b/scripts/backup @@ -18,6 +18,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= +ynh_print_info "Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -29,11 +30,19 @@ final_path=$(ynh_app_setting_get $app final_path) #================================================= # BACKUP THE APP MAIN DIR #================================================= +ynh_print_info "Backing up the main app directory..." ynh_backup "$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= +ynh_print_info "Backing up nginx web server configuration..." ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/install b/scripts/install index 80f6485..e2ff11d 100755 --- a/scripts/install +++ b/scripts/install @@ -28,6 +28,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= +ynh_print_info "Validating installation parameters..." final_path=/var/www/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" @@ -41,6 +42,7 @@ ynh_webpath_register $app $domain $path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= +ynh_print_info "Storing installation settings..." ynh_app_setting_set $app domain $domain ynh_app_setting_set $app path $path_url @@ -51,6 +53,7 @@ ynh_app_setting_set $app is_public $is_public #================================================= # COPY SOURCES #================================================= +ynh_print_info "Setting up source files..." ynh_app_setting_set $app final_path $final_path # Copy files to the right place @@ -60,6 +63,7 @@ cp -a ../sources/. $final_path #================================================= # NGINX CONFIGURATION #================================================= +ynh_print_info "Configuring nginx web server..." # Create a dedicated nginx config ynh_add_nginx_config @@ -76,6 +80,7 @@ chown -R root: $final_path #================================================= # SETUP SSOWAT #================================================= +ynh_print_info "Configuring SSOwat..." # Make app public if necessary if [ $is_public -eq 1 ] @@ -87,5 +92,12 @@ fi #================================================= # RELOAD NGINX #================================================= +ynh_print_info "Reloading nginx web server..." systemctl reload nginx + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index d57b7a1..b7c1e96 100755 --- a/scripts/remove +++ b/scripts/remove @@ -11,6 +11,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= +ynh_print_info "Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -22,6 +23,7 @@ final_path=$(ynh_app_setting_get $app final_path) #================================================= # REMOVE APP MAIN DIR #================================================= +ynh_print_info "Removing app main directory" # Remove the app directory securely ynh_secure_remove "$final_path" @@ -29,6 +31,13 @@ ynh_secure_remove "$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= +ynh_print_info "Removing nginx web server configuration" # Remove the dedicated nginx config ynh_remove_nginx_config + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index 8620ae9..4d70bd5 100755 --- a/scripts/restore +++ b/scripts/restore @@ -18,6 +18,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= +ynh_print_info "Loading settings..." app=$YNH_APP_INSTANCE_NAME @@ -29,6 +30,7 @@ final_path=$(ynh_app_setting_get $app final_path) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= +ynh_print_info "Validating restoration parameters..." ynh_webpath_available $domain $path_url \ || ynh_die "Path not available: ${domain}${path_url}" @@ -46,6 +48,7 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= +ynh_print_info "Restoring the app main directory..." ynh_restore_file "$final_path" @@ -54,5 +57,12 @@ ynh_restore_file "$final_path" #================================================= # RELOAD NGINX #================================================= +ynh_print_info "Reloading nginx web server..." systemctl reload nginx + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index f2e8a8e..58a3c67 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -11,6 +11,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= +ynh_print_info "Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -22,6 +23,7 @@ final_path=$(ynh_app_setting_get $app final_path) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= +ynh_print_info "Ensuring downward compatibility..." # Fix is_public as a boolean value if [ "$is_public" = "Yes" ]; then @@ -41,6 +43,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 @@ -63,6 +66,7 @@ path_url=$(ynh_normalize_url_path $path_url) #================================================= # COPY SOURCES #================================================= +ynh_print_info "Upgrading source files..." # Copy files to the right place cp -a ../sources/. $final_path @@ -70,6 +74,7 @@ cp -a ../sources/. $final_path #================================================= # NGINX CONFIGURATION #================================================= +ynh_print_info "Upgrading nginx web server configuration..." # Create a dedicated nginx config ynh_add_nginx_config @@ -86,6 +91,7 @@ chown -R root: $final_path #================================================= # SETUP SSOWAT #================================================= +ynh_print_info "Upgrading SSOwat configuration..." # Make app public if necessary if [ $is_public -eq 1 ] @@ -97,5 +103,12 @@ fi #================================================= # RELOAD NGINX #================================================= +ynh_print_info "Reloading nginx web server..." systemctl reload nginx + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Upgrade of $app completed"