#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_script_progression --message="Restoring files..." --weight=10 ynh_restore #================================================= # RESTORE THE MYSQL DATABASE #================================================= ynh_script_progression --message="Restoring the database..." --weight=1 ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 mkdir -p /var/log/"$app" set_permissions systemctl enable "$app".service --quiet yunohost service add "$app" --description=XWiki --log="/var/log/$app/$app.log" ynh_use_logrotate --logfile="/var/log/$app" #================================================= # GENERIC FINALIZATION #================================================= # RELOAD NGINX AND THE APP SERVICE #================================================= ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 ynh_systemd_action --service_name="$app" --action=start --log_path=systemd --line_match="$systemd_match_start_line" wait_xwiki_started ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Restoration completed for $app" --last