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

Update upgrade

This commit is contained in:
yalh76 2021-05-18 03:42:43 +02:00
parent a74777ca6b
commit a1c0d4c4cf

View file

@ -29,6 +29,7 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
@ -108,6 +109,11 @@ ynh_system_user_create --username=$app --home_dir=$final_path
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
# sets extended pattern matching options in the bash shell
shopt -s extglob
datapath=/home/yunohost.app/$app
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=3
@ -120,8 +126,37 @@ then
mkdir -p $tmpdir/plugins/Ldap_Login
ynh_setup_source --dest_dir="$tmpdir/plugins/Ldap_Login" --source_id=ldap_plugin
ynh_setup_source --dest_dir="$tmpdir/plugins" --source_id=log_failed_logins_plugin
# Install files and set permissions
cp -a $tmpdir/!(upload|_data|galleries) $final_path
# Backward compatibility:
# If the _data subdirectory wasn't already moved to /home/yunohost.app/$app,
# then move it there
if [ ! -h $final_path/_data ] ; then
mv $final_path/_data $datapath
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
ynh_secure_remove --file="$tmpdir"
fi
chmod 750 "$datapath"
chmod -R o-rwx "$datapath"
chown -R $app:www-data "$datapath"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -147,47 +182,6 @@ ynh_add_fpm_config
#=================================================
# SPECIFIC UPGRADE
#=================================================
# COPY FILES TO $FINAL_PATH
#=================================================
# sets extended pattern matching options in the bash shell
shopt -s extglob
datapath=/home/yunohost.app/$app
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
# Install files and set permissions
cp -a $tmpdir/!(upload|_data|galleries) $final_path
# Backward compatibility:
# If the _data subdirectory wasn't already moved to /home/yunohost.app/$app,
# then move it there
if [ ! -h $final_path/_data ] ; then
mv $final_path/_data $datapath
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
ynh_secure_remove --file="$tmpdir"
fi
chmod 750 "$datapath"
chmod -R o-rwx "$datapath"
chown -R $app:www-data "$datapath"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# UPGRADE APPLICATION WITH CURL
#=================================================