From 8944e7fa2c3392ffc1cbfa7a9cde32d30150e846 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Tue, 2 Jul 2019 21:40:10 +0200 Subject: [PATCH] Fix upgrade in case of missing uploads directory --- scripts/upgrade | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index ae463bd..e451363 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -95,7 +95,10 @@ if ! ynh_is_upstream_up_to_date ; then ynh_app_setting_set $app final_path $final_path # Backup files to keep 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 cp -Rp $final_path/public/backups $tmpdir fi @@ -107,7 +110,9 @@ if ! ynh_is_upstream_up_to_date ; then # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source "$final_path" # Restore previous files - cp -Rp $tmpdir/uploads $final_path/public + if [ -d $tmpdir/uploads ] ; then + cp -Rp $tmpdir/uploads $final_path/public + fi if [ -d $tmpdir/backups ] ; then cp -Rp $tmpdir/backups $final_path/public fi