From a09bef241fd15d2de3fa13de1b16f62edc936cb5 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 08:54:33 +0100 Subject: [PATCH] Fix --- scripts/backup | 7 +++++++ scripts/install | 19 ++++++++++++++----- scripts/remove | 12 ++++++++++++ 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/scripts/backup b/scripts/backup index a71ebf9..4db7554 100644 --- a/scripts/backup +++ b/scripts/backup @@ -30,6 +30,7 @@ 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) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +cache_dir=$(ynh_app_setting_get --app=$app --key=cache_dir) #================================================= # 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="$cache_dir" --is_big + #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= diff --git a/scripts/install b/scripts/install index e5b053f..7ee809b 100644 --- a/scripts/install +++ b/scripts/install @@ -146,16 +146,25 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=12 ynh_add_systemd_config +#================================================= +# CREATE DATA DIRECTORY +#================================================= +ynh_script_progression --message="Creating a data directory..." --weight=1 + +cache_dir=/home/yunohost.app/$app +ynh_app_setting_set --app=$app --key=cache_dir --value=$cache_dir + +mkdir -p $cache_dir + +chmod 750 "$cache_dir" +chmod -R o-rwx "$cache_dir" +chown -R $app:www-data "$cache_dir" + #================================================= # SET-UP DATABASE AND CONFIGURATION #================================================= ynh_script_progression --message="Configuring Movim..." --weight=1 -# Create cachedir folder -cache_dir="/home/yunohost.app/$app" -mkdir -p $cache_dir -chown -R $app:www-data "$final_path" - pushd $final_path php$phpversion composer.phar $app:migrate --quiet #php$phpversion daemon.php setAdmin $admin@${maindomain} diff --git a/scripts/remove b/scripts/remove index ff00c6f..b84d847 100644 --- a/scripts/remove +++ b/scripts/remove @@ -21,6 +21,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name +cache_dir=$(ynh_app_setting_get --app=$app --key=cache_dir) #================================================= # STANDARD REMOVE @@ -83,6 +84,17 @@ ynh_script_progression --message="Removing Movim cache directory..." --weight=6 # Remove the app directory securely ynh_secure_remove --file="/home/yunohost.app/$app" +#================================================= +# REMOVE DATA DIR +#================================================= + +# Remove the data directory if --purge option is used +if [ "${YNH_APP_PURGE:-0}" -eq 1 ] +then + ynh_script_progression --message="Removing app data directory..." --weight=1 + ynh_secure_remove --file="$cache_dir" +fi + #================================================= # REMOVE PHP-FPM CONFIGURATION #=================================================