1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mygpo_ynh.git synced 2024-09-03 19:55:52 +02:00
mygpo_ynh/scripts/upgrade

97 lines
3.8 KiB
Text
Raw Normal View History

2014-10-20 18:55:53 +02:00
#!/bin/bash
2017-06-02 18:44:37 +02:00
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2017-06-05 13:06:35 +02:00
source _common.sh
2017-06-02 18:44:37 +02:00
source /usr/share/yunohost/helpers
2019-05-02 20:44:22 +02:00
#=================================================
# STOP SYSTEMD SERVICES
2019-05-02 20:44:22 +02:00
#=================================================
2024-03-04 15:42:05 +01:00
ynh_script_progression --message="Stopping $app's systemd services..." --weight=1
2019-05-02 20:44:22 +02:00
2024-03-04 15:42:05 +01:00
ynh_systemd_action --service_name="$app.socket" --action="stop" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app-beat" --action="stop" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app-celery" --action="stop" --log_path="/var/log/$app/$app.log"
2021-03-15 01:36:28 +01:00
2024-03-04 15:42:05 +01:00
systemctl disable "$app.socket" --quiet
systemctl disable "$app" --quiet
systemctl disable "$app-beat" --quiet
systemctl disable "$app-celery" --quiet
2019-05-02 20:44:22 +02:00
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --time --weight=1
2024-03-04 15:42:05 +01:00
if [ -n "${data_path:-}" ]; then
ynh_app_setting_delete --app="$app" --key=data_path
ynh_app_setting_delete --app="$app" --key=db_pwd
ynh_app_setting_delete --app="$app" --key=admin_email
fi
2017-06-02 18:44:37 +02:00
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
2024-03-04 15:42:05 +01:00
ynh_script_progression --message="Upgrading source files..." --weight=1
2024-03-04 15:42:05 +01:00
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
2017-06-02 18:44:37 +02:00
set_permissions
2017-06-02 18:44:37 +02:00
#=================================================
2021-03-15 01:36:28 +01:00
# SPECIFIC UPGRADE
#=================================================
# UPDATE VIRTUALENV
2017-06-02 18:44:37 +02:00
#=================================================
2021-03-15 01:36:28 +01:00
ynh_script_progression --message="Upgrading Python virtualenv..." --weight=2
2017-06-02 18:44:37 +02:00
set_up_virtualenv
2017-06-02 18:44:37 +02:00
2024-03-04 15:42:05 +01:00
2017-06-02 18:44:37 +02:00
#=================================================
2021-03-15 01:36:28 +01:00
# PERFORM DATABASE MIGRATIONS
2017-06-02 18:44:37 +02:00
#=================================================
2021-03-15 01:36:28 +01:00
ynh_script_progression --message="Performing database migrations..." --weight=2
upgrade_db
2017-06-02 18:44:37 +02:00
#=================================================
2024-03-04 15:42:05 +01:00
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
2024-03-04 15:42:05 +01:00
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
# Create a dedicated systemd config
ynh_add_systemd_config
2021-03-15 01:36:28 +01:00
ynh_add_systemd_config --service="$app-socket" --template systemd.socket
ynh_add_systemd_config --service="$app-celery" --template systemd-celery.service
ynh_add_systemd_config --service="$app-beat" --template systemd-beat.service
systemctl disable "$app-socket.service" --quiet
mv "/etc/systemd/system/$app-socket.service" "/etc/systemd/system/$app.socket"
systemctl daemon-reload --quiet
2024-03-04 15:42:05 +01:00
yunohost service add "$app" --description="Manage podcast subscriptions, and sync them between apps and devices" --log="/var/log/$app/$app.log"
2017-06-02 18:44:37 +02:00
2019-05-02 20:44:22 +02:00
#=================================================
# START SYSTEMD SERVICE
#=================================================
2024-03-04 15:42:05 +01:00
ynh_script_progression --message="Starting $app's systemd service..." --weight=1
2017-06-02 18:44:37 +02:00
2024-03-04 15:42:05 +01:00
ynh_systemd_action --service_name="$app.socket" --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app-celery" --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app-beat" --action="start" --log_path="/var/log/$app/$app.log"
2019-02-10 15:02:38 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2021-03-15 01:36:28 +01:00
ynh_script_progression --message="Upgrade of $app completed" --last