21 lines
555 B
Bash
21 lines
555 B
Bash
# Download lua script
|
|
wget https://git.znachor.cz/znachor/OpenWrt-Tools/raw/branch/master/DynDNS/dyndns.lua -O /root/dyndns.lua
|
|
|
|
# Set local domain
|
|
domain=$(uci get dhcp.@dnsmasq[0].domain)
|
|
sed -i "s/.lan/.$domain/gi" /root/dyndns.lua
|
|
|
|
# Create dhcp script
|
|
echo "lua /root/dyndns.lua" > /root/dyndns.sh
|
|
|
|
# Allow execution
|
|
chmod +x /root/dyndns.*
|
|
|
|
# Add dhcpscript to the config
|
|
uci set dhcp.@dnsmasq[0].dhcpscript='/root/dyndns.sh'
|
|
|
|
# Add addnlist to the config
|
|
uci set dhcp.@dnsmasq[0].addnhosts='/tmp/dyndns'
|
|
|
|
# Reload dnsmasq
|
|
/etc/init.d/dnsmasq reload |