diff --git a/scripts/install b/scripts/install index 6796574..9cb15be 100644 --- a/scripts/install +++ b/scripts/install @@ -104,14 +104,20 @@ 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 + +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 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