restarter_ynh/scripts/restore
2023-09-27 20:51:07 +02:00

46 lines
1.4 KiB
Bash

#!/bin/bash
source /usr/share/yunohost/helpers
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$install_dir"
chown -R www-date:www-data $install_dir
chmod 750 "$install_dir"
chmod 640 "$install_dir/*"
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=2
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# RESTORE SUDOERS CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the sudoers configuration..." --weight=1
ynh_restore_file --origin_path="/etc/sudoers.d/$app"
chown root:root "/etc/sudoers.d/$app"
chmod 600 "/etc/sudoers.d/$app"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last