2020-10-11 15:21:19 +02:00
#!/bin/bash
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
2024-02-05 15:30:16 +01:00
# RESTORE THE APP MAIN DIR
2020-10-11 15:21:19 +02:00
#=================================================
2024-08-31 00:59:03 +02:00
ynh_script_progression "Restoring the app main directory..."
2020-10-11 15:21:19 +02:00
2024-08-31 00:59:03 +02:00
ynh_restore "$install_dir"
2022-02-04 09:04:28 +01:00
2024-08-31 00:59:03 +02:00
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir"
2022-02-04 09:04:28 +01:00
#=================================================
2024-02-05 15:30:16 +01:00
# RESTORE SYSTEM CONFIGURATIONS
2022-02-04 09:04:28 +01:00
#=================================================
2024-08-31 00:59:03 +02:00
ynh_script_progression "Restoring system configurations related to $app..."
2022-02-04 09:04:28 +01:00
2024-08-31 00:59:03 +02:00
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
2022-02-04 09:04:28 +01:00
2024-08-31 00:59:03 +02:00
ynh_restore "/etc/systemd/system/$app.service"
2024-02-05 15:30:16 +01:00
systemctl enable "$app.service" --quiet
2024-02-05 15:39:09 +01:00
yunohost service add "$app" --description="Versatile web based messenger using IRC" --log="/var/log/$app/$app.log"
2024-08-31 00:59:03 +02:00
ynh_restore "/etc/logrotate.d/$app"
2022-02-04 09:49:47 +01:00
2020-10-25 09:00:51 +01:00
#=================================================
2024-02-05 15:30:16 +01:00
# RESTORE VARIOUS FILES
2020-10-25 09:00:51 +01:00
#=================================================
2024-08-31 00:59:03 +02:00
ynh_script_progression "Restoring various file..."
2020-10-25 09:00:51 +01:00
2024-08-31 00:59:03 +02:00
ynh_restore "/var/log/$app"
2020-10-25 09:00:51 +01:00
2020-10-11 15:21:19 +02:00
#=================================================
2024-02-05 13:11:42 +01:00
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
2020-10-11 15:21:19 +02:00
#=================================================
2024-08-31 00:59:03 +02:00
ynh_script_progression "Reloading NGINX web server and $app's service..."
2020-10-11 15:21:19 +02:00
2024-08-31 00:59:03 +02:00
ynh_systemctl --service="$app" --action="start" --log_path="systemd"
ynh_systemctl --service=nginx --action=reload
2020-10-11 15:21:19 +02:00
#=================================================
# END OF SCRIPT
#=================================================
2024-08-31 00:59:03 +02:00
ynh_script_progression "Restoration completed for $app"