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

84 lines
2.6 KiB
Text
Raw Normal View History

2023-12-11 17:56:26 +01:00
#!/bin/bash
source _common.sh
source /usr/share/yunohost/helpers
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
#ynh_script_progression --message="Ensuring downward compatibility..."
#
# N.B. : the followings setting migrations snippets are provided as *EXAMPLES*
# of what you may want to do in some cases (e.g. a setting was not defined on
# some legacy installs and you therefore want to initialize stuff during upgrade)
#
# If db_name doesn't exist, create it
#if [ -z "${db_name:-}" ]; then
# db_name=$(ynh_sanitize_dbid --db_name=$app)
# ynh_app_setting_set --app=$app --key=db_name --value=$db_name
#fi
# If install_dir doesn't exist, create it
#if [ -z "${install_dir:-}" ]; then
# install_dir=/var/www/$app
# ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
#fi
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
#=================================================
2023-12-12 11:38:41 +01:00
# UPDATE DIACAMMA
2023-12-11 17:56:26 +01:00
#=================================================
2023-12-12 11:38:41 +01:00
ynh_script_progression --message="Updating Diacamma..."
2023-12-11 17:56:26 +01:00
2023-12-12 11:38:41 +01:00
pushd $install_dir
. venv/bin/activate
lucterios_admin.py check
lucterios_admin.py update
lucterios_admin.py refreshall
2023-12-11 17:56:26 +01:00
2023-12-12 11:38:41 +01:00
refresh_collect
popd
2023-12-11 17:56:26 +01:00
2023-12-12 11:38:41 +01:00
chmod 400 "$install_dir/"
chown ${app}:${app} "$install_dir/"
2023-12-11 17:56:26 +01:00
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..."
ynh_add_nginx_config
ynh_add_systemd_config
yunohost service add $app --log="/var/log/$app/$app.log"
ynh_use_logrotate --non-append
# Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex=""
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last