Added install.sh for DynDNS

This commit is contained in:
Filip Znachor 2022-04-02 16:16:46 +02:00
parent f1f1da4d5d
commit 58e4ac8f9c

21
DynDNS/install.sh Normal file
View file

@ -0,0 +1,21 @@
# 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
service dnsmasq reload