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
|
|
|
|
|
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
|
|
|
|
#=================================================
|
2024-06-05 11:28:31 +02:00
|
|
|
ynh_script_progression --message="Upgrading source files..."
|
2021-02-16 13:38:59 +01:00
|
|
|
|
2024-06-05 11:28:31 +02:00
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
2024-06-05 11:31:53 +02:00
|
|
|
ynh_setup_source --dest_dir="$install_dir" --full_replace=1
|
2021-02-16 13:38:59 +01:00
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
2024-02-28 23:19:34 +01:00
|
|
|
# Create a dedicated NGINX config
|
2021-02-16 13:38:59 +01:00
|
|
|
ynh_add_nginx_config
|
|
|
|
|
2024-02-28 23:19:34 +01: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
|
|
|
|
2024-06-05 11:34:32 +02:00
|
|
|
yunohost service add $app --description="A non-linear personal web notebook" --log="/var/log/$app/$app.log"
|
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
|