1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/baikal_ynh.git synced 2024-09-03 18:16:11 +02:00
baikal_ynh/scripts/upgrade

55 lines
1.9 KiB
Bash

#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
timezone=$(cat /etc/timezone)
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Upgrading source files..." --weight=3
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="config Specific"
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
ynh_add_fpm_config
ynh_add_nginx_config
# Create the logfile, required before configuring fail2ban
touch "/var/log/nginx/${domain}-error.log"
# Create a dedicated fail2ban config
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex='"PHP message: user \(name stripped-out\) authentication failure for Baikal" while reading response header from upstream, client: <HOST>'
#=================================================
# SPECIFIC UPGRADE
#=================================================
# UPGRADE BAIKAL CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading the configuration file..." --weight=2
# We keep this to allow upgrade the config file in case it needs to be changed.
path=${path%/}
ynh_add_config --template="baikal.yaml" --destination="$install_dir/config/baikal.yaml"
chown $app: "$install_dir/config/baikal.yaml"
chmod 640 "$install_dir/config/baikal.yaml"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last