From d9487bfeb937dc4d15760a4235262e5402be7d58 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 8 Jun 2022 19:31:07 +0200 Subject: [PATCH] Fix datadir --- scripts/upgrade | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index abb6957..3e7d4d5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -58,6 +58,19 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app #================================================= ynh_script_progression --message="Ensuring downward compatibility..." +# If datadir doesn't exist, create it +if [ -z $datadir ]; then + datadir=/home/yunohost.app/$app + ynh_app_setting_set --app=$app --key=datadir --value=$datadir + mkdir -p $datadir + rsync -arz "$final_path/config/" "$datadir/config/" --delete-after --remove-source-files + rsync -arz "$final_path/audiobooks/" "$datadir/audiobooks/" --delete-after --remove-source-files + rsync -arz "$final_path/metadata/" "$datadir/metadata/" --delete-after --remove-source-files + chmod 750 "$datadir" + chmod -R o-rwx "$datadir" + chown -R $app:$app "$datadir" +fi + #================================================= # CREATE DEDICATED USER #=================================================