2015-08-22 20:24:46 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-05-01 12:25:53 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2015-08-22 20:24:46 +02:00
|
|
|
|
2018-05-01 12:25:53 +02:00
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
2015-08-22 20:24:46 +02:00
|
|
|
|
2018-05-01 12:25:53 +02:00
|
|
|
#=================================================
|
|
|
|
# STANDARD UPGRADE STEPS
|
|
|
|
#=================================================
|
2019-10-25 11:04:41 +02:00
|
|
|
# STOP SYSTEMD SERVICE
|
2018-05-01 12:25:53 +02:00
|
|
|
#=================================================
|
2021-11-23 08:28:18 +01:00
|
|
|
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
2018-05-01 12:25:53 +02:00
|
|
|
|
2021-03-22 10:00:33 +01:00
|
|
|
ynh_systemd_action --service_name=$app --action=stop --log_path=systemd
|
2015-08-22 20:24:46 +02:00
|
|
|
|
2018-05-01 12:25:53 +02:00
|
|
|
#=================================================
|
2019-10-25 11:04:41 +02:00
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
2018-05-01 12:25:53 +02:00
|
|
|
#=================================================
|
2024-04-07 09:46:39 +02:00
|
|
|
ynh_script_progression --message="Upgrading source files..." --weight=2
|
2015-08-22 20:24:46 +02:00
|
|
|
|
2024-04-07 09:46:39 +02:00
|
|
|
ynh_setup_source --dest_dir=$install_dir --full_replace=1
|
2018-05-01 12:25:53 +02:00
|
|
|
|
2023-03-14 16:44:09 +01:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2021-08-02 08:23:59 +02:00
|
|
|
|
2020-05-27 17:03:30 +02:00
|
|
|
#=================================================
|
2020-05-30 19:18:05 +02:00
|
|
|
# UPGRADE DEPENDENCIES
|
2020-05-27 17:03:30 +02:00
|
|
|
#=================================================
|
2023-03-19 14:58:43 +01:00
|
|
|
ynh_script_progression --message="Upgrading dependencies..." --weight=5
|
2020-05-27 17:03:30 +02:00
|
|
|
|
2020-05-29 22:51:48 +02:00
|
|
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
2020-05-27 17:03:30 +02:00
|
|
|
|
2020-05-30 19:18:05 +02:00
|
|
|
#=================================================
|
|
|
|
# SPECIFIC UPGRADE
|
2018-05-01 22:09:53 +02:00
|
|
|
#=================================================
|
2019-10-25 11:04:41 +02:00
|
|
|
# UPGRADE THE LOUNGE
|
2018-05-01 22:09:53 +02:00
|
|
|
#=================================================
|
|
|
|
|
2024-04-07 09:46:39 +02:00
|
|
|
pushd $install_dir
|
|
|
|
ynh_use_nodejs
|
|
|
|
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install
|
|
|
|
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_ENV=production yarn build
|
|
|
|
popd
|
2018-05-01 22:09:53 +02:00
|
|
|
|
2019-10-25 11:04:41 +02:00
|
|
|
#=================================================
|
2024-04-07 09:46:39 +02:00
|
|
|
# REAPPLY SYSTEM CONFIGURATIONS
|
2019-10-25 11:04:41 +02:00
|
|
|
#=================================================
|
2024-04-07 09:46:39 +02:00
|
|
|
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
|
|
|
|
|
|
|
ynh_add_nginx_config
|
2018-05-01 22:09:53 +02:00
|
|
|
|
2022-03-27 10:59:38 +02:00
|
|
|
env_path="$PATH"
|
2020-05-27 17:03:30 +02:00
|
|
|
ynh_add_systemd_config
|
2018-05-01 12:25:53 +02:00
|
|
|
|
2020-12-14 11:14:10 +01:00
|
|
|
yunohost service add $app --description="Client Web IRC" --log="/var/log/$app/$app.log"
|
2018-05-01 12:25:53 +02:00
|
|
|
|
2019-10-25 11:04:41 +02:00
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2021-11-23 08:28:18 +01:00
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
2019-10-25 11:04:41 +02:00
|
|
|
|
2021-08-30 22:37:35 +02:00
|
|
|
ynh_systemd_action --service_name=$app --action=start --log_path=systemd
|
2019-10-25 11:04:41 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
2018-05-01 12:25:53 +02:00
|
|
|
|
2021-11-23 08:28:18 +01:00
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|