diff --git a/scripts/backup b/scripts/backup index 111d116..514800d 100644 --- a/scripts/backup +++ b/scripts/backup @@ -30,6 +30,7 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +public_path=$(ynh_app_setting_get --app=$app --key=public_path) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -42,6 +43,12 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" +#================================================= +# BACKUP THE DATA DIR +#================================================= + +ynh_backup --src_path="$public_path" --is_big + #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= diff --git a/scripts/install b/scripts/install index 1545444..b15901c 100644 --- a/scripts/install +++ b/scripts/install @@ -112,13 +112,16 @@ chown -R $app:www-data "$final_path" #================================================= # CREATE DIRECTORIES #================================================= +ynh_script_progression --message="Creating a data directory..." public_path=/home/yunohost.app/$app ynh_app_setting_set --app=$app --key=public_path --value=$public_path mkdir -p $public_path -chown -R $app:www-data $public_path -chmod 755 $public_path + +chmod 755 "$public_path" +chmod -R o-rwx "$public_path" +chown -R $app:www-data "$public_path" #================================================= # NGINX CONFIGURATION diff --git a/scripts/restore b/scripts/restore index 66b9de4..16dd503 100644 --- a/scripts/restore +++ b/scripts/restore @@ -74,6 +74,19 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +#================================================= +# RESTORE THE DATA DIRECTORY +#================================================= +ynh_script_progression --message="Restoring the data directory..." + +ynh_restore_file --origin_path="$public_path" --not_mandatory + +mkdir -p $public_path + +chmod 750 "$public_path" +chmod -R o-rwx "$public_path" +chown -R $app:www-data "$public_path" + #================================================= # SPECIFIC RESTORATION #=================================================