1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/icecoder_ynh.git synced 2024-09-03 19:26:10 +02:00
icecoder_ynh/scripts/restore

56 lines
2.1 KiB
Text
Raw Normal View History

2021-03-19 19:47:11 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
2023-11-25 15:13:16 +01:00
#REMOVEME? ynh_abort_if_errors
2021-03-19 19:47:11 +01:00
#=================================================
# LOAD SETTINGS
#=================================================
2023-11-25 15:13:16 +01:00
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
2021-03-19 19:47:11 +01:00
2023-11-25 15:13:16 +01:00
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
2021-03-19 19:47:11 +01:00
2023-11-25 15:13:16 +01:00
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? app_id=$(ynh_app_setting_get --app=$app --key=app_id)
#REMOVEME? sub_folder=$(ynh_app_setting_get --app=$app --key=sub_folder)
2021-03-19 19:47:11 +01:00
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
2023-11-25 15:13:16 +01:00
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..."
2021-03-19 19:47:11 +01:00
2023-11-25 15:13:16 +01:00
#REMOVEME? #REMOVEME? test -e "$(ynh_app_setting_get --app=$app_id --key=install_dir)" || ynh_die --message="You don't have installed $app_id before installing this app"
#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder"
2021-03-19 19:47:11 +01:00
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
2022-03-24 21:01:11 +01:00
ynh_script_progression --message="Restoring the app main directory..."
2021-03-19 19:47:11 +01:00
2023-11-25 15:13:16 +01:00
ynh_restore_file --origin_path="$install_dir"
2021-03-19 19:47:11 +01:00
2023-11-25 15:13:16 +01:00
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app_id:www-data "$install_dir"
2021-03-19 19:47:11 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2022-03-24 21:01:11 +01:00
ynh_script_progression --message="Restoration completed for $app"