1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/teampass_ynh.git synced 2024-09-03 20:26:37 +02:00
teampass_ynh/scripts/restore

73 lines
2.6 KiB
Text
Raw Normal View History

#!/bin/bash
2015-12-18 14:11:35 +01:00
#=================================================
2018-05-22 20:01:55 +02:00
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2016-12-14 16:02:43 +01:00
2022-03-12 15:39:54 +01:00
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
2018-07-13 17:37:28 +02:00
source ../settings/scripts/_common.sh
2016-12-14 16:02:43 +01:00
source /usr/share/yunohost/helpers
#=================================================
2021-07-11 16:19:12 +02:00
# RESTORE THE APP MAIN DIR
#=================================================
2021-07-11 16:19:12 +02:00
ynh_script_progression --message="Restoring the app main directory..." --weight=1
2016-12-14 16:02:43 +01:00
2023-03-23 21:50:47 +01:00
ynh_restore_file --origin_path="$install_dir"
2023-03-23 21:50:47 +01:00
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
2022-03-14 00:52:27 +01:00
2018-11-21 16:19:57 +01:00
# Sauf les dossiers includes, files et upload
2023-03-23 21:50:47 +01:00
chown -R $app $install_dir/{includes,files,upload}
#=================================================
2022-03-12 15:39:54 +01:00
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
2022-03-12 15:39:54 +01:00
ynh_script_progression --message="Restoring the PHP-FPM configuration..."
2021-07-11 16:09:09 +02:00
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
2022-07-03 14:58:24 +02:00
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
2022-03-12 15:39:54 +01:00
# RESTORE THE MYSQL DATABASE
#=================================================
2023-03-23 21:58:32 +01:00
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
2022-03-12 15:39:54 +01:00
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================
2022-03-12 15:39:54 +01:00
# RESTORE VARIOUS FILES
#=================================================
2022-03-12 15:39:54 +01:00
ynh_script_progression --message="Restoring various files..."
2021-07-11 13:22:15 +02:00
ynh_restore_file --origin_path="/etc/cron.d/$app"
2016-12-14 16:02:43 +01:00
2022-03-12 15:39:54 +01:00
ynh_restore_file --origin_path="/etc/$app/sk.php"
chown -R $app "/etc/$app/sk.php"
#=================================================
2022-07-03 14:58:24 +02:00
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
2021-07-11 13:22:15 +02:00
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
2015-12-18 14:11:35 +01:00
2021-07-11 13:22:15 +02:00
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload
2018-05-22 20:01:55 +02:00
2021-07-11 16:19:12 +02:00
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last