From 37bdda0d8b9234cf7e8caccb8a8d567dbe15a0dc Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Tue, 31 Jul 2018 21:35:38 +0200 Subject: [PATCH 1/2] Move `galleries directory to /home/yunohost.app, and avoid deleting it during upgrade (fixes #26) --- scripts/install | 4 +++- scripts/upgrade | 18 ++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/install b/scripts/install index 6796574..4c48073 100644 --- a/scripts/install +++ b/scripts/install @@ -104,14 +104,16 @@ ynh_system_user_create $app # Create a dedicated system user # Install files and set permissions mkdir $final_path -cp -a $tmpdir/!(upload|_data) $final_path +cp -a $tmpdir/!(upload|_data|galleries) $final_path datapath=/home/yunohost.app/$app mkdir -p $datapath/_data mkdir -p $datapath/upload +mkdir -p $datapath/galleries ln -sd $datapath/_data $final_path/_data ln -sd $datapath/upload $final_path/upload +ln -sd $datapath/galleries $final_path/galleries chown -R $app: $final_path chown -R $app: $datapath diff --git a/scripts/upgrade b/scripts/upgrade index c03beee..518363c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -128,17 +128,8 @@ ynh_system_user_create $app # Create dedicated user if not existing # We store photos (potentially large data) on /home/yunohost.app datapath=/home/yunohost.app/$app -# Backward compatibility: -# If the galleries subdirectory was moved, -# remove the link and overwrite it -# (this directory always includes only a single index.php file...) -if [ -h $final_path/galleries ] ; then - rm -f $final_path/galleries # only a symbolic link, ynh_secure_remove can't handle that - ynh_secure_remove $datapath/galleries -fi - # Install files and set permissions -cp -a $tmpdir/!(upload|_data) $final_path +cp -a $tmpdir/!(upload|_data|galleries) $final_path # Backward compatibility: @@ -149,6 +140,13 @@ if [ ! -h $final_path/_data ] ; then ln -sd $datapath/_data $final_path/_data fi +# Backward compatibility: +# If the galleries subdirectory wasn't already moved to /home/yunohost.app/$app, +# then move it there +if [ ! -h $final_path/galleries ] ; then + mv $final_path/galleries $datapath + ln -sd $datapath/galleries $final_path/galleries +fi chown -R $app: $final_path chown -R $app: $datapath From 2d216e16f9ada7accb0cfb205d2f9ec343b61515 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Tue, 31 Jul 2018 22:29:39 +0200 Subject: [PATCH 2/2] Copy initial archive files in _data, galleries and upload directories --- scripts/install | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/install b/scripts/install index 4c48073..9cb15be 100644 --- a/scripts/install +++ b/scripts/install @@ -115,6 +115,10 @@ ln -sd $datapath/_data $final_path/_data ln -sd $datapath/upload $final_path/upload ln -sd $datapath/galleries $final_path/galleries +cp -Rp $tmpdir/_data/. $final_path/_data +cp -Rp $tmpdir/upload/. $final_path/upload +cp -Rp $tmpdir/galleries/. $final_path/galleries + chown -R $app: $final_path chown -R $app: $datapath chmod 755 -R $final_path/_data