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

75 lines
2.3 KiB
Text
Raw Normal View History

2021-02-16 13:38:59 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2021-02-16 14:17:45 +01:00
source _common.sh
2021-02-16 13:38:59 +01:00
source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
2022-07-03 16:40:34 +02:00
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop"
2021-02-16 13:38:59 +01:00
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
2021-03-27 21:06:39 +01:00
ynh_script_progression --message="Upgrading source files..."
2022-07-03 16:40:34 +02:00
# Download, check integrity, uncompress and patch the source from app.src
2023-03-12 22:15:34 +01:00
ynh_setup_source --dest_dir="$install_dir"
2021-02-16 13:38:59 +01:00
fi
2023-03-12 22:15:34 +01:00
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
2021-05-28 11:34:56 +02:00
2022-07-03 16:40:34 +02:00
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
2023-04-02 11:27:11 +02:00
ynh_script_progression --message="Upgrading dependencies..." --weight=1
2022-07-03 16:40:34 +02:00
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
2022-07-04 21:33:57 +02:00
ynh_use_nodejs
2022-07-03 16:40:34 +02:00
2021-02-16 13:38:59 +01:00
#=================================================
2023-03-12 22:29:28 +01:00
# REAPPLY SYSTEM CONFIGURATIONS
2021-02-16 13:38:59 +01:00
#=================================================
2023-03-12 22:29:28 +01:00
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=5
2021-02-16 13:38:59 +01:00
2022-07-03 16:40:34 +02:00
# Create a dedicated NGINX config
2021-02-16 13:38:59 +01:00
ynh_add_nginx_config
2022-07-03 16:40:34 +02:00
# Create a dedicated systemd config
2021-03-27 21:45:48 +01:00
ynh_add_systemd_config
2021-02-16 14:17:45 +01:00
2022-07-03 16:40:34 +02:00
yunohost service add $app --description="A non-linear personal web notebook"
2021-03-09 23:13:38 +01:00
2021-02-16 14:17:45 +01:00
#=================================================
# START SYSTEMD SERVICE
#=================================================
2021-03-27 21:06:39 +01:00
ynh_script_progression --message="Starting a systemd service..." --weight=1
2021-02-16 14:17:45 +01:00
2022-07-03 16:40:34 +02:00
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Serving on"
2021-02-16 13:38:59 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2021-03-27 21:06:39 +01:00
ynh_script_progression --message="Upgrade of $app completed" --last