diff --git a/scripts/backup b/scripts/backup index 64ed7ca..f98a529 100644 --- a/scripts/backup +++ b/scripts/backup @@ -25,6 +25,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= +ynh_script_progression --message="Loading installation settings..." --time --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -37,29 +38,34 @@ db_name=$(ynh_app_setting_get $app db_name) #================================================= # BACKUP THE APP MAIN DIR #================================================= +ynh_script_progression --message="Backing up the main app directory..." --time --weight=1 -ynh_backup "$final_path" +ynh_backup --src_path="$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= +ynh_script_progression --message="Backing up nginx web server configuration..." --time --weight=1 -ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE #================================================= +ynh_script_progression --message="Backing up the MySQL database..." --time --weight=1 ynh_mysql_dump_db "$db_name" > db.sql #================================================= # BACKUP THE CRON FILE #================================================= +ynh_script_progression --message="Backing up cron configuration..." --time --weight=1 + +ynh_backup --src_path="/etc/cron.d/$app" -ynh_backup "/etc/cron.d/$app" #================================================= -# BACKUP POSTFIX & ALIASES +# END OF SCRIPT #================================================= -ynh_backup /etc/aliases +ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --time --last diff --git a/scripts/restore b/scripts/restore index 28ee0fb..275a3d6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -25,6 +25,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= +ynh_script_progression --message="Loading settings..." --time --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -37,6 +38,7 @@ admin=$(ynh_app_setting_get $app admin) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= +ynh_script_progression --message="Validating restoration parameters..." --time --weight=1 ynh_webpath_available $domain $path_url \ || ynh_die "Path not available: ${domain}${path_url}" @@ -57,12 +59,14 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= +ynh_script_progression --message="Restoring the app main directory..." --time --weight=1 ynh_restore_file "$final_path" #================================================= # RESTORE THE MYSQL DATABASE #================================================= +ynh_script_progression --message="Restoring the MySQL database..." --time --weight=1 db_pwd=$(ynh_app_setting_get $app mysqlpwd) ynh_mysql_setup_db $db_name $db_name $db_pwd @@ -73,6 +77,7 @@ ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql #================================================= # REINSTALL DEPENDENCIES #================================================= +ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1 # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies @@ -82,10 +87,6 @@ for i in $lang ; do done locale-gen -#Temporaire - mettre en config -ln -s $final_path/lang/fr $final_path/lang/fr_FR -ln -s $final_path/lang/it $final_path/lang/it_IT -ln -s $final_path/www/template-exemple $final_path/template-exemple #================================================= # RESTORE POSTFIX ALIASES @@ -103,6 +104,8 @@ fi #================================================= # RESTORE THE CRON FILE #================================================= +ynh_script_progression --message="Reinstall cron job" --time --weight=1 + ynh_restore_file "/etc/cron.d/$app" @@ -111,9 +114,15 @@ ynh_restore_file "/etc/cron.d/$app" #================================================= # RELOAD NGINX & ALIASES #================================================= +ynh_script_progression --message="Reloading nginx web server and php-fpm..." --time --weight=1 + postmap $final_path/var/virtual -systemctl reload nginx -systemctl restart php7.0-fpm -systemctl reload postfix +ynh_systemd_action --service_name=php7.0-fpm --action=restart +ynh_systemd_action --service_name=nginx --action=reload +ynh_systemd_action --service_name=postfix --action=reload +#================================================= +# END OF SCRIPT +#================================================= +ynh_script_progression --message="Restoration completed for $app" --time --last \ No newline at end of file