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

66 lines
2.6 KiB
Text
Raw Normal View History

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
#=================================================
2024-01-29 16:43:01 +01:00
# RESTORE THE APP MAIN DIR
2019-08-04 23:00:10 +02:00
#=================================================
2024-01-29 16:43:01 +01:00
ynh_script_progression --message="Restoring the app main directory..." --weight=1
2019-08-04 23:00:10 +02:00
2024-01-29 16:43:01 +01:00
ynh_restore_file --origin_path="$install_dir"
### $install_dir will automatically be initialized with some decent
### permissions by default ... however, you may need to recursively reapply
### ownership to all files such as after the ynh_setup_source step
chown -R "$app:www-data" "$install_dir"
2019-08-04 23:00:10 +02:00
2021-06-26 10:32:42 +02:00
#=================================================
# RESTORE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the configuration..." --weight=3
2021-12-21 09:45:57 +01:00
ynh_restore_file --origin_path="/etc/coolwsd/coolwsd.xml"
2019-08-04 23:00:10 +02:00
2024-01-29 14:32:20 +01:00
chmod 640 "/etc/coolwsd/coolwsd.xml"
chown cool:root -R /etc/coolwsd
2019-08-04 23:00:10 +02:00
2021-06-26 09:23:07 +02:00
#=================================================
2024-01-29 16:43:01 +01:00
# RESTORE SYSTEM CONFIGURATIONS
2021-06-26 09:23:07 +02:00
#=================================================
2024-01-29 16:43:01 +01:00
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
2021-06-26 09:23:07 +02:00
2021-12-21 09:45:57 +01:00
yunohost service add "coolwsd" --description="Collabora online office suite" --log="/var/log/$app/$app.log"
2021-06-26 09:23:07 +02:00
2024-01-29 14:32:20 +01:00
#=================================================
# GENERIC FINALIZATION
2019-08-04 23:00:10 +02:00
#=================================================
# START SYSTEMD SERVICE
#=================================================
2024-01-29 14:32:20 +01:00
ynh_script_progression --message="Starting a systemd service..." --weight=5
2019-08-04 23:00:10 +02:00
2024-01-29 14:32:20 +01:00
# 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
2019-08-04 23:00:10 +02:00
2024-01-29 14:32:20 +01:00
# Start a systemd service
ynh_systemd_action --service_name="coolwsd" --action="start" --log_path="systemd" --line_match="Ready to accept connections"
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
2021-06-26 08:19:34 +02:00
ynh_script_progression --message="Restoration completed for $app" --last