#/bin/sh -x

#rm /etc/.bootstrapped

uci del_list network.lan.dns='8.8.8.8'
uci commit network

uci set dhcp.@domain[-1].name="flaps.vendotek.eu"
uci show|grep domain
uci set dhcp.@domain[-1].ip="78.47.130.116"
uci show|grep domain
uci commit dhcp


sed -i -e s:"PING_INTERVAL=600":"PING_INTERVAL=900":g /etc/init.d/heartbeat2

[ -f "/etc/init.d/heartbeat2" ] && exit 0

echo "NEW CHANGES"
wget -4 -O /tmp/heartbeat2 '--timeout=10' --quiet --no-check-certificate https://openwrt.vendotek.eu/files/heartbeat2

if [ -f "/tmp/heartbeat2" -a -s "/tmp/heartbeat2" ] ; then
    mv /tmp/heartbeat2 /etc/init.d/heartbeat2
    chmod 755 /etc/init.d/heartbeat2
    chown root:root /etc/init.d/heartbeat2
    /etc/init.d/heartbeat stop
    /etc/init.d/heartbeat disable
    /etc/init.d/heartbeat2 enable
    /etc/init.d/heartbeat2 start
fi

exit 0
