2021-08-05 17:28:35 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
source ../settings/scripts/_common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# RESTORE THE APP MAIN DIR
|
|
|
|
#=================================================
|
2024-08-31 03:09:10 +02:00
|
|
|
ynh_script_progression "Restoring $app main directory..."
|
2022-02-15 15:18:19 +01:00
|
|
|
|
2024-08-31 03:09:10 +02:00
|
|
|
ynh_restore "$install_dir"
|
2021-08-08 14:00:19 +02:00
|
|
|
|
2021-08-05 17:28:35 +02:00
|
|
|
#=================================================
|
|
|
|
# RESTORE THE POSTGRESQL DATABASE
|
|
|
|
#=================================================
|
2024-08-31 03:09:10 +02:00
|
|
|
ynh_script_progression "Restoring the PostgreSQL database..."
|
2021-08-05 17:28:35 +02:00
|
|
|
|
2024-08-31 03:09:10 +02:00
|
|
|
ynh_psql_db_shell < ./db.sql
|
2021-08-05 17:28:35 +02:00
|
|
|
|
|
|
|
#=================================================
|
2023-10-27 09:20:57 +02:00
|
|
|
# RESTORE SYSTEM CONFIGURATIONS
|
2021-08-05 17:28:35 +02:00
|
|
|
#=================================================
|
2024-08-31 03:09:10 +02:00
|
|
|
ynh_script_progression "Restoring system configurations related to $app..."
|
2021-08-05 17:28:35 +02:00
|
|
|
|
2024-08-31 03:09:10 +02:00
|
|
|
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
|
2023-10-27 09:12:57 +02:00
|
|
|
|
2024-08-31 03:09:10 +02:00
|
|
|
ynh_restore "/etc/systemd/system/$app.service"
|
2021-08-05 17:28:35 +02:00
|
|
|
systemctl enable $app.service --quiet
|
|
|
|
|
|
|
|
yunohost service add $app --description="Self-hosted To-Do list application" --log="/var/log/$app/$app.log"
|
|
|
|
|
2023-10-27 09:20:57 +02:00
|
|
|
#=================================================
|
|
|
|
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
2021-08-05 17:28:35 +02:00
|
|
|
#=================================================
|
2024-08-31 03:09:10 +02:00
|
|
|
ynh_script_progression "Reloading NGINX web server and $app's service..."
|
2021-08-05 17:28:35 +02:00
|
|
|
|
2024-08-31 03:09:10 +02:00
|
|
|
ynh_systemctl --service=$app --action=start --log_path=systemd --wait_until="server started on"
|
2021-08-05 17:28:35 +02:00
|
|
|
|
2024-08-31 03:09:10 +02:00
|
|
|
ynh_systemctl --service=nginx --action=reload
|
2021-08-05 17:28:35 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2024-08-31 03:09:10 +02:00
|
|
|
ynh_script_progression "Restoration completed for $app"
|