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

74 lines
2.4 KiB
Text
Raw Normal View History

2015-05-24 23:01:16 +02:00
#!/bin/bash
2021-11-25 19:38:26 +01:00
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2021-11-25 19:38:26 +01:00
source _common.sh
source /usr/share/yunohost/helpers
2022-03-12 16:55:59 +01:00
#=================================================
2021-11-25 19:38:26 +01:00
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service…"
2021-11-25 19:38:26 +01:00
2022-03-12 16:55:59 +01:00
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd
2021-11-25 19:38:26 +01:00
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility…"
2021-11-25 19:38:26 +01:00
2024-02-21 14:59:14 +01:00
if [ -z "$(ls -A "$data_dir")" ]; then
mv "/root/.config/duniter"/{,.}* "$data_dir"
chmod -R o-rwx "$data_dir"
chown -R "$app:www-data" "$data_dir"
2021-11-25 19:38:26 +01:00
fi
2022-03-12 16:55:59 +01:00
#=================================================
# SPECIFIC UPGRADE
2021-11-25 19:38:26 +01:00
#=================================================
# INSTALL DUNITER
#=================================================
ynh_script_progression --message="Installation of Debian package of Duniter…"
2021-11-25 19:38:26 +01:00
2024-02-21 15:09:21 +01:00
ynh_setup_source --dest_dir="$install_dir"
2024-02-21 14:59:14 +01:00
ynh_exec_warn_less dpkg -i "$install_dir/duniter-server.deb"
ynh_secure_remove "$install_dir/duniter-server.deb"
2021-11-25 19:38:26 +01:00
#=================================================
# UPDATE DUNITER CONFIG FILE
2021-11-25 19:38:26 +01:00
#=================================================
ynh_script_progression --message="Configure Duniter…"
2021-11-25 19:38:26 +01:00
CONFIGURE_DUNITER
2021-11-25 19:38:26 +01:00
#=================================================
2024-02-21 14:59:14 +01:00
# REAPPLY SYSTEM CONFIGURATIONS
2021-11-25 19:38:26 +01:00
#=================================================
2024-02-21 14:59:14 +01:00
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
2021-11-25 19:38:26 +01:00
# Create a dedicated systemd config
ynh_add_systemd_config
2024-02-21 14:59:14 +01:00
yunohost service add "$app"
2021-11-25 19:38:26 +01:00
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service…"
2024-02-21 14:59:14 +01:00
ynh_systemd_action --service_name="$app" --action="start" --log_path=systemd
2020-06-11 18:26:52 +02:00
#=================================================
# END OF SCRIPT
#=================================================
2021-11-25 19:38:26 +01:00
2022-03-12 16:55:59 +01:00
ynh_script_progression --message="Upgrade of $app completed"