2018-06-20 19:16:01 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
app_instance=__APP__
|
|
|
|
|
2018-07-06 09:25:47 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
2018-06-20 19:16:01 +02:00
|
|
|
|
|
|
|
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_ip 4 "$public_ip4"
|
|
|
|
then
|
|
|
|
external_IP_line="${external_IP_line/'__IPV4__'/$public_ip4}"
|
|
|
|
else
|
|
|
|
external_IP_line="${external_IP_line/'__IPV4__,'/}"
|
|
|
|
fi
|
|
|
|
|
2018-07-05 21:46:24 +02:00
|
|
|
if [[ -n "$public_ip6" ]] && ynh_validate_ip 6 "$public_ip6"
|
2018-06-20 19:16:01 +02:00
|
|
|
then
|
|
|
|
external_IP_line="${external_IP_line/'__IPV6__'/$public_ip6}"
|
|
|
|
else
|
|
|
|
external_IP_line="${external_IP_line/',__IPV6__'/}"
|
|
|
|
fi
|
|
|
|
|
2018-07-06 09:25:47 +02:00
|
|
|
ynh_replace_string "^external-ip=.*\$" "$external_IP_line" "/etc/matrix-$app_instance/coturn.conf"
|
2018-06-20 19:16:01 +02:00
|
|
|
|
2018-07-06 09:25:47 +02:00
|
|
|
exit 0
|