From cddc197449e834883248f569a51ada8b6012418b Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 10 Jul 2021 14:46:35 +0200 Subject: [PATCH] Add weight --- scripts/change_url | 2 +- scripts/install | 24 ++++++++++++------------ scripts/remove | 16 ++++++++-------- scripts/restore | 20 ++++++++++---------- scripts/upgrade | 22 +++++++++++----------- 5 files changed, 42 insertions(+), 42 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 20d878f..3658832 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -96,7 +96,7 @@ fi #================================================= # SETUP A CRON #================================================= -ynh_script_progression --message="Setuping a cron..." +ynh_script_progression --message="Setuping a cron..." --weight=1 path=$new_path domain=$new_domain diff --git a/scripts/install b/scripts/install index bcb0142..af0fc07 100755 --- a/scripts/install +++ b/scripts/install @@ -31,7 +31,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." +ynh_script_progression --message="Validating installation parameters..." --weight=1 final_path=/var/www/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" @@ -42,7 +42,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." +ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url @@ -50,7 +50,7 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url #================================================= # CREATE A MYSQL DATABASE #================================================= -ynh_script_progression --message="Creating a MySQL database..." +ynh_script_progression --message="Creating a MySQL database..." --weight=1 db_name=$(ynh_sanitize_dbid --db_name=$app) db_user=$db_name @@ -60,7 +60,7 @@ ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." +ynh_script_progression --message="Configuring system user..." --weight=1 # Create a system user ynh_system_user_create --username=$app --home_dir="$final_path" @@ -68,7 +68,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." +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 @@ -82,7 +82,7 @@ chown -R $app:www-data "$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring NGINX web server..." +ynh_script_progression --message="Configuring NGINX web server..." --weight=2 # Create a dedicated NGINX config ynh_add_nginx_config @@ -90,7 +90,7 @@ ynh_add_nginx_config #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring PHP-FPM..." +ynh_script_progression --message="Configuring PHP-FPM..." --weight=3 # Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies" @@ -99,7 +99,7 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # SETUP A CRON #================================================= -ynh_script_progression --message="Setuping a cron..." +ynh_script_progression --message="Setuping a cron..." --weight=1 ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" chown root: "/etc/cron.d/$app" @@ -108,7 +108,7 @@ chmod 644 "/etc/cron.d/$app" #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring permissions..." +ynh_script_progression --message="Configuring permissions..." --weight=1 # Make app public if necessary or protect it if [ $is_public -eq 1 ] @@ -119,14 +119,14 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload #================================================= # SEND A README FOR THE ADMIN #================================================= -ynh_script_progression --message="Sending a readme for the admin..." +ynh_script_progression --message="Sending a readme for the admin..." --weight=1 message="Matomo was successfully installed :) @@ -147,4 +147,4 @@ ynh_send_readme_to_admin "$message" # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of Matomo completed" +ynh_script_progression --message="Installation of Matomo completed" --last diff --git a/scripts/remove b/scripts/remove index b1472df..a0d4af7 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -26,7 +26,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # REMOVE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Removing the MySQL database..." +ynh_script_progression --message="Removing the MySQL database..." --weight=1 # Remove a database if it exists, along with the associated user ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name @@ -34,7 +34,7 @@ ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing Matomo main directory..." +ynh_script_progression --message="Removing Matomo main directory..." --weight=2 # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -42,7 +42,7 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." +ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 # Remove the dedicated NGINX config ynh_remove_nginx_config @@ -50,7 +50,7 @@ ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing PHP-FPM configuration..." +ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1 # Remove the dedicated PHP-FPM config ynh_remove_fpm_config @@ -60,7 +60,7 @@ ynh_remove_fpm_config #================================================= # REMOVE THE CRON FILE #================================================= -ynh_script_progression --message="Removing the cron file..." +ynh_script_progression --message="Removing the cron file..." --weight=1 # Remove a cron file ynh_secure_remove --file="/etc/cron.d/$app" @@ -70,7 +70,7 @@ ynh_secure_remove --file="/etc/cron.d/$app" #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." +ynh_script_progression --message="Removing the dedicated system user..." --weight=1 # Delete a system user ynh_system_user_delete --username=$app @@ -79,4 +79,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of Matomo completed" +ynh_script_progression --message="Removal of Matomo completed" --last diff --git a/scripts/restore b/scripts/restore index 27db4c7..c054658 100755 --- a/scripts/restore +++ b/scripts/restore @@ -20,7 +20,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading settings..." +ynh_script_progression --message="Loading settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -34,7 +34,7 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." +ynh_script_progression --message="Validating restoration parameters..." --weight=1 ynh_webpath_available --domain=$domain --path_url=$path_url \ || ynh_die --message="Path not available: ${domain}${path_url}" @@ -46,14 +46,14 @@ test ! -d $final_path \ #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." +ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1 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..." +ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 # Create the dedicated user (if not existing) ynh_system_user_create --username=$app --home_dir="$final_path" @@ -61,7 +61,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring Matomo main directory..." +ynh_script_progression --message="Restoring Matomo main directory..." --weight=3 ynh_restore_file --origin_path="$final_path" @@ -72,7 +72,7 @@ chown -R $app:www-data "$final_path" #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Restoring PHP-FPM configuration..." +ynh_script_progression --message="Restoring PHP-FPM configuration..." --weight=2 # Restore the file first, so it can have a backup if different ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" @@ -83,7 +83,7 @@ ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencie #================================================= # RESTORE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Restoring the MySQL database..." +ynh_script_progression --message="Restoring the MySQL database..." --weight=1 db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd @@ -92,7 +92,7 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./ #================================================= # RESTORE THE CRON FILE #================================================= -ynh_script_progression --message="Restoring the cron file..." +ynh_script_progression --message="Restoring the cron file..." --weight=1 ynh_restore_file --origin_path="/etc/cron.d/$app" @@ -101,7 +101,7 @@ ynh_restore_file --origin_path="/etc/cron.d/$app" #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." +ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1 ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload @@ -110,4 +110,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for Matomo" +ynh_script_progression --message="Restoration completed for Matomo" --last diff --git a/scripts/upgrade b/scripts/upgrade index 75bfb3a..03363d7 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -27,14 +27,14 @@ email=$(ynh_user_get_info --username=$admin --key=mail) #================================================= # CHECK VERSION #================================================= -ynh_script_progression --message="Checking version..." +ynh_script_progression --message="Checking version..." --weight=1 upgrade_type=$(ynh_check_app_version_changed) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 # If db_name doesn't exist, create it if [ -z "$db_name" ]; then @@ -63,7 +63,7 @@ fi #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." +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" @@ -71,7 +71,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up Matomo before upgrading (may take a while)..." +ynh_script_progression --message="Backing up Matomo before upgrading (may take a while)..." --weight=3 # Backup the current version of the app ynh_backup_before_upgrade @@ -90,7 +90,7 @@ ynh_abort_if_errors if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading source files..." + ynh_script_progression --message="Upgrading source files..." --weight=3 if [[ ! -f "$final_path/config/config.ini.php" ]]; then # config.ini.php is only created during the post-install process... @@ -121,7 +121,7 @@ chown -R $app:www-data "$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config @@ -129,7 +129,7 @@ ynh_add_nginx_config #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading PHP-FPM configuration..." +ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 # Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies" @@ -137,7 +137,7 @@ ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencie #================================================= # SETUP A CRON #================================================= -ynh_script_progression --message="Setuping a cron..." +ynh_script_progression --message="Setuping a cron..." --weight=1 ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" chown root: "/etc/cron.d/$app" @@ -146,7 +146,7 @@ chmod 644 "/etc/cron.d/$app" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -154,4 +154,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of Matomo completed" +ynh_script_progression --message="Upgrade of Matomo completed" --last