1
0
This repository has been archived on 2025-06-16. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
openwrt_archive/ipv6/wide-dhcpv6/files/dhcp6c-dnsmasq.hotplug
Jo-Philipp Wich f02aee2e83 [packages] /etc/functions.sh => /lib/functions.sh
SVN-Revision: 32061
2012-06-05 15:54:57 +00:00

54 lines
847 B
Bash

#!/bin/sh
. /lib/functions.sh
getoption() {
local cfg=$1
config_get resolvfile "$cfg" resolvfile
}
config_load dhcp6c
local dns
config_get dns basic dns none
[ $dns != "dnsmasq" ] && return 0
if [ "$ACTION" = "start" ]; then
local domain_name_servers
config_get domain_name_servers state domain_name_servers
if [ -n "$domain_name_servers" ]; then
config_load dhcp
local resolvfile
config_foreach getoption dnsmasq
if [ -n "$resolvfile" ]; then
cp -pf $resolvfile "$resolvfile.dhcp6c_backup"
for nameserver in $domain_name_servers; do
echo nameserver $nameserver >> $resolvfile
done
fi
fi
fi
if [ "$ACTION" = "stop" ]; then
config_load dhcp
local resolvfile
config_foreach getoption dnsmasq
if [ -f "$resolvfile.dhcp6c_backup" ]; then
mv -f "$resolvfile.dhcp6c_backup" $resolvfile
fi
fi