1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/vaultwarden_ynh.git synced 2024-09-03 18:26:31 +02:00

[fix] Migrate datadir after user is created

Fix #166
This commit is contained in:
Tagadda 2022-01-24 21:21:08 +00:00
parent 9270675f06
commit 8c61324f5b

View file

@ -91,18 +91,6 @@ fi
ynh_remove_logrotate
# 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/live/data/" "$datadir/" --delete-after --remove-source-files
ynh_secure_remove --file="$final_path/live/data"
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:$app "$datadir"
fi
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
@ -133,6 +121,23 @@ 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 DATA DIRECTORY
#=================================================
ynh_script_progression --message="Making sure data directory exists..."
# 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/live/data/" "$datadir/" --delete-after --remove-source-files
ynh_secure_remove --file="$final_path/live/data"
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:$app "$datadir"
fi
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================