mirror of
https://github.com/YunoHost-Apps/duniter_ynh.git
synced 2024-09-03 18:26:35 +02:00
73 lines
2.4 KiB
Bash
73 lines
2.4 KiB
Bash
#!/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
|
||
|
||
#=================================================
|
||
# SPECIFIC UPGRADE
|
||
#=================================================
|
||
# INSTALL DUNITER
|
||
#=================================================
|
||
ynh_script_progression --message="Installation of Debian package of Duniter…"
|
||
|
||
ynh_setup_source --dest_dir="$install_dir" --source_id=$architecture
|
||
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
|
||
|
||
#=================================================
|
||
# END OF SCRIPT
|
||
#=================================================
|
||
|
||
ynh_script_progression --message="Upgrade of $app completed"
|