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

Fix upgrade in case of missing uploads directory

This commit is contained in:
Jimmy Monin 2019-07-02 21:40:10 +02:00
parent 62557e6c9f
commit 8944e7fa2c

View file

@ -95,7 +95,10 @@ if ! ynh_is_upstream_up_to_date ; then
ynh_app_setting_set $app final_path $final_path ynh_app_setting_set $app final_path $final_path
# Backup files to keep # Backup files to keep
tmpdir=$(mktemp -d) tmpdir=$(mktemp -d)
cp -Rp $final_path/public/uploads $final_path/plugins $final_path/config/discourse.conf $tmpdir cp -Rp $final_path/plugins $final_path/config/discourse.conf $tmpdir
if [ -d $final_path/public/uploads ] ; then
cp -Rp $final_path/public/uploads $tmpdir
fi
if [ -d $final_path/public/backups ] ; then if [ -d $final_path/public/backups ] ; then
cp -Rp $final_path/public/backups $tmpdir cp -Rp $final_path/public/backups $tmpdir
fi fi
@ -107,7 +110,9 @@ if ! ynh_is_upstream_up_to_date ; then
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path" ynh_setup_source "$final_path"
# Restore previous files # Restore previous files
if [ -d $tmpdir/uploads ] ; then
cp -Rp $tmpdir/uploads $final_path/public cp -Rp $tmpdir/uploads $final_path/public
fi
if [ -d $tmpdir/backups ] ; then if [ -d $tmpdir/backups ] ; then
cp -Rp $tmpdir/backups $final_path/public cp -Rp $tmpdir/backups $final_path/public
fi fi