2022-06-15 16:26:48 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
source ../settings/scripts/_common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# RESTORE THE APP MAIN DIR
|
|
|
|
#=================================================
|
2024-08-31 03:08:30 +02:00
|
|
|
ynh_script_progression "Restoring the app main directory..."
|
2022-06-15 16:26:48 +02:00
|
|
|
|
2024-08-31 03:08:30 +02:00
|
|
|
ynh_restore "$install_dir"
|
2022-06-15 16:26:48 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REINSTALL DEPENDENCIES
|
|
|
|
#=================================================
|
2024-08-31 03:08:30 +02:00
|
|
|
ynh_script_progression "Reinstalling dependencies..."
|
2022-06-15 16:26:48 +02:00
|
|
|
|
2024-08-31 03:08:30 +02:00
|
|
|
ynh_nodejs_install
|
2022-06-15 16:26:48 +02:00
|
|
|
|
|
|
|
#=================================================
|
2022-06-27 14:22:15 +02:00
|
|
|
# RESTORE THE DATABASE
|
2022-06-15 16:26:48 +02:00
|
|
|
#=================================================
|
2024-08-31 03:08:30 +02:00
|
|
|
ynh_script_progression "Restoring the database..."
|
2022-06-15 16:26:48 +02:00
|
|
|
|
2024-08-31 03:08:30 +02:00
|
|
|
ynh_psql_db_shell <<< "CREATE EXTENSION IF NOT EXISTS pgcrypto;"
|
2023-09-21 13:11:33 +02:00
|
|
|
|
2024-09-29 09:13:50 +02:00
|
|
|
ynh_psql_db_shell < ./db.sql
|
2022-06-15 16:26:48 +02:00
|
|
|
|
|
|
|
#=================================================
|
2023-08-12 14:35:07 +02:00
|
|
|
# RESTORE SYSTEM CONFIGURATIONS
|
|
|
|
#=================================================
|
2024-08-31 03:08:30 +02:00
|
|
|
ynh_script_progression "Restoring system configurations related to $app..."
|
2023-08-12 14:35:07 +02:00
|
|
|
|
2024-08-31 03:08:30 +02:00
|
|
|
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
|
2022-06-15 16:26:48 +02:00
|
|
|
|
2024-08-31 03:08:30 +02:00
|
|
|
ynh_restore "/etc/systemd/system/$app.service"
|
2022-06-15 16:26:48 +02:00
|
|
|
systemctl enable $app.service --quiet
|
|
|
|
|
|
|
|
yunohost service add $app --description="Web Analytics" --log="/var/log/$app/$app.log"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2024-08-31 03:08:30 +02:00
|
|
|
ynh_script_progression "Starting $app's systemd service..."
|
2022-06-15 16:26:48 +02:00
|
|
|
|
2024-08-31 03:08:30 +02:00
|
|
|
ynh_systemctl --service=$app --action="start"
|
2022-06-15 16:26:48 +02:00
|
|
|
|
2024-08-31 03:08:30 +02:00
|
|
|
ynh_systemctl --service=nginx --action=reload
|
2022-06-15 16:26:48 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2024-08-31 03:08:30 +02:00
|
|
|
ynh_script_progression "Restoration completed for $app"
|