mirror of
https://github.com/YunoHost-Apps/jitsi_ynh.git
synced 2024-09-03 19:35:57 +02:00
136 lines
5.7 KiB
Bash
136 lines
5.7 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# STANDARD UPGRADE STEPS
|
|
#=================================================
|
|
# STOP SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
|
|
|
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"
|
|
|
|
#=================================================
|
|
# ENSURE DOWNWARD COMPATIBILITY
|
|
#=================================================
|
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
|
|
|
# If max_memory doesn't exist, create it and set to default 75 mb value
|
|
if [ -z "$max_memory" ]; then
|
|
max_memory=200
|
|
ynh_app_setting_set --app="$app" --key=max_memory --value="$max_memory"
|
|
fi
|
|
|
|
gpasswd --add prosody "$app"
|
|
gpasswd --add www-data "$app"
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression --message="Upgrading source files..." --weight=1
|
|
|
|
_setup_sources
|
|
|
|
chmod 750 "$install_dir"
|
|
chmod -R o-rwx "$install_dir"
|
|
chown -R "$app:$app" "$install_dir"
|
|
|
|
#=================================================
|
|
# REPLACE JNIWRAPPER FOR ARMHF ARCHITECTURE IN JITSI-VIDEOBRIDGE
|
|
#=================================================
|
|
|
|
if [ "$YNH_ARCH" == "armhf" ]; then
|
|
ynh_script_progression --message="Configuring jniwrapper for armhf ..." --weight=1
|
|
ynh_jniwrapper_armhf
|
|
fi
|
|
|
|
#=================================================
|
|
# CONFIGURE PROSODY
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring Prosody..." --weight=1
|
|
|
|
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"
|
|
|
|
#=================================================
|
|
# CONFIGURE JITSI-VIDEOBRIDGE
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring Jitsi-Videobridge..." --weight=1
|
|
|
|
public_ipv4="$(curl ip.yunohost.org)" || true
|
|
private_ipv4="$(ip route get 1 | sed -n 's/^.*src \([0-9.]*\) .*$/\1/p')" || true
|
|
|
|
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"
|
|
|
|
#=================================================
|
|
# CONFIGURE JITSI-JICOFO
|
|
#=================================================
|
|
ynh_script_progression --message="configuring Jitsi-Jicofo..." --weight=1
|
|
|
|
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"
|
|
|
|
#=================================================
|
|
# CONFIGURE JITSI-MEET
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring Jitsi-Meet..." --weight=1
|
|
|
|
ynh_add_config --template="../conf/jitsi-meet-config.js" --destination="/etc/$app/meet/$domain-config.js"
|
|
chmod 644 "/etc/$app/meet/$domain-config.js"
|
|
|
|
#=================================================
|
|
# SECURE FILES AND DIRECTORIES
|
|
#=================================================
|
|
ynh_script_progression --message="Securing files and directories..." --weight=1
|
|
|
|
# Set permissions on app files
|
|
chown -R "$app:" "/etc/$app"
|
|
|
|
#=================================================
|
|
# REAPPLY SYSTEM CONFIGURATIONS
|
|
#=================================================
|
|
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
|
|
|
# Create a dedicated NGINX config
|
|
ynh_add_nginx_config
|
|
|
|
# Create a dedicated systemd config
|
|
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"
|
|
|
|
ynh_add_systemd_config --service="$app-jicofo" --template="jitsi-jicofo.service"
|
|
yunohost service add "$app-jicofo" --log "/var/log/$app/$app-jicofo.log"
|
|
|
|
# Use logrotate to manage app-specific logfile(s)
|
|
ynh_use_logrotate --non-append
|
|
|
|
chown -R "$app:" "/var/log/$app"
|
|
chmod -R 770 "/var/log/$app"
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|
|
|
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"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|