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

69 lines
2.4 KiB
Text
Raw Normal View History

2021-09-08 10:52:58 +02:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
2021-10-08 13:13:32 +02:00
ynh_script_progression --message="Stopping a systemd service..." --weight=1
2021-09-08 10:52:58 +02:00
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
2021-10-08 13:13:32 +02:00
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
2021-09-08 10:52:58 +02:00
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
2024-01-06 00:11:26 +01:00
if [ "$upgrade_type" == "UPGRADE_APP" ]; then
ynh_script_progression --message="Upgrading source files..." --weight=1
2021-09-08 10:52:58 +02:00
2024-01-06 00:11:26 +01:00
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
2021-09-08 10:52:58 +02:00
fi
2024-01-06 00:11:26 +01:00
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
2021-09-08 10:52:58 +02:00
#=================================================
2022-07-02 19:06:02 +02:00
# NGINX CONFIGURATION
2021-09-08 10:52:58 +02:00
#=================================================
2022-07-02 19:06:02 +02:00
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
2021-09-08 10:52:58 +02:00
2022-07-02 19:06:02 +02:00
# Create a dedicated NGINX config
ynh_add_nginx_config
2021-09-08 10:52:58 +02:00
# Create a dedicated systemd config
ynh_add_systemd_config
2024-01-06 11:46:27 +01:00
yunohost service add $app --description="Secure Scuttlebutt room server" --log="/var/log/$app/$app.log" --needs_exposed_ports $port_ssb
2021-09-08 10:52:58 +02:00
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
#=================================================
# START SYSTEMD SERVICE
#=================================================
2021-10-08 13:13:32 +02:00
ynh_script_progression --message="Starting a systemd service..." --weight=1
2021-09-08 10:52:58 +02:00
2022-07-02 19:06:02 +02:00
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="event=serving"
2021-09-08 10:52:58 +02:00
#=================================================
# END OF SCRIPT
#=================================================
2021-10-08 13:13:32 +02:00
ynh_script_progression --message="Upgrade of $app completed" --last