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

77 lines
2.5 KiB
Bash
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service…"
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility…"
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"
fi
if ynh_compare_current_package_version --comparison lt --version 1.8.7~ynh1; then
run_duniter reset data
fi
#=================================================
# SPECIFIC UPGRADE
#=================================================
# INSTALL DUNITER
#=================================================
ynh_script_progression --message="Installation of Debian package of Duniter…"
ynh_setup_source --dest_dir="$install_dir"
ynh_exec_warn_less dpkg -i "$install_dir/duniter-server.deb"
ynh_secure_remove "$install_dir/duniter-server.deb"
#=================================================
# UPDATE DUNITER CONFIG FILE
#=================================================
ynh_script_progression --message="Configure Duniter…"
CONFIGURE_DUNITER
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
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
yunohost service add "$app"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service…"
ynh_systemd_action --service_name="$app" --action="start" --log_path=systemd --line_match="Web administration accessible"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed"