1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/coturn_ynh.git synced 2024-09-03 18:16:32 +02:00

Merge pull request #3 from YunoHost-Apps/testing

Testing
This commit is contained in:
Éric Gaspar 2021-01-26 11:47:12 +01:00 committed by GitHub
commit a90602f31e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 28 deletions

View file

@ -3,8 +3,8 @@
"id": "coturn",
"packaging_format": 1,
"description": {
"en": "Videoconferencing server that is easy to deploy",
"fr": "Serveur de visioconférence facile à déployer"
"en": "VoIP media traffic NAT traversal server and gateway",
"fr": "Serveur et passerelle NAT du trafic média VoIP"
},
"version": "4.5.1.1~ynh1",
"url": "https://github.com/coturn/coturn",

View file

@ -133,14 +133,19 @@ ynh_print_ON
public_ip4="$(curl ip.yunohost.org)" || true
public_ip6="$(curl ipv6.yunohost.org)" || true
if [ -n "$public_ip4" ] && ynh_validate_ip4 --ip_address="$public_ip4"
then
echo "external-ip=$public_ip4" >> "$coturn_config_path"
fi
# if [ -n "$public_ip4" ] && ynh_validate_ip4 --ip_address="$public_ip4"
# then
# echo "external-ip=$public_ip4" >> "$coturn_config_path"
# fi
if [ -n "$public_ip6" ] && ynh_validate_ip6 --ip_address="$public_ip6"
# if [ -n "$public_ip6" ] && ynh_validate_ip6 --ip_address="$public_ip6"
# then
# echo "external-ip=$public_ip6" >> "$coturn_config_path"
# fi
if ( [[ -n "$public_ip4" ]] && ynh_validate_ip4 --ip_address="$public_ip4" || [[ -n "$public_ip6" ]] && ynh_validate_ip6 --ip_address="$public_ip6" )
then
echo "external-ip=$public_ip6" >> "$coturn_config_path"
echo "external-ip=${public_ip4}/${public_ip6}" >> "$coturn_config_path"
fi
ynh_store_file_checksum --file="$coturn_config_path"
@ -154,6 +159,7 @@ ynh_store_file_checksum --file="$coturn_config_path"
data_path="/home/yunohost.app/$app"
mkdir -p $data_path
cp -f ../sources/Coturn_config_rotate.sh $data_path/
ynh_replace_string --match_string="__APP__" --replace_string=$app --target_file=$data_path/Coturn_config_rotate.sh
chmod +x $data_path/Coturn_config_rotate.sh
#=================================================
@ -179,6 +185,7 @@ ynh_use_logrotate --logfile "/var/log/$app"
# Set permissions to app files
chown root: -R $data_path
chown -R turnserver:root /var/log/$app
chown turnserver:root /etc/turnserver.conf
setfacl -R -m user:turnserver:rwX /var/log/$app
#=================================================

View file

@ -75,31 +75,31 @@ ynh_secure_remove --file="/home/yunohost.app/$app"
#=================================================
# REMOVE CRON JOB
#=================================================
# Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app"
ynh_secure_remove --file=/etc/cron.d/$app
# Remove the log files
ynh_secure_remove --file="/var/log/$app/"
ynh_secure_remove --file=/var/log/$app
# Remove the sqlitedb file
ynh_secure_remove --file="/var/lib/turn/"
#ynh_secure_remove --file=/var/lib/turn
#=================================================
# CLOSE A PORT
# CLOSE PORTS
#=================================================
closeport() {
local port=$1
if yunohost firewall list | grep -q "\- $turnserver_tls_port$"
then
ynh_script_progression --message="Closing port $turnserver_tls_port port"
ynh_exec_warn_less yunohost firewall disallow Both $turnserver_tls_port
elif yunohost firewall list | grep -q "\- $turnserver_alt_tls_port$"
then
ynh_script_progression --message="Closing port $turnserver_alt_tls_port port"
ynh_exec_warn_less yunohost firewall disallow Both $turnserver_alt_tls_port
fi
}
if yunohost firewall list | grep -q "\- $turnserver_tls_port$"
then
ynh_script_progression --message="Closing port $turnserver_tls_port..." --weight=1
ynh_exec_warn_less yunohost firewall disallow Both $turnserver_tls_port
fi
if yunohost firewall list | grep -q "\- $turnserver_alt_tls_port$"
then
ynh_script_progression --message="Closing port $turnserver_alt_tls_port..." --weight=1
ynh_exec_warn_less yunohost firewall disallow Both $turnserver_alt_tls_port
fi
#=================================================
# GENERIC FINALIZATION
@ -109,6 +109,7 @@ closeport() {
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user
deluser turnserver ssl-cert
ynh_system_user_delete --username=turnserver
#=================================================

View file

@ -2,19 +2,25 @@
source /usr/share/yunohost/helpers
external_IP_line="external-ip=__IPV4__,__IPV6__"
coturn_config_path="/etc/turnserver.conf"
external_IP_line="external-ip=__IPV4__/__IPV6__"
public_ip4="$(curl ip.yunohost.org)" || true
public_ip6="$(curl ipv6.yunohost.org)" || true
if [ -n "$public_ip4" ] && ynh_validate_ip4 --ip_address="$public_ip4"
then
echo "external-ip=$public_ip4" >> "$coturn_config_path"
external_IP_line="${external_IP_line/'__IPV4__'/$public_ip4}"
else
external_IP_line="${external_IP_line/'__IPV4__/'/}"
fi
if [ -n "$public_ip6" ] && ynh_validate_ip6 --ip_address="$public_ip6"
then
echo "external-ip=$public_ip6" >> "$coturn_config_path"
external_IP_line="${external_IP_line/'__IPV6__'/$public_ip6}"
else
external_IP_line="${external_IP_line/'/__IPV6__'/}"
fi
old_config_line=$(egrep "^external-ip=.*\$" "/etc/turnserver.conf")
@ -25,7 +31,7 @@ new_config_line=$(egrep "^external-ip=.*\$" "/etc/turnserver.conf")
if [ "$old_config_line" != "$new_config_line" ]
then
systemctl restart $app.service
systemctl restart __APP__.service
fi
exit 0