1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/collabora_ynh.git synced 2024-09-03 18:16:25 +02:00
collabora_ynh/scripts/restore

59 lines
2.3 KiB
Bash

#!/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
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the configuration..." --weight=3
ynh_restore_file --origin_path="/etc/coolwsd/coolwsd.xml"
chmod 640 "/etc/coolwsd/coolwsd.xml"
chown cool:root -R /etc/coolwsd
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add "coolwsd" --description="Collabora online office suite" --log="/var/log/$app/$app.log"
#=================================================
# GENERIC FINALIZATION
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=5
# NB. : we need a stupid *re*start because the service is in fact already started during the damn package install ... so it won't find a recent "Ready to accept connection" match ...
ynh_systemd_action --service_name="coolwsd" --action="stop" --log_path="systemd"
# The service installed by the deb package failed in loop, thus the reset-failed.
systemctl reset-failed coolwsd
# Start a systemd service
ynh_systemd_action --service_name="coolwsd" --action="start" --log_path="systemd" --line_match="Ready to accept connections"
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last