Update 'DynDNS/install.sh'

This commit is contained in:
Filip Znachor 2022-04-14 02:47:41 +02:00
parent 8a6853bd41
commit 27552639eb

View file

@ -1,18 +1,24 @@
# Download lua script
wget https://git.znachor.cz/znachor/OpenWrt-Tools/raw/branch/master/DynDNS/dyndns.lua -O /root/dyndns.lua
# Download scripts
mkdir /root/dyndns
wget https://git.znachor.cz/znachor/OpenWrt-Tools/raw/branch/master/DynDNS/ip.lua -O /root/dyndns/ip.lua
wget https://git.znachor.cz/znachor/OpenWrt-Tools/raw/branch/master/DynDNS/dyndns.lua -O /root/dyndns/dyndns.lua
# Download lua bit library
opkg update
opkg install luabitop
# Set local domain
domain=$(uci get dhcp.@dnsmasq[0].domain)
sed -i "s/.lan/.$domain/gi" /root/dyndns.lua
sed -i "s/.lan/.$domain/gi" /root/dyndns/dyndns.lua
# Create dhcp script
echo "lua /root/dyndns.lua" > /root/dyndns.sh
echo "cd /root/dyndns/ && lua dyndns.lua" > /root/dyndns/dyndns.sh
# Allow execution
chmod +x /root/dyndns.*
chmod +x /root/dyndns/*.*
# Add dhcpscript to the config
uci set dhcp.@dnsmasq[0].dhcpscript='/root/dyndns.sh'
uci set dhcp.@dnsmasq[0].dhcpscript='/root/dyndns/dyndns.sh'
# Add addnlist to the config
uci set dhcp.@dnsmasq[0].addnhosts='/tmp/dyndns'