2015-05-24 23:01:16 +02:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
2021-11-25 19:38:26 +01:00
|
|
|
|
#=================================================
|
|
|
|
|
# GENERIC START
|
|
|
|
|
#=================================================
|
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
|
#=================================================
|
2015-12-02 21:41:55 +01:00
|
|
|
|
|
2021-11-25 19:38:26 +01:00
|
|
|
|
source _common.sh
|
2016-06-23 12:05:02 +02:00
|
|
|
|
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
|
|
|
|
|
#=================================================
|
2022-05-02 19:22:58 +02:00
|
|
|
|
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
|
|
|
|
|
#=================================================
|
2022-05-02 19:22:58 +02:00
|
|
|
|
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
|
|
|
|
|
|
2024-02-23 16:59:23 +01:00
|
|
|
|
if ynh_compare_current_package_version --comparison lt --version 1.8.7~ynh1; then
|
|
|
|
|
run_duniter reset data
|
|
|
|
|
fi
|
|
|
|
|
|
2022-03-12 16:55:59 +01:00
|
|
|
|
#=================================================
|
|
|
|
|
# SPECIFIC UPGRADE
|
2021-11-25 19:38:26 +01:00
|
|
|
|
#=================================================
|
|
|
|
|
# INSTALL DUNITER
|
|
|
|
|
#=================================================
|
2022-05-02 19:22:58 +02:00
|
|
|
|
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"
|
2022-05-02 19:23:03 +02:00
|
|
|
|
|
2021-11-25 19:38:26 +01:00
|
|
|
|
#=================================================
|
2022-05-05 20:35:42 +02:00
|
|
|
|
# UPDATE DUNITER CONFIG FILE
|
2021-11-25 19:38:26 +01:00
|
|
|
|
#=================================================
|
2022-05-05 20:35:42 +02:00
|
|
|
|
ynh_script_progression --message="Configure Duniter…"
|
2021-11-25 19:38:26 +01:00
|
|
|
|
|
2022-05-05 20:35:42 +02:00
|
|
|
|
CONFIGURE_DUNITER
|
2020-06-11 18:11:04 +02:00
|
|
|
|
|
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"
|
2016-05-31 23:22:59 +02:00
|
|
|
|
|
2021-11-25 19:38:26 +01:00
|
|
|
|
#=================================================
|
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
|
#=================================================
|
2022-05-02 19:22:58 +02:00
|
|
|
|
ynh_script_progression --message="Starting a systemd service…"
|
2016-06-23 13:29:22 +02:00
|
|
|
|
|
2024-02-23 16:32:45 +01:00
|
|
|
|
ynh_systemd_action --service_name="$app" --action="start" --log_path=systemd --line_match="Web administration accessible"
|
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"
|