1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/movim_ynh.git synced 2024-09-03 19:46:19 +02:00
movim_ynh/scripts/restore

60 lines
2.3 KiB
Text
Raw Normal View History

2020-07-24 18:32:57 +02:00
#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2022-01-31 08:47:43 +01:00
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
2020-07-24 18:32:57 +02:00
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
2021-08-09 23:58:08 +02:00
# RESTORE THE APP MAIN DIR
2020-07-24 18:32:57 +02:00
#=================================================
2022-01-31 08:47:43 +01:00
ynh_script_progression --message="Restoring the app main directory..."
2021-08-09 23:58:08 +02:00
2024-01-29 17:21:02 +01:00
ynh_restore_file --origin_path="$install_dir"
2020-07-24 18:32:57 +02:00
2024-01-29 18:47:16 +01:00
chmod 750 "$install_dir"
2024-01-29 17:21:02 +01:00
chmod -R o-rwx "$install_dir"
2024-01-29 17:25:45 +01:00
chown -R "$app:www-data" "$install_dir"
2020-07-24 18:32:57 +02:00
2022-06-20 01:52:27 +02:00
#=================================================
2024-01-29 17:49:06 +01:00
# RESTORE THE POSTGRESQL DATABASE
2022-06-20 01:52:27 +02:00
#=================================================
2024-01-29 17:49:06 +01:00
ynh_script_progression --message="Restoring the PostgreSQL database..."
2022-06-20 01:52:27 +02:00
2024-01-29 17:49:06 +01:00
ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
2022-06-20 01:52:27 +02:00
2020-07-24 18:32:57 +02:00
#=================================================
2024-01-29 17:25:45 +01:00
# RESTORE SYSTEM CONFIGURATIONS
2020-07-24 18:32:57 +02:00
#=================================================
2024-01-29 17:25:45 +01:00
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
2020-07-24 18:32:57 +02:00
2021-01-15 13:32:05 +01:00
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
2020-07-24 18:32:57 +02:00
2022-03-03 09:53:43 +01:00
# Recreate a dedicated PHP-FPM config
2024-01-29 18:23:31 +01:00
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion
2020-07-24 18:32:57 +02:00
2022-06-20 01:52:27 +02:00
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
2020-07-24 18:32:57 +02:00
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
2024-01-29 17:25:45 +01:00
systemctl enable "$app.service" --quiet
yunohost service add "$app" --description="Responsive web-based XMPP client"
2020-07-24 18:32:57 +02:00
#=================================================
2024-01-29 17:25:45 +01:00
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
2020-07-24 18:32:57 +02:00
#=================================================
2024-01-29 17:25:45 +01:00
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
2024-01-29 17:29:15 +01:00
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Movim daemon launched"
2024-01-29 17:25:45 +01:00
ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload
2020-07-24 18:32:57 +02:00
2024-01-29 18:50:17 +01:00
ynh_systemd_action --service_name=nginx --action="reload"
2020-07-24 18:32:57 +02:00
#=================================================
# END OF SCRIPT
#=================================================
2022-01-31 08:47:43 +01:00
ynh_script_progression --message="Restoration completed for $app"