qr_ynh/scripts/restore

32 lines
1.3 KiB
Plaintext
Raw Normal View History

2019-08-13 21:35:51 +02:00
#!/bin/bash
source /usr/share/yunohost/helpers
ynh_abort_if_errors
2022-03-03 17:58:37 +01:00
ynh_script_progression --message="Loading installation settings..." --weight=1
2019-08-13 21:35:51 +02:00
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)
2022-03-03 17:58:37 +01:00
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
2019-08-13 21:35:51 +02:00
2022-03-03 17:58:37 +01:00
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
2019-08-13 21:35:51 +02:00
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
2022-03-05 02:45:30 +01:00
ynh_systemd_action --service_name=nginx --action=reload
2019-08-13 21:35:51 +02:00
2020-10-25 16:31:23 +01:00
ynh_script_progression --message="Recreating the dedicated system user..."
2022-03-03 17:58:37 +01:00
ynh_system_user_create --username=$app --home_dir="$final_path"
2019-08-13 21:35:51 +02:00
2022-03-03 17:58:37 +01:00
ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path"
chmod -R 440 "$final_path"
find "$final_path" -type d | xargs chmod 110
chmod 750 "$final_path"/css
2022-03-03 17:58:37 +01:00
chown -R $app:www-data "$final_path"
2019-08-13 21:35:51 +02:00
2022-03-05 02:39:55 +01:00
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
2019-08-13 21:35:51 +02:00
2020-10-31 22:01:13 +01:00
ynh_script_progression --message="Restoration completed for $app" --last