2017-11-14 16:05:26 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-01-31 16:08:58 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
2022-03-13 15:22:35 +01:00
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2018-01-31 16:08:58 +01:00
|
|
|
|
2022-03-13 15:22:35 +01:00
|
|
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
2020-11-17 23:51:51 +01:00
|
|
|
source ../settings/scripts/experimental_helper.sh
|
|
|
|
source ../settings/scripts/_common.sh
|
2017-11-14 16:05:26 +01:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2024-01-31 14:44:14 +01:00
|
|
|
#=================================================
|
|
|
|
# RESTORE THE POSTGRESQL SUPERUSER
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Restoring the Postgresql superuser..." --weight=1
|
|
|
|
|
2024-04-26 22:03:05 +02:00
|
|
|
ynh_psql_execute_as_root --sql="ALTER USER $app WITH SUPERUSER CREATEDB CREATEROLE REPLICATION"
|
2024-01-31 14:44:14 +01:00
|
|
|
|
2022-03-13 15:22:35 +01:00
|
|
|
#=================================================
|
2024-02-27 23:20:13 +01:00
|
|
|
# RESTORE ALL CONFIG AND DATA
|
2022-03-13 15:22:35 +01:00
|
|
|
#=================================================
|
|
|
|
|
2024-02-27 23:20:13 +01:00
|
|
|
ynh_script_progression --message="Restoring directory and configuration..." --weight=10
|
|
|
|
ynh_restore
|
2017-11-14 16:05:26 +01:00
|
|
|
|
2022-03-13 15:22:35 +01:00
|
|
|
#=================================================
|
|
|
|
# REINSTALL DEPENDENCIES
|
|
|
|
#=================================================
|
2024-01-30 16:48:42 +01:00
|
|
|
ynh_script_progression --message="Updating python virtualenv..." --weight=5
|
2017-11-14 16:05:26 +01:00
|
|
|
|
2024-02-27 23:20:13 +01:00
|
|
|
install_source
|
2022-03-13 15:22:35 +01:00
|
|
|
|
|
|
|
#=================================================
|
2024-02-27 23:20:13 +01:00
|
|
|
# RESTORE SYSTEMD
|
2022-03-13 15:22:35 +01:00
|
|
|
#=================================================
|
2024-02-27 23:20:13 +01:00
|
|
|
ynh_script_progression --message="Enable systemd services" --weight=2
|
2024-01-31 14:52:39 +01:00
|
|
|
|
2024-02-27 23:20:13 +01:00
|
|
|
# systemctl daemon-reload
|
2024-04-27 01:08:10 +02:00
|
|
|
systemctl enable "$app".service --quiet
|
|
|
|
yunohost service add "$app" --log "/var/log/$app/$app.log" --description 'PgAdmin application'
|
2022-03-14 22:13:23 +01:00
|
|
|
|
2024-02-27 23:20:13 +01:00
|
|
|
set_permission
|
2017-11-14 16:05:26 +01:00
|
|
|
|
2022-03-13 15:22:35 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
|
|
|
#=================================================
|
2024-02-27 23:20:13 +01:00
|
|
|
# RELOAD NGINX AND THE APP SERVICE
|
2022-03-13 15:22:35 +01:00
|
|
|
#=================================================
|
2024-01-30 17:03:58 +01:00
|
|
|
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
2017-11-14 16:05:26 +01:00
|
|
|
|
2024-04-26 22:03:05 +02:00
|
|
|
ynh_systemd_action --service_name="$app.service" --action="restart" --line_match="Listening at: unix:/run/$app/app.socket" --log_path=systemd
|
2019-06-06 22:39:49 +02:00
|
|
|
|
2024-01-30 17:03:58 +01:00
|
|
|
ynh_systemd_action --service_name=nginx --action=reload
|
|
|
|
|
2022-03-13 15:22:35 +01:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2019-06-06 22:39:49 +02:00
|
|
|
ynh_script_progression --message="Restoration completed for $app" --last
|