2017-06-21 11:34:24 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-08-04 23:00:10 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2017-06-21 11:34:24 +02:00
|
|
|
|
2019-08-04 23:00:10 +02:00
|
|
|
#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
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# MANAGE SCRIPT FAILURE
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_clean_setup () {
|
|
|
|
ynh_clean_check_starting
|
|
|
|
}
|
|
|
|
# Exit if an error occurs during the execution of the script
|
|
|
|
ynh_abort_if_errors
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
2020-12-18 22:44:52 +01:00
|
|
|
ynh_script_progression --message="Loading settings..."
|
2017-06-21 11:34:24 +02:00
|
|
|
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
2019-08-04 23:00:10 +02:00
|
|
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
|
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# CHECK IF THE APP CAN BE RESTORED
|
|
|
|
#=================================================
|
2020-12-18 22:44:52 +01:00
|
|
|
ynh_script_progression --message="Validating restoration parameters..."
|
2019-08-04 23:00:10 +02:00
|
|
|
|
|
|
|
ynh_webpath_available --domain=$domain --path_url=$path_url \
|
|
|
|
|| ynh_die --message="Path not available: ${domain}${path_url}"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD RESTORATION STEPS
|
|
|
|
#=================================================
|
|
|
|
# RESTORE THE NGINX CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SPECIFIC RESTORATION
|
|
|
|
#=================================================
|
|
|
|
# REINSTALL DEPENDENCIES
|
|
|
|
#=================================================
|
2020-12-18 22:44:52 +01:00
|
|
|
ynh_script_progression --message="Reinstalling dependencies..."
|
2019-08-04 23:00:10 +02:00
|
|
|
|
2021-01-02 19:34:29 +01:00
|
|
|
DEBIAN_VERSION_NUMBER=$(cat /etc/debian_version | head -n 1 | cut -f1 -d .)
|
2020-07-01 18:16:38 +02:00
|
|
|
ynh_install_extra_app_dependencies --repo="deb https://collaboraoffice.com/repos/CollaboraOnline/CODE-debian${DEBIAN_VERSION_NUMBER} ./ " --package="$pkg_dependencies" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x0C54D189F4BA284D"
|
2019-08-04 23:00:10 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# RESTORE CONFIGURATION
|
|
|
|
#=================================================
|
2020-12-18 22:44:52 +01:00
|
|
|
ynh_script_progression --message="Restoring the configuration..."
|
2019-08-04 23:00:10 +02:00
|
|
|
|
|
|
|
ynh_restore_file --origin_path="/etc/loolwsd/loolwsd.xml"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2020-12-18 22:44:52 +01:00
|
|
|
ynh_script_progression --message="Starting a systemd service..."
|
2019-08-04 23:00:10 +02:00
|
|
|
|
|
|
|
ynh_systemd_action --service_name="loolwsd" --action="restart" --log_path="systemd" --line_match="Started LibreOffice Online WebSocket Daemon"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
|
|
|
#=================================================
|
|
|
|
# RELOAD NGINX
|
|
|
|
#=================================================
|
2020-12-18 22:44:52 +01:00
|
|
|
ynh_script_progression --message="Reloading NGINX web server..."
|
2019-08-04 23:00:10 +02:00
|
|
|
|
|
|
|
ynh_systemd_action --service_name=nginx --action=reload
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
2017-06-21 11:34:24 +02:00
|
|
|
|
2020-12-18 22:44:52 +01:00
|
|
|
ynh_script_progression --message="Restoration completed for $app"
|