qr_ynh/scripts/restore

30 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
ynh_abort_if_errors
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
ynh_script_progression --message="Recreating the dedicated system user..."
ynh_system_user_create --username=$app --home_dir="$final_path"
ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path"
libreqr_apply_filesystem_permissions
ynh_script_progression --message="Restoring the PHP-FPM configuration..."
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_script_progression --message="Restoring the NGINX configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_systemd_action --service_name=nginx --action=reload
ynh_script_progression --message="Restoration completed for $app" --last