2017-09-22 13:53:04 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
2021-11-25 10:22:17 +01:00
|
|
|
# GENERIC START
|
2017-09-22 13:53:04 +02:00
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
2021-11-25 10:22:17 +01:00
|
|
|
# CHECK VERSION
|
2017-09-22 13:53:04 +02:00
|
|
|
#=================================================
|
2021-11-25 10:22:17 +01:00
|
|
|
|
|
|
|
upgrade_type=$(ynh_check_app_version_changed)
|
2017-09-22 13:53:04 +02:00
|
|
|
|
|
|
|
#=================================================
|
2021-11-25 10:22:17 +01:00
|
|
|
# STANDARD UPGRADE STEPS
|
2017-09-22 13:53:04 +02:00
|
|
|
#=================================================
|
2021-11-25 10:22:17 +01:00
|
|
|
# STOP SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2021-11-25 12:05:27 +01:00
|
|
|
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
2021-11-25 10:22:17 +01:00
|
|
|
|
2022-02-22 00:35:52 +01:00
|
|
|
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped Turtl Server"
|
2017-09-22 13:53:04 +02:00
|
|
|
|
2021-11-25 10:22:17 +01:00
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
|
|
|
then
|
2021-11-25 12:05:27 +01:00
|
|
|
ynh_script_progression --message="Upgrading source files..." --weight=2
|
2021-11-25 10:22:17 +01:00
|
|
|
|
2022-02-22 00:35:52 +01:00
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
2023-12-09 20:44:45 +01:00
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
2021-11-25 10:22:17 +01:00
|
|
|
fi
|
|
|
|
|
2023-12-09 20:44:45 +01:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2021-11-25 10:22:17 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# NGINX CONFIGURATION
|
|
|
|
#=================================================
|
2023-12-10 11:12:24 +01:00
|
|
|
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
2021-11-25 10:22:17 +01:00
|
|
|
|
|
|
|
# Create a dedicated NGINX config
|
|
|
|
ynh_add_nginx_config
|
|
|
|
|
2021-11-25 12:05:27 +01:00
|
|
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
2021-11-25 10:22:17 +01:00
|
|
|
|
|
|
|
# Create a dedicated systemd config
|
|
|
|
ynh_add_systemd_config
|
|
|
|
|
2023-12-10 11:12:24 +01:00
|
|
|
yunohost service add $app --description="Share notes, bookmarks, and documents" --log="/var/log/$app/$app.log"
|
2021-11-25 10:22:17 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2021-11-25 12:05:27 +01:00
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=5
|
2021-11-25 10:22:17 +01:00
|
|
|
|
2022-02-22 00:35:52 +01:00
|
|
|
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Listening for turtls on IP"
|
2021-11-25 10:22:17 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2021-11-25 12:05:27 +01:00
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|