summaryrefslogtreecommitdiffstats
path: root/debian/scripts/dhcp6c-script
diff options
context:
space:
mode:
Diffstat (limited to 'debian/scripts/dhcp6c-script')
-rw-r--r--debian/scripts/dhcp6c-script40
1 files changed, 40 insertions, 0 deletions
diff --git a/debian/scripts/dhcp6c-script b/debian/scripts/dhcp6c-script
new file mode 100644
index 0000000..e6168f4
--- /dev/null
+++ b/debian/scripts/dhcp6c-script
@@ -0,0 +1,40 @@
+#!/bin/sh
+# dhcp6c-script for Debian/Ubuntu. Jérémie Corbier, April, 2006.
+# resolvconf support by Mattias Guns, May 2006.
+
+RESOLVCONF="/sbin/resolvconf"
+
+[ -f /etc/default/wide-dhcpv6-client ] && . /etc/default/wide-dhcpv6-client
+
+if [ -n "$new_domain_name" -o -n "$new_domain_name_servers" ]; then
+ old_resolv_conf=/etc/resolv.conf
+ new_resolv_conf=/etc/resolv.conf.dhcp6c-new
+ rm -f $new_resolv_conf
+ if [ -n "$new_domain_name" ]; then
+ echo search $new_domain_name >> $new_resolv_conf
+ fi
+ if [ -n "$new_domain_name_servers" ]; then
+ for nameserver in $new_domain_name_servers; do
+ # No need to add an already existing nameserver
+ res=$(grep "nameserver $nameserver" $old_resolv_conf)
+ if [ -z "$res" ]; then
+ echo nameserver $nameserver >> $new_resolv_conf
+ fi
+ done
+ fi
+
+ # Use resolvconf if available
+ if [ -h "$old_resolv_conf" -a -x "$RESOLVCONF" ]; then
+ for IFACE in $INTERFACES; do
+ cat $new_resolv_conf | $RESOLVCONF -a $IFACE
+ done
+ else
+ # To preserve IPv4 informations...
+ cat $old_resolv_conf >> $new_resolv_conf
+ chown --reference=$old_resolv_conf $new_resolv_conf
+ chmod --reference=$old_resolv_conf $new_resolv_conf
+ mv -f $new_resolv_conf $old_resolv_conf
+ fi
+fi
+
+exit 0