OpenWrt-Tools/DynDNS/install.sh

22 lines
670 B
Bash
Raw Normal View History

2022-04-14 02:47:41 +02:00
# 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
2022-04-02 16:16:46 +02:00
# Set local domain
domain=$(uci get dhcp.@dnsmasq[0].domain)
2022-04-14 02:47:41 +02:00
sed -i "s/.lan/.$domain/gi" /root/dyndns/dyndns.lua
2022-04-02 16:16:46 +02:00
# Create dhcp script
2022-05-28 10:44:36 +02:00
echo "cd /root/dyndns/ && lua dyndns.lua" > /etc/hotplug.d/dhcp/99-dyndns
2022-04-02 16:16:46 +02:00
# Allow execution
2022-05-28 10:44:36 +02:00
chmod 755 /etc/hotplug.d/dhcp/99-dyndns
chmod +x /etc/hotplug.d/dhcp/99-dyndns
2022-04-02 16:16:46 +02:00
# Reload dnsmasq
2022-04-02 16:18:43 +02:00
/etc/init.d/dnsmasq reload