summaryrefslogtreecommitdiffstats
path: root/debian/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'debian/scripts')
-rw-r--r--debian/scripts/dhcp6c-ifupdown28
-rw-r--r--debian/scripts/dhcp6c-script40
2 files changed, 68 insertions, 0 deletions
diff --git a/debian/scripts/dhcp6c-ifupdown b/debian/scripts/dhcp6c-ifupdown
new file mode 100644
index 0000000..1a9bfab
--- /dev/null
+++ b/debian/scripts/dhcp6c-ifupdown
@@ -0,0 +1,28 @@
+#!/bin/sh
+# Updates information whenever a network interface is brought up.
+
+[ "$IFACE" = "lo" ] && exit 0
+[ -r /etc/default/wide-dhcpv6-client ] || exit 0
+[ -x /usr/sbin/dhcp6ctl ] || exit 0
+
+# Check if dhcp6c is running
+pidof dhcp6c > /dev/null 2>&1 ; [ $? -eq 1 ] && exit 0
+
+. /etc/default/wide-dhcpv6-client
+
+case $MODE in
+ start|stop)
+ for i in $INTERFACES ; do
+ if [ "$IFACE" = "$i" ] ; then
+ /usr/sbin/dhcp6ctl $MODE interface $IFACE
+ exit 0
+ fi
+ done
+ ;;
+ *)
+ if [ "$VERBOSITY" = "1" ] ; then
+ echo "dhcp6c-ifupdown: unknown mode \"$MODE\""
+ fi
+ exit 1
+ ;;
+esac
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