2020-11-19 21:41:03 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
source ../settings/scripts/_common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
2021-03-21 20:58:48 +01:00
|
|
|
# RESTORE THE APP MAIN DIR
|
2020-11-19 21:41:03 +01:00
|
|
|
#=================================================
|
2024-09-01 17:40:32 +02:00
|
|
|
ynh_script_progression "Restoring HedgeDoc main directory..."
|
2020-11-19 21:41:03 +01:00
|
|
|
|
2024-09-01 17:40:32 +02:00
|
|
|
ynh_restore "$install_dir"
|
2020-11-19 21:41:03 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REINSTALL DEPENDENCIES
|
|
|
|
#=================================================
|
2024-09-01 17:40:32 +02:00
|
|
|
ynh_script_progression "Reinstalling dependencies..."
|
2020-11-19 21:41:03 +01:00
|
|
|
|
|
|
|
# Install Nodejs
|
2024-09-01 17:40:32 +02:00
|
|
|
ynh_nodejs_install
|
2020-11-19 21:41:03 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# RESTORE THE POSTGRESQL DATABASE
|
|
|
|
#=================================================
|
2024-09-01 17:40:32 +02:00
|
|
|
ynh_script_progression "Restoring the PostgreSQL database..."
|
2020-11-19 21:41:03 +01:00
|
|
|
|
2024-09-01 17:40:32 +02:00
|
|
|
ynh_psql_db_shell < "./db.sql"
|
2020-11-19 21:41:03 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# RESTORE SYSTEMD
|
|
|
|
#=================================================
|
2024-09-01 17:40:32 +02:00
|
|
|
ynh_script_progression "Restoring system configurations related to $app..."
|
2023-06-04 23:16:35 +02:00
|
|
|
|
2024-09-01 17:40:32 +02:00
|
|
|
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
|
2020-11-19 21:41:03 +01:00
|
|
|
|
2024-09-01 17:40:32 +02:00
|
|
|
ynh_restore "/etc/systemd/system/$app.service"
|
2020-12-19 11:00:54 +01:00
|
|
|
systemctl enable $app.service --quiet
|
2020-11-19 21:41:03 +01:00
|
|
|
|
2020-12-24 16:31:32 +01:00
|
|
|
yunohost service add $app --description="Collaborative Markdown editor" --log="/var/log/$app/$app.log"
|
2020-11-19 21:41:03 +01:00
|
|
|
|
|
|
|
#=================================================
|
2023-06-04 23:16:35 +02:00
|
|
|
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
2020-11-19 21:41:03 +01:00
|
|
|
#=================================================
|
2024-09-01 17:40:32 +02:00
|
|
|
ynh_script_progression "Reloading NGINX web server and $app's service..."
|
2020-11-19 21:41:03 +01:00
|
|
|
|
2024-09-01 17:40:32 +02:00
|
|
|
ynh_systemctl --service=$app --action=start --log_path=systemd --wait_until="HTTP Server listening"
|
2020-11-19 21:41:03 +01:00
|
|
|
|
2024-09-01 17:40:32 +02:00
|
|
|
ynh_systemctl --service=nginx --action=reload
|
2020-11-19 21:41:03 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2024-09-01 17:40:32 +02:00
|
|
|
ynh_script_progression "Restoration completed for $app"
|