mirror of
https://github.com/YunoHost-Apps/galette_ynh.git
synced 2024-09-03 18:36:28 +02:00
84 lines
2.5 KiB
Bash
Executable file
84 lines
2.5 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# LOAD SETTINGS
|
|
#=================================================
|
|
|
|
timezone="$(cat /etc/timezone)"
|
|
|
|
#=================================================
|
|
# CHECK VERSION
|
|
#=================================================
|
|
|
|
upgrade_type=$(ynh_check_app_version_changed)
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
|
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
|
then
|
|
ynh_script_progression --message="Upgrading source files..."
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
|
mv "$install_dir" "$install_dir.old"
|
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
|
|
|
# when running automatic tests, there is no config.inc.php
|
|
if [ -e "$install_dir.old/galette/config/config.inc.php" ]; then
|
|
cp "$install_dir.old/galette/config/config.inc.php" "$install_dir/galette/config/config.inc.php"
|
|
cp -r "$install_dir.old/galette/data" "$install_dir/galette/data"
|
|
cp -r "$install_dir.old/galette/plugins" "$install_dir/galette/plugins"
|
|
fi
|
|
|
|
# delete temp directory
|
|
#REMOVEME? ynh_secure_remove "$install_dir.old"
|
|
fi
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
chown -R $app:www-data "$install_dir"
|
|
|
|
#=================================================
|
|
# PHP-FPM CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
|
|
|
|
# Create a dedicated PHP-FPM config
|
|
ynh_add_fpm_config
|
|
|
|
# Create a dedicated NGINX config
|
|
ynh_add_nginx_config
|
|
|
|
# Use logrotate to manage app-specific logfile(s)
|
|
ynh_use_logrotate --non-append
|
|
|
|
#=================================================
|
|
# SPECIFIC UPGRADE
|
|
#=================================================
|
|
# SECURE FILES AND DIRECTORIES
|
|
#=================================================
|
|
|
|
chown "$app" "$install_dir/galette/config"
|
|
chmod 750 "$install_dir/galette/config"
|
|
|
|
for folder in attachments cache exports files imports logs photos templates_c tempimages
|
|
do
|
|
chown "$app" "$install_dir/galette/data/$folder"
|
|
chmod 775 "$install_dir/galette/data/$folder"
|
|
done
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|