1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wemawema_ynh.git synced 2024-10-01 13:34:56 +02:00
wemawema_ynh/scripts/restore

72 lines
2.3 KiB
Text
Raw Normal View History

2017-10-28 19:28:51 +02:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source ../settings/scripts/_common.sh
2017-10-28 19:28:51 +02:00
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
2017-10-28 19:28: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)
2017-10-28 19:28:51 +02:00
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
2017-10-28 19:28:51 +02:00
ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}"
2017-10-28 19:28:51 +02:00
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
2017-10-28 19:28:51 +02:00
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=3
2017-10-28 19:28:51 +02:00
ynh_restore_file --origin_path="$final_path"
2017-10-28 19:28:51 +02:00
# Restore permissions on app files
2021-04-21 23:52:56 +02:00
chmod 750 $final_path
2017-10-28 19:28:51 +02:00
chown -R www-data: $final_path
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX
#=================================================
2020-11-17 09:08:16 +01:00
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
2017-10-28 19:28:51 +02:00
ynh_script_progression --message="Restoration completed for $app" --last