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

67 lines
2.4 KiB
Text
Raw Permalink Normal View History

2022-03-12 16:55:59 +01:00
#!/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
#=================================================
# SPECIFIC RESTORATION
#=================================================
# INSTALL DUNITER
#=================================================
ynh_script_progression --message="Installation of Debian package of Duniter…"
2022-03-12 16:55:59 +01:00
2024-02-21 15:09:21 +01:00
ynh_setup_source --dest_dir="$install_dir"
2024-02-21 14:59:14 +01:00
ynh_exec_warn_less dpkg -i "$install_dir/duniter-server.deb"
ynh_secure_remove "$install_dir/duniter-server.deb"
2022-03-12 16:55:59 +01:00
#=================================================
# CONFIGURE DUNITER
2022-03-12 16:55:59 +01:00
#=================================================
ynh_script_progression --message="Configure Duniter…"
2022-03-12 16:55:59 +01:00
CONFIGURE_DUNITER
2022-03-12 16:55:59 +01:00
#=================================================
2024-02-21 14:59:14 +01:00
# RESTORE THE DATA DIRECTORY
2022-03-12 16:55:59 +01:00
#=================================================
2024-02-21 14:59:14 +01:00
ynh_script_progression --message="Restoring the data directory..." --weight=1
2022-03-12 16:55:59 +01:00
2024-02-21 14:59:14 +01:00
ynh_restore_file --origin_path="$data_dir" --not_mandatory
2022-03-12 16:55:59 +01:00
2024-02-21 14:59:14 +01:00
chown -R "$app:www-data" "$data_dir"
2022-03-12 16:55:59 +01:00
#=================================================
2024-02-21 14:59:14 +01:00
# RESTORE SYSTEM CONFIGURATIONS
2022-03-12 16:55:59 +01:00
#=================================================
2024-02-21 14:59:14 +01:00
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
2022-03-12 16:55:59 +01:00
2024-02-21 14:59:14 +01:00
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable "$app.service" --quiet
yunohost service add "$app"
2022-03-12 16:55:59 +01:00
#=================================================
# GENERIC FINALIZATION
#=================================================
2024-02-21 14:59:14 +01:00
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
2022-03-12 16:55:59 +01:00
#=================================================
2024-02-21 14:59:14 +01:00
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="Web administration accessible"
2022-03-12 16:55:59 +01:00
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app"