From 6bacbf3f0b5ed5c25d40cfe798b0518c820e1212 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Mon, 4 Mar 2019 16:24:27 +0100 Subject: [PATCH] Add progression with ynh_print_info --- scripts/backup | 9 +++++++++ scripts/install | 13 +++++++++++++ scripts/remove | 3 +++ scripts/restore | 11 +++++++++++ scripts/upgrade | 11 +++++++++++ 5 files changed, 47 insertions(+) diff --git a/scripts/backup b/scripts/backup index 0f05aaa..24a3678 100644 --- 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 @@ -28,6 +29,7 @@ domain=$(ynh_app_setting_get $app domain) #================================================= # BACKUP THE APP MAIN DIR #================================================= +ynh_print_info "Backing up the main app directory..." ynh_backup "/etc/shellinabox" ynh_backup "/etc/default/shellinabox" @@ -35,5 +37,12 @@ ynh_backup "/etc/default/shellinabox" #================================================= # 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 1be1f1d..c018ed9 100644 --- a/scripts/install +++ b/scripts/install @@ -27,6 +27,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= +ynh_print_info "Validating installation parameters..." # Normalize the url path syntax path_url=$(ynh_normalize_url_path $path_url) @@ -37,6 +38,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 @@ -46,6 +48,7 @@ ynh_app_setting_set $app path $path_url #================================================= # FIND AND OPEN A PORT #================================================= +ynh_print_info "Looking for a free port..." # Find a free port port=$(ynh_find_port 4200) @@ -54,6 +57,7 @@ ynh_app_setting_set $app port $port #================================================= # INSTALL SHELLINABOX #================================================= +ynh_print_info "Installing shellinabox..." ynh_package_update ynh_package_install shellinabox @@ -61,6 +65,7 @@ ynh_package_install shellinabox #================================================= # NGINX CONFIGURATION #================================================= +ynh_print_info "Configuring nginx web server..." # Create a dedicated nginx config ynh_add_nginx_config @@ -70,6 +75,7 @@ ynh_add_nginx_config #================================================= # CONFIGURE SHELLINABOX #================================================= +ynh_print_info "Configuring shellinabox..." cp ../conf/shellinabox /etc/default/shellinabox ynh_replace_string "__PORT__" "$port" "/etc/default/shellinabox" @@ -98,5 +104,12 @@ yunohost service add $app #================================================= # 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 37e9b19..cc64979 100644 --- 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 @@ -33,12 +34,14 @@ fi #================================================= # REMOVE SHELLINABOX #================================================= +ynh_print_info "Removing shellinabox" ynh_package_autopurge shellinabox #================================================= # REMOVE NGINX CONFIGURATION #================================================= +ynh_print_info "Removing nginx web server configuration" # Remove the dedicated nginx config ynh_remove_nginx_config diff --git a/scripts/restore b/scripts/restore index 00daa65..a8a979e 100644 --- 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 @@ -28,6 +29,7 @@ port=$(ynh_app_setting_get $app port) #================================================= # 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}" @@ -43,6 +45,7 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # INSTALL SHELLINABOX #================================================= +ynh_print_info "Installing shellinabox..." ynh_package_update ynh_package_install shellinabox @@ -50,6 +53,7 @@ ynh_package_install shellinabox #================================================= # RESTORE THE APP MAIN DIR #================================================= +ynh_print_info "Restoring the app main directory..." ynh_restore_file "/etc/shellinabox" ynh_restore_file "/etc/default/shellinabox" @@ -71,5 +75,12 @@ yunohost service add $app #================================================= # RELOAD NGINX #================================================= +ynh_print_info "Reloading nginx web server and php-fpm..." systemctl reload nginx + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index 4a492cf..0cef4c3 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 @@ -21,6 +22,7 @@ port=$(ynh_app_setting_get $app port) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= +ynh_print_info "Ensuring downward compatibility..." # If port doesn't exist, create it if [ -z "$port" ]; then @@ -31,6 +33,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,6 +56,7 @@ path_url=$(ynh_normalize_url_path $path_url) #================================================= # NGINX CONFIGURATION #================================================= +ynh_print_info "Upgrading nginx web server configuration..." # Create a dedicated nginx config ynh_add_nginx_config @@ -60,6 +64,7 @@ ynh_add_nginx_config #================================================= # CONFIGURE SHELLINABOX #================================================= +ynh_print_info "Upgrading shellinabox configuration..." # Verify the checksum and backup the file if it's different ynh_backup_if_checksum_is_different "/etc/default/shellinabox" @@ -83,6 +88,12 @@ ynh_store_file_checksum "/etc/default/shellinabox" #================================================= # RELOAD NGINX #================================================= +ynh_print_info "Reloading nginx web server..." systemctl reload nginx +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Upgrade of $app completed"