regenconf: add a timeout to curl inside dnsmasq regenconf to prevent being stuck too long when no network on the machine

This commit is contained in:
Alexandre Aubin 2022-09-01 19:16:37 +02:00
parent e1cbe21cd1
commit b77e811402

View file

@ -21,9 +21,9 @@ do_pre_regen() {
cat plain/resolv.dnsmasq.conf | grep "^nameserver" | shuf >${pending_dir}/etc/resolv.dnsmasq.conf
# retrieve variables
ipv4=$(curl -s -4 https://ip.yunohost.org 2>/dev/null || true)
ipv4=$(curl --max-time 10 -s -4 https://ip.yunohost.org 2>/dev/null || true)
ynh_validate_ip4 "$ipv4" || ipv4='127.0.0.1'
ipv6=$(curl -s -6 https://ip6.yunohost.org 2>/dev/null || true)
ipv6=$(curl --max-time 10 -s -6 https://ip6.yunohost.org 2>/dev/null || true)
ynh_validate_ip6 "$ipv6" || ipv6=''
interfaces="$(ip -j addr show | jq -r '[.[].ifname]|join(" ")')"
wireless_interfaces="lo"