#!/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 #================================================= # 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 #================================================= ynh_print_info --message="Loading settings..." app=$YNH_APP_INSTANCE_NAME 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 #================================================= ynh_print_info --message="Validating restoration parameters..." 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 #=============================================== # ADD COLLABORA REPOSITORY #=============================================== ynh_install_app_dependencies apt-transport-https apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0C54D189F4BA284D if [ "$(lsb_release --codename --short)" = "jessie" ]; then echo 'deb https://collaboraoffice.com/repos/CollaboraOnline/CODE-debian8 ./' | tee -a /etc/apt/sources.list.d/collabora.list else echo 'deb https://collaboraoffice.com/repos/CollaboraOnline/CODE-debian9 ./' | tee -a /etc/apt/sources.list.d/collabora.list fi #================================================= # REINSTALL DEPENDENCIES #================================================= ynh_print_info --message="Reinstalling dependencies..." # Define and install dependencies ynh_package_update ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE CONFIGURATION #================================================= ynh_print_info --message="Restoring the configuration..." ynh_restore_file --origin_path="/etc/loolwsd/loolwsd.xml" #================================================= # START SYSTEMD SERVICE #================================================= ynh_print_info --message="Starting a systemd service..." ynh_systemd_action --service_name="loolwsd" --action="restart" --log_path="systemd" --line_match="Started LibreOffice Online WebSocket Daemon" #================================================= # GENERIC FINALIZATION #================================================= # RELOAD NGINX #================================================= ynh_print_info --message="Reloading nginx web server..." ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= ynh_print_info --message="Restoration completed for $app"