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
|
|
|
|
#=================================================
|
2022-05-02 19:22:58 +02:00
|
|
|
ynh_script_progression --message="Installation of Debian package of Duniter…"
|
2022-03-12 16:55:59 +01:00
|
|
|
|
2024-02-21 14:59:14 +01:00
|
|
|
ynh_setup_source --dest_dir="$install_dir" --source_id=$architecture
|
|
|
|
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
|
|
|
|
|
|
|
#=================================================
|
2022-05-05 20:35:42 +02:00
|
|
|
# CONFIGURE DUNITER
|
2022-03-12 16:55:59 +01:00
|
|
|
#=================================================
|
2022-05-05 20:35:42 +02:00
|
|
|
ynh_script_progression --message="Configure Duniter…"
|
2022-03-12 16:55:59 +01:00
|
|
|
|
2022-05-05 20:35:42 +02: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"
|
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"
|