2017-07-23 17:46:25 +02:00
#!/bin/bash
2022-05-28 01:29:55 +02:00
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
2020-07-18 11:46:45 +02:00
source ../settings/scripts/_common.sh
2017-07-23 17:46:25 +02:00
source /usr/share/yunohost/helpers
#=================================================
2021-03-18 11:26:27 +01:00
# RESTORE THE APP MAIN DIR
2017-07-23 17:46:25 +02:00
#=================================================
2024-08-30 22:46:17 +02:00
ynh_script_progression "Restoring the app main directory..."
2017-07-23 17:46:25 +02:00
2024-08-30 22:46:17 +02:00
ynh_restore "$install_dir"
2017-07-23 17:46:25 +02:00
2024-08-30 22:46:17 +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 | chmod -R o-rwx "$install_dir"
#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:$app "$install_dir"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 600 "$install_dir/config/config.js"
2020-07-18 11:46:45 +02:00
2022-12-09 18:01:27 +01:00
#=================================================
# APPLY FOLDER GROUP RIGHTS FOR WWW-DATA
#=================================================
2023-03-12 08:42:18 +01:00
2023-03-12 08:24:05 +01:00
chgrp -R www-data $install_dir
2022-12-09 18:01:27 +01:00
2020-07-18 11:46:45 +02:00
#=================================================
# REINSTALL DEPENDENCIES
2017-07-23 17:46:25 +02:00
#=================================================
2024-08-30 22:46:17 +02:00
ynh_script_progression "Reinstalling dependencies..."
2017-07-23 17:46:25 +02:00
2022-05-28 01:29:55 +02:00
# Define and install dependencies
2024-08-30 22:46:17 +02:00
ynh_nodejs_install
2018-05-04 11:52:10 +02:00
2017-07-23 17:46:25 +02:00
#=================================================
2023-03-12 08:42:18 +01:00
# RESTORE SYSTEM CONFIGURATIONS
2017-07-23 17:46:25 +02:00
#=================================================
2023-03-12 08:42:18 +01:00
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
2024-08-30 22:46:17 +02:00
ynh_script_progression "Restoring system configurations related to $app..."
2023-03-12 08:42:18 +01:00
2024-08-30 22:46:17 +02:00
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
2017-07-23 17:46:25 +02:00
2024-08-30 22:46:17 +02:00
ynh_restore "/etc/systemd/system/$app.service"
2020-12-04 11:33:12 +01:00
systemctl enable $app.service --quiet
2017-07-23 17:46:25 +02:00
2020-12-04 11:33:12 +01:00
yunohost service add $app --description="Zero Knowledge realtime collaborative editor" --log="/var/log/$app/$app.log"
2017-07-23 17:46:25 +02:00
#=================================================
2023-03-12 08:42:18 +01:00
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
2017-07-23 17:46:25 +02:00
#=================================================
2024-08-30 22:46:17 +02:00
ynh_script_progression "Reloading NGINX web server and $app's service..."
2023-03-12 08:42:18 +01:00
2024-08-30 22:46:17 +02:00
ynh_systemctl --service=$app --action="start" --log_path=systemd --wait_until="server available"
2020-07-18 11:46:45 +02:00
2024-08-30 22:46:17 +02:00
ynh_systemctl --service=nginx --action=reload
2020-07-18 11:46:45 +02:00
#=================================================
# END OF SCRIPT
#=================================================
2017-07-23 17:46:25 +02:00
2024-08-30 22:46:17 +02:00
ynh_script_progression "Restoration completed for $app"