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

Fix uploads folder migration

This commit is contained in:
Augustin Trancart 2023-03-19 09:33:21 +01:00
parent 9e99807ae4
commit 255a9bb0ca
2 changed files with 12 additions and 3 deletions

View file

@ -94,8 +94,8 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path/live"
# create upload folder and link it
mkdir $final_path/uploads
ln -s $final_path/uploads $final_path/live/
mkdir -p "$final_path/uploads"
ln -s "$final_path/uploads" "$final_path/live/public"
chmod -R 750 "$final_path"
chown -R $app:www-data "$final_path"

View file

@ -91,9 +91,18 @@ if gpg --list-keys piotr.kuczynski@gmail.com >/dev/null 2>&1; then
fi
if ! [ -d "$final_path/live" ]; then
# NOTE if nobody never uploads anything, this won't exist yet
# creating it anyway, it's simpler if we can assume it exists always
# but we CANNOT assume it exists from previous version
if [ -d "$final_path/diaspora/public/uploads" ]; then
mv "$final_path/diaspora/public/uploads" "$final_path/uploads"
else
mkdir "$final_path/uploads"
fi
ynh_delete_file_checksum --file="$final_path/diaspora/config/diaspora.yml"
ynh_delete_file_checksum --file="$final_path/diaspora/config/database.yml"
mv "$final_path/diaspora" "$final_path/live"
ls -s "$final_path/uploads" "$final_path/live/public"
ynh_store_file_checksum --file="$final_path/live/config/diaspora.yml"
ynh_store_file_checksum --file="$final_path/live/config/database.yml"
chmod 750 "$final_path"
@ -127,7 +136,7 @@ then
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path/live" --keep="config/diaspora.yml config/database.yml"
ln -s $final_path/uploads $final_path/live/
ln -s "$final_path/uploads" "$final_path/live/public"
cp "$tmpdir/diaspora.yml" "$final_path/live/config/diaspora.yml"
cp "$tmpdir/database.yml" "$final_path/live/config/database.yml"