From 4c50647173eeba71164e08c906526aaf9eb626d3 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 25 Apr 2021 19:19:22 +0200 Subject: [PATCH] Move uploads files --- scripts/upgrade | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 113da70..b83f87a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -119,6 +119,14 @@ if ynh_version_gt "1.0.0~ynh1" "${previous_version}" ; then ynh_store_file_checksum --file="$config" fi +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # CREATE DATADIR FOLDER #================================================= @@ -140,6 +148,8 @@ if [ -z "$datadir" ]; then chmod -R o-rwx "$datadir" chown -R $app:$app "$datadir" + rsync -a $final_path/$app/uploads/ $datadir/uploads/ + config="$final_path/$app/config/prod.secret.exs" ynh_backup_if_checksum_is_different --file="$config" @@ -151,16 +161,10 @@ if [ -z "$datadir" ]; then chmod 400 "$config" chown $app:$app "$config" + + ynh_secure_remove --file="$final_path/$app/uploads" fi -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #=================================================