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

Merge pull request #167 from Tagadda/fix-migration-with-datadir

[fix] Create datadir after user is created
This commit is contained in:
yalh76 2022-01-26 20:25:32 +01:00 committed by GitHub
commit 7b68046043
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -91,18 +91,6 @@ fi
ynh_remove_logrotate 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 # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
@ -133,6 +121,23 @@ ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing) # Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path 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 # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================