2019-06-06 06:04:22 +02:00
|
|
|
#!/bin/bash
|
2015-01-14 10:55:14 +01:00
|
|
|
|
2019-06-06 06:04:22 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2015-01-14 10:55:14 +01:00
|
|
|
|
2019-06-06 06:04:22 +02:00
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
2015-01-14 10:55:14 +01:00
|
|
|
|
2019-06-06 06:04:22 +02:00
|
|
|
#=================================================
|
|
|
|
# STANDARD UPGRADE STEPS
|
|
|
|
#=================================================
|
|
|
|
# STOP SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2022-10-14 03:49:09 +02:00
|
|
|
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
2019-06-06 06:04:22 +02:00
|
|
|
|
2024-01-18 16:39:14 +01:00
|
|
|
ynh_systemd_action --service_name="$app-videobridge" --action="stop" --log_path="/var/log/$app/$app-videobridge.log"
|
|
|
|
ynh_systemd_action --service_name="$app-jicofo" --action="stop" --log_path="/var/log/$app/$app-jicofo.log"
|
2019-06-06 06:04:22 +02:00
|
|
|
|
2022-02-03 03:00:20 +01:00
|
|
|
#=================================================
|
|
|
|
# ENSURE DOWNWARD COMPATIBILITY
|
|
|
|
#=================================================
|
2022-10-14 03:49:09 +02:00
|
|
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
2022-02-03 03:00:20 +01:00
|
|
|
|
2022-04-06 08:28:14 +02:00
|
|
|
# If max_memory doesn't exist, create it and set to default 75 mb value
|
|
|
|
if [ -z "$max_memory" ]; then
|
2024-01-18 16:39:14 +01:00
|
|
|
max_memory=200
|
|
|
|
ynh_app_setting_set --app="$app" --key=max_memory --value="$max_memory"
|
2022-04-06 08:28:14 +02:00
|
|
|
fi
|
|
|
|
|
2024-01-18 16:39:14 +01:00
|
|
|
gpasswd --add prosody "$app"
|
|
|
|
gpasswd --add www-data "$app"
|
2022-02-03 03:00:20 +01:00
|
|
|
|
2019-06-06 06:04:22 +02:00
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
2024-01-18 16:39:14 +01:00
|
|
|
ynh_script_progression --message="Upgrading source files..." --weight=1
|
2019-06-06 06:04:22 +02:00
|
|
|
|
2024-01-18 16:39:14 +01:00
|
|
|
_setup_sources
|
2019-06-06 06:04:22 +02:00
|
|
|
|
2024-01-09 19:10:09 +01:00
|
|
|
chmod 750 "$install_dir"
|
|
|
|
chmod -R o-rwx "$install_dir"
|
2024-01-18 16:39:14 +01:00
|
|
|
chown -R "$app:$app" "$install_dir"
|
2022-02-08 22:42:11 +01:00
|
|
|
|
2019-06-06 06:04:22 +02:00
|
|
|
#=================================================
|
2024-01-18 16:39:14 +01:00
|
|
|
# REPLACE JNIWRAPPER FOR ARMHF ARCHITECTURE IN JITSI-VIDEOBRIDGE
|
2019-06-06 06:04:22 +02:00
|
|
|
#=================================================
|
|
|
|
|
2024-01-18 16:39:14 +01:00
|
|
|
if [ "$YNH_ARCH" == "armhf" ]; then
|
|
|
|
ynh_script_progression --message="Configuring jniwrapper for armhf ..." --weight=1
|
|
|
|
ynh_jniwrapper_armhf
|
2022-04-15 00:28:49 +02:00
|
|
|
fi
|
|
|
|
|
2022-02-06 17:19:59 +01:00
|
|
|
#=================================================
|
|
|
|
# CONFIGURE PROSODY
|
|
|
|
#=================================================
|
2022-10-14 03:49:09 +02:00
|
|
|
ynh_script_progression --message="Configuring Prosody..." --weight=1
|
2022-02-06 17:19:59 +01:00
|
|
|
|
2024-01-18 16:39:14 +01:00
|
|
|
ynh_add_config --template="../conf/prosody.cfg.lua" --destination="/etc/prosody/conf.avail/$domain.cfg.lua"
|
|
|
|
chmod 644 "/etc/prosody/conf.avail/$domain.cfg.lua"
|
2022-02-06 17:19:59 +01:00
|
|
|
|
2019-06-06 06:04:22 +02:00
|
|
|
#=================================================
|
2020-04-11 21:55:05 +02:00
|
|
|
# CONFIGURE JITSI-VIDEOBRIDGE
|
2019-06-06 06:04:22 +02:00
|
|
|
#=================================================
|
2022-10-14 03:49:09 +02:00
|
|
|
ynh_script_progression --message="Configuring Jitsi-Videobridge..." --weight=1
|
2019-06-06 06:04:22 +02:00
|
|
|
|
2024-01-18 20:07:19 +01:00
|
|
|
public_ipv4="$(curl --no-progress-meter ip.yunohost.org)" || true
|
2024-01-18 16:39:14 +01:00
|
|
|
private_ipv4="$(ip route get 1 | sed -n 's/^.*src \([0-9.]*\) .*$/\1/p')" || true
|
2022-04-15 14:41:11 +02:00
|
|
|
|
2024-01-18 16:39:14 +01:00
|
|
|
ynh_add_config --template="../conf/jitsi-videobridge-callstats-java-sdk.properties" --destination="/etc/$app/videobridge/callstats-java-sdk.properties"
|
|
|
|
ynh_add_config --template="../conf/jitsi-videobridge-jvb.conf" --destination="/etc/$app/videobridge/jvb.conf"
|
|
|
|
ynh_add_config --template="../conf/jitsi-videobridge-logging.properties" --destination="/etc/$app/videobridge/logging.properties"
|
|
|
|
ynh_add_config --template="../conf/jitsi-videobridge-sip-communicator.properties" --destination="/etc/$app/videobridge/sip-communicator.properties"
|
|
|
|
ynh_add_config --template="../conf/jitsi-videobridge.config" --destination="/etc/$app/videobridge/config"
|
2022-04-15 14:41:11 +02:00
|
|
|
|
2019-06-06 06:04:22 +02:00
|
|
|
#=================================================
|
2020-04-11 21:55:05 +02:00
|
|
|
# CONFIGURE JITSI-JICOFO
|
2019-06-06 06:04:22 +02:00
|
|
|
#=================================================
|
2022-10-14 03:49:09 +02:00
|
|
|
ynh_script_progression --message="configuring Jitsi-Jicofo..." --weight=1
|
2019-07-14 01:17:46 +02:00
|
|
|
|
2024-01-18 16:39:14 +01:00
|
|
|
ynh_add_config --template="../conf/jitsi-jicofo-config" --destination="/etc/$app/jicofo/config"
|
|
|
|
ynh_add_config --template="../conf/jitsi-jicofo-jicofo.conf" --destination="/etc/$app/jicofo/jicofo.conf"
|
|
|
|
ynh_add_config --template="../conf/jitsi-jicofo-logging.properties" --destination="/etc/$app/jicofo/logging.properties"
|
2019-06-06 06:04:22 +02:00
|
|
|
|
|
|
|
#=================================================
|
2020-04-11 21:55:05 +02:00
|
|
|
# CONFIGURE JITSI-MEET
|
2019-06-06 06:04:22 +02:00
|
|
|
#=================================================
|
2022-10-14 03:49:09 +02:00
|
|
|
ynh_script_progression --message="Configuring Jitsi-Meet..." --weight=1
|
2019-06-06 06:04:22 +02:00
|
|
|
|
2024-01-18 16:39:14 +01:00
|
|
|
ynh_add_config --template="../conf/jitsi-meet-config.js" --destination="/etc/$app/meet/$domain-config.js"
|
|
|
|
chmod 644 "/etc/$app/meet/$domain-config.js"
|
2022-02-09 22:41:48 +01:00
|
|
|
|
2022-06-09 01:19:53 +02:00
|
|
|
#=================================================
|
|
|
|
# SECURE FILES AND DIRECTORIES
|
|
|
|
#=================================================
|
2022-10-14 03:49:09 +02:00
|
|
|
ynh_script_progression --message="Securing files and directories..." --weight=1
|
2022-06-09 01:19:53 +02:00
|
|
|
|
|
|
|
# Set permissions on app files
|
2024-01-18 16:39:14 +01:00
|
|
|
chown -R "$app:" "/etc/$app"
|
2022-06-09 01:19:53 +02:00
|
|
|
|
2019-06-06 06:04:22 +02:00
|
|
|
#=================================================
|
2024-01-18 16:39:14 +01:00
|
|
|
# REAPPLY SYSTEM CONFIGURATIONS
|
2019-06-06 06:04:22 +02:00
|
|
|
#=================================================
|
2024-01-18 16:39:14 +01:00
|
|
|
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
|
|
|
|
|
|
|
# Create a dedicated NGINX config
|
|
|
|
ynh_add_nginx_config
|
2019-06-06 06:04:22 +02:00
|
|
|
|
|
|
|
# Create a dedicated systemd config
|
2024-01-18 16:39:14 +01:00
|
|
|
ynh_add_systemd_config --service="$app-videobridge" --template="jitsi-videobridge.service"
|
|
|
|
yunohost service add "$app-videobridge" --log "/var/log/$app/$app-videobridge.log" --needs_exposed_ports "$port" "$port_videobridge"
|
2019-06-06 06:04:22 +02:00
|
|
|
|
2024-01-18 16:39:14 +01:00
|
|
|
ynh_add_systemd_config --service="$app-jicofo" --template="jitsi-jicofo.service"
|
|
|
|
yunohost service add "$app-jicofo" --log "/var/log/$app/$app-jicofo.log"
|
2019-06-06 06:04:22 +02:00
|
|
|
|
2020-06-18 02:03:31 +02:00
|
|
|
# Use logrotate to manage app-specific logfile(s)
|
|
|
|
ynh_use_logrotate --non-append
|
|
|
|
|
2024-01-18 16:39:14 +01:00
|
|
|
chown -R "$app:" "/var/log/$app"
|
|
|
|
chmod -R 770 "/var/log/$app"
|
2019-06-06 06:04:22 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2022-10-14 03:49:09 +02:00
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
2019-06-06 06:04:22 +02:00
|
|
|
|
2024-01-18 16:39:14 +01:00
|
|
|
ynh_systemd_action --service_name="$app-jicofo" --action="start" --log_path="/var/log/$app/$app-jicofo.log"
|
|
|
|
ynh_systemd_action --service_name="$app-videobridge" --action="start" --log_path="/var/log/$app/$app-videobridge.log"
|
2019-06-06 06:04:22 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2022-10-14 03:49:09 +02:00
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|