diff --git a/scripts/backup b/scripts/backup index 0b75259..dbdfb5c 100755 --- a/scripts/backup +++ b/scripts/backup @@ -24,7 +24,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -39,28 +39,28 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_script_progression --message="Backing up the main app directory..." --time --weight=1 +ynh_script_progression --message="Backing up the main app directory..." --weight=3 ynh_backup --src_path="$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Backing up nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Backing up nginx web server configuration..." --weight=4 ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Backing up php-fpm configuration..." --time --weight=1 +ynh_script_progression --message="Backing up php-fpm configuration..." --weight=5 ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Backing up the MySQL database..." --time --weight=1 +ynh_script_progression --message="Backing up the MySQL database..." --weight=6 ynh_mysql_dump_db --database="$db_name" > db.sql @@ -68,4 +68,4 @@ ynh_mysql_dump_db --database="$db_name" > db.sql # END OF SCRIPT #================================================= -ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --time --last +ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last diff --git a/scripts/change_url b/scripts/change_url index 81c5de7..53d0dd6 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) @@ -37,7 +37,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --time --weight=1 +ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --weight=3 # Backup the current version of the app ynh_backup_before_upgrade @@ -72,7 +72,7 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Updating nginx web server configuration..." --weight=7 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -108,7 +108,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading nginx web server..." --weight=9 ynh_systemd_action --service_name=nginx --action=reload @@ -116,4 +116,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --time --last +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/install b/scripts/install index 8c0d32c..27cd0c8 100755 --- a/scripts/install +++ b/scripts/install @@ -54,7 +54,7 @@ app=$YNH_APP_INSTANCE_NAME ### Use the execution time, given by --time, to estimate the weight of a step. ### A common way to do it is to set a weight equal to the execution time in second +1. ### The execution time is given for the duration since the previous call. So the weight should be applied to this previous call. -ynh_script_progression --message="Validating installation parameters..." --time --weight=1 +ynh_script_progression --message="Validating installation parameters..." --weight=1 ### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". ### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app" @@ -67,7 +67,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --time --weight=1 +ynh_script_progression --message="Storing installation settings..." --weight=2 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url @@ -78,7 +78,7 @@ ynh_app_setting_set --app=$app --key=language --value=$language #================================================= # CREATE A MYSQL DATABASE / CREATION BASE DE DONNÉE MYSQL #================================================= -ynh_script_progression --message="Creating a MySQL database..." --time --weight=1 +ynh_script_progression --message="Creating a MySQL database..." --weight=4 ### Use these lines if you need a database for the application. ### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password. @@ -97,7 +97,7 @@ ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --time --weight=1 +ynh_script_progression --message="Setting up source files..." --weight=6 ### `ynh_setup_source` is used to install an app from a zip or tar.gz file, ### downloaded from an upstream source, like a git repository. @@ -110,7 +110,7 @@ ynh_setup_source --dest_dir="$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." --time --weight=1 +ynh_script_progression --message="Configuring nginx web server..." --weight=71 ### `ynh_add_nginx_config` will use the file conf/nginx.conf @@ -120,7 +120,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --time --weight=1 +ynh_script_progression --message="Configuring system user..." --weight=73 # Create a system user ynh_system_user_create --username=$app @@ -128,7 +128,7 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring php-fpm..." --time --weight=1 +ynh_script_progression --message="Configuring php-fpm..." --weight=76 ### `ynh_add_fpm_config` is used to set up a PHP config. ### `ynh_add_fpm_config` will use the files conf/php-fpm.conf @@ -149,7 +149,7 @@ ynh_add_fpm_config chown -R $app: $final_path # Set the app as temporarily public for curl call -ynh_script_progression --message="Configuring SSOwat..." --time --weight=1 +ynh_script_progression --message="Configuring SSOwat..." --weight=78 #######ynh_app_setting_set --app=$app --key=skipped_uris --value="/" #######ynh_permission_update --permission "main" --add visitors # Reload SSOwat config @@ -159,7 +159,7 @@ yunohost app ssowatconf ynh_systemd_action --service_name=nginx --action=reload # Installation YesWiki with curl -ynh_script_progression --message="Finalizing installation..." --time --weight=1 +ynh_script_progression --message="Finalizing installation..." --weight=80 ynh_local_curl "/?PagePrincipale&installAction=install" "config[default_language]=$language" "config[wakka_name]=MyYunoHostWiki" \ "config[root_page]=PagePrincipale" "config[mysql_host]=localhost" \ "config[mysql_database]=$app" "config[mysql_user]=$db_user" "config[mysql_password]=$db_pwd" "config[table_prefix]=yeswiki_" \ @@ -187,7 +187,7 @@ chown -R root: $final_path #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." --time --weight=1 +ynh_script_progression --message="Configuring SSOwat..." --weight=83 # Make app public if necessary if [ $is_public -eq 1 ] @@ -200,7 +200,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading nginx web server..." --weight=85 ynh_systemd_action --service_name=nginx --action=reload @@ -208,4 +208,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --time --last +ynh_script_progression --message="Installation of $app completed" --last diff --git a/scripts/remove b/scripts/remove index 6157106..01c8bb9 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..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -27,7 +27,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # REMOVE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Removing the MySQL database..." --time --weight=1 +ynh_script_progression --message="Removing the MySQL database..." --weight=3 # Remove a database if it exists, along with the associated user ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name @@ -35,7 +35,7 @@ ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --time --weight=1 +ynh_script_progression --message="Removing app main directory..." --weight=4 # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -43,7 +43,7 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Removing nginx web server configuration..." --weight=5 # Remove the dedicated nginx config ynh_remove_nginx_config @@ -51,50 +51,17 @@ ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing php-fpm configuration..." --time --weight=1 +ynh_script_progression --message="Removing php-fpm configuration..." --weight=6 # Remove the dedicated php-fpm config ynh_remove_fpm_config -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port$" -then - ynh_script_progression --message="Closing port $port..." - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi - -#================================================= -# REMOVE FAIL2BAN CONFIGURATION -#================================================= -ynh_script_progression --message="Removing fail2ban configuration..." --time --weight=1 - -# Remove the dedicated fail2ban config -ynh_remove_fail2ban_config - -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE THE CRON FILE -#================================================= - -# Remove a cron file -ynh_secure_remove --file="/etc/cron.d/$app" - -# Remove a directory securely -ynh_secure_remove --file="/etc/$app/" - -# Remove the log files -ynh_secure_remove --file="/var/log/$app/" - #================================================= # GENERIC FINALIZATION #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." --time --weight=1 +ynh_script_progression --message="Removing the dedicated system user..." --weight=15 # Delete a system user ynh_system_user_delete --username=$app @@ -103,4 +70,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --time --last +ynh_script_progression --message="Removal of $app completed" --last diff --git a/scripts/restore b/scripts/restore index 3f4757e..41672dd 100755 --- a/scripts/restore +++ b/scripts/restore @@ -91,12 +91,6 @@ 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 ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql -#================================================= -# RESTORE THE CRON FILE -#================================================= - -######ynh_restore_file --origin_path="/etc/cron.d/$app" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 58ec790..f21f3f2 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -90,13 +90,6 @@ path_url=$(ynh_normalize_url_path --path_url=$path_url) #================================================= # STANDARD UPGRADE STEPS -#================================================= -# STOP SYSTEMD SERVICE -#================================================= -######ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 - -######ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #=================================================