2019-07-29 19:50:23 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-02-01 14:42:41 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2019-07-29 19:50:23 +02:00
|
|
|
|
2021-02-01 14:42:41 +01:00
|
|
|
source ../settings/scripts/_common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
2021-04-14 12:45:50 +02:00
|
|
|
# RESTORE THE APP MAIN DIR
|
2021-02-01 14:42:41 +01:00
|
|
|
#=================================================
|
2021-04-14 12:45:50 +02:00
|
|
|
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
2021-02-01 14:42:41 +01:00
|
|
|
|
2023-02-26 16:31:30 +01:00
|
|
|
ynh_restore_file --origin_path="$install_dir"
|
2021-02-01 14:42:41 +01:00
|
|
|
|
|
|
|
# Restore permissions on app files
|
2023-02-26 16:31:30 +01:00
|
|
|
chmod -R o-rwx $install_dir
|
2023-10-09 10:09:28 +02:00
|
|
|
chmod -R 775 $install_dir/storage $install_dir/bootstrap/cache $install_dir/public/uploads
|
2023-02-26 16:31:30 +01:00
|
|
|
chown -R $app:www-data $install_dir
|
2023-10-09 10:09:28 +02:00
|
|
|
chmod 640 $install_dir/.env
|
2021-04-14 12:45:50 +02:00
|
|
|
|
2022-01-29 15:29:42 +01:00
|
|
|
#=================================================
|
2023-02-26 16:31:30 +01:00
|
|
|
# RESTORE THE MYSQL DATABASE
|
2022-01-29 15:29:42 +01:00
|
|
|
#=================================================
|
2023-02-26 16:31:30 +01:00
|
|
|
ynh_script_progression --message="Restoring the MySQL database..." --weight=2
|
2022-01-29 15:29:42 +01:00
|
|
|
|
2023-02-26 16:31:30 +01:00
|
|
|
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
2022-01-29 15:29:42 +01:00
|
|
|
|
2023-02-26 16:31:30 +01:00
|
|
|
#=================================================
|
|
|
|
# RESTORE SYSTEM CONFIGURATIONS
|
2021-02-01 14:42:41 +01:00
|
|
|
#=================================================
|
|
|
|
# RESTORE THE PHP-FPM CONFIGURATION
|
|
|
|
#=================================================
|
2023-02-26 16:31:30 +01:00
|
|
|
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
2021-02-01 14:42:41 +01:00
|
|
|
|
|
|
|
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
|
|
|
|
2022-12-30 12:09:15 +01:00
|
|
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
|
|
|
2022-05-25 18:35:13 +02:00
|
|
|
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
|
|
|
systemctl enable $app.service --quiet
|
|
|
|
|
2024-08-29 17:44:37 +02:00
|
|
|
yunohost service add $app --description="Platform to create documentation/wiki content" --log="/var/log/$app/$app.log"
|
2022-05-25 18:35:13 +02:00
|
|
|
|
2021-02-01 14:42:41 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
|
|
|
#=================================================
|
2023-02-26 16:31:30 +01:00
|
|
|
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
2021-02-01 14:42:41 +01:00
|
|
|
#=================================================
|
2023-02-26 16:31:30 +01:00
|
|
|
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
2021-02-01 14:42:41 +01:00
|
|
|
|
|
|
|
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
|
|
|
ynh_systemd_action --service_name=nginx --action=reload
|
|
|
|
|
2023-02-26 16:31:30 +01:00
|
|
|
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
|
|
|
|
2021-02-01 14:42:41 +01:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
2019-07-29 19:50:23 +02:00
|
|
|
|
2021-02-01 14:42:41 +01:00
|
|
|
ynh_script_progression --message="Restoration completed for $app" --last
|