2014-08-27 23:42:00 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-10-11 15:21:19 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
2024-02-05 15:30:16 +01:00
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
2020-10-11 15:21:19 +02:00
|
|
|
#=================================================
|
2024-02-05 15:30:16 +01:00
|
|
|
ynh_script_progression --message="Setting up source files..." --weight=2
|
2020-10-11 15:21:19 +02:00
|
|
|
|
2024-02-05 15:30:16 +01:00
|
|
|
ynh_setup_source --source_id="main" --dest_dir="$install_dir" --full_replace=1 --keep="config.conf www/static/client.json"
|
2020-10-11 15:21:19 +02:00
|
|
|
|
2024-02-05 15:30:16 +01:00
|
|
|
ynh_add_config --template="config.conf" --destination="$install_dir/config.conf"
|
|
|
|
chmod 400 "$install_dir/config.conf"
|
2020-10-11 15:21:19 +02:00
|
|
|
|
2024-02-05 15:30:16 +01:00
|
|
|
ynh_add_config --template="client.json" --destination="$install_dir/www/static/client.json"
|
|
|
|
chmod 400 "$install_dir/www/static/client.json"
|
2020-10-11 15:21:19 +02:00
|
|
|
|
2024-02-05 15:30:16 +01:00
|
|
|
chmod 750 "$install_dir"
|
|
|
|
chown -R "$app:www-data" "$install_dir"
|
2020-10-11 15:21:19 +02:00
|
|
|
|
|
|
|
#=================================================
|
2024-02-05 15:30:16 +01:00
|
|
|
# REAPPLY SYSTEM CONFIGURATIONS
|
2020-10-11 15:21:19 +02:00
|
|
|
#=================================================
|
2024-02-05 15:30:16 +01:00
|
|
|
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
2020-10-11 15:21:19 +02:00
|
|
|
|
|
|
|
# Create a dedicated NGINX config
|
|
|
|
ynh_add_nginx_config
|
|
|
|
|
2024-02-05 15:30:16 +01:00
|
|
|
ynh_add_systemd_config
|
2024-02-05 15:39:09 +01:00
|
|
|
yunohost service add "$app" --description="Versatile web based messenger using IRC" --log="/var/log/$app/$app.log"
|
|
|
|
|
|
|
|
# Use logrotate to manage application logfile(s)
|
|
|
|
ynh_use_logrotate
|
2021-07-09 07:45:12 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|
|
|
|
|
|
|
# Start a systemd service
|
2024-02-05 15:30:16 +01:00
|
|
|
ynh_systemd_action --service_name="$app" --action="restart" --log_path="systemd"
|
2020-10-11 15:21:19 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
2014-09-19 19:01:04 +02:00
|
|
|
|
2021-09-24 07:43:11 +02:00
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|