OpenWrt-Tools/DynDNS/install.sh

22 lines
670 B
Bash

# 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/dyndns.lua
# Create dhcp script
echo "cd /root/dyndns/ && lua dyndns.lua" > /etc/hotplug.d/dhcp/99-dyndns
# Allow execution
chmod 755 /etc/hotplug.d/dhcp/99-dyndns
chmod +x /etc/hotplug.d/dhcp/99-dyndns
# Reload dnsmasq
/etc/init.d/dnsmasq reload