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

80 lines
2.6 KiB
Text
Raw Normal View History

2019-02-17 19:06:33 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
2022-07-29 00:43:33 +02:00
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
2022-10-05 22:54:13 +02:00
ynh_script_progression --message="Stopping a systemd service..." --weight=1
2022-07-29 00:43:33 +02:00
2023-11-11 23:16:43 +01:00
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
2019-02-17 19:06:33 +01:00
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
2022-07-29 00:43:33 +02:00
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
2022-10-05 22:54:13 +02:00
ynh_script_progression --message="Upgrading source files..." --weight=1
2022-07-29 00:43:33 +02:00
# Download, check integrity, uncompress and patch the source from app.src
2023-11-11 23:10:34 +01:00
ynh_setup_source --dest_dir="$install_dir" --keep="config.yml"
2023-11-28 07:17:27 +01:00
mv $install_dir/gotify-linux-* $install_dir/gotify
2022-07-29 00:43:33 +02:00
fi
2023-08-16 18:11:35 +02:00
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
2019-02-17 19:06:33 +01:00
#=================================================
# SPECIFIC UPGRADE
#=================================================
2022-07-29 00:43:33 +02:00
# UPDATE A CONFIG FILE
#=================================================
2023-11-23 18:59:44 +01:00
#ynh_script_progression --message="Updating a configuration file..." --weight=1
2019-02-17 19:06:33 +01:00
2023-11-23 18:59:44 +01:00
#ynh_add_config --template="config.yml" --destination="$install_dir/config.yml"
2019-02-17 19:06:33 +01:00
2023-11-23 18:59:44 +01:00
#chmod 400 "$install_dir/config.yml"
#chown $app:$app "$install_dir/config.yml"
2019-02-17 19:06:33 +01:00
#=================================================
2023-11-23 18:55:43 +01:00
# REAPPLY SYSTEM CONFIGURATIONS
2019-02-17 19:06:33 +01:00
#=================================================
2023-11-23 18:55:43 +01:00
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
2019-02-17 19:06:33 +01:00
2023-08-16 18:27:39 +02:00
# Create a dedicated NGINX config
ynh_add_nginx_config
2019-02-17 19:06:33 +01:00
# Create a dedicated systemd config
ynh_add_systemd_config
2023-11-11 23:10:34 +01:00
yunohost service add $app --description="Simple server for sending and receiving messages" --log="/var/log/$app/$app.log"
2020-11-22 15:27:37 +01:00
2019-02-17 19:06:33 +01:00
#=================================================
2022-07-29 00:43:33 +02:00
# START SYSTEMD SERVICE
2019-03-10 13:43:27 +01:00
#=================================================
2022-10-05 22:54:13 +02:00
ynh_script_progression --message="Starting a systemd service..." --weight=1
2019-03-10 13:43:27 +01:00
2023-11-11 23:16:43 +01:00
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
2019-03-10 13:43:27 +01:00
2020-11-30 15:07:53 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2019-03-10 17:11:52 +01:00
2020-11-22 15:27:37 +01:00
ynh_script_progression --message="Upgrade of $app completed" --last