1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/piwigo_ynh.git synced 2024-09-03 20:06:03 +02:00

Merge pull request #28 from YunoHost-Apps/fix_galleries_directory

Move galleries directory to /home/yunohost.app and don't delete it during upgrade (fixes #26)
This commit is contained in:
JimboJoe 2018-08-05 20:49:37 +02:00 committed by GitHub
commit a19947807c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 11 deletions

View file

@ -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

View file

@ -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