summaryrefslogtreecommitdiffstats
path: root/initramfs/eglibc-rootfs/etc/udhcpc.default.script
diff options
context:
space:
mode:
Diffstat (limited to 'initramfs/eglibc-rootfs/etc/udhcpc.default.script')
-rwxr-xr-xinitramfs/eglibc-rootfs/etc/udhcpc.default.script50
1 files changed, 50 insertions, 0 deletions
diff --git a/initramfs/eglibc-rootfs/etc/udhcpc.default.script b/initramfs/eglibc-rootfs/etc/udhcpc.default.script
new file mode 100755
index 0000000..5afaa7a
--- /dev/null
+++ b/initramfs/eglibc-rootfs/etc/udhcpc.default.script
@@ -0,0 +1,50 @@
+#!/bin/sh
+# Busybox udhcpc dispatcher script. Copyright (C) 2009 by Axel Beckert.
+#
+# Based on the busybox example scripts and the old udhcp source
+# package default.* scripts.
+
+RESOLV_CONF="/etc/resolv.conf"
+
+case $1 in
+ bound|renew)
+ [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
+ [ -n "$subnet" ] && NETMASK="netmask $subnet"
+
+ ip addr add $ip/$(ipcalc -s -p $ip $subnet|sed s/.*=//) dev $interface
+ ip route add default via $router
+
+ # Update resolver configuration file
+ R=""
+ [ -n "$domain" ] && R="domain $domain
+"
+ for i in $dns; do
+ echo "$0: Adding DNS $i"
+ R="${R}nameserver $i
+"
+ done
+
+ if [ -x /sbin/resolvconf ]; then
+ echo -n "$R" | resolvconf -a "${interface}.udhcpc"
+ else
+ echo -n "$R" > "$RESOLV_CONF"
+ fi
+ ;;
+
+ deconfig)
+
+ ;;
+
+ leasefail)
+ echo "$0: Lease failed: $message"
+ ;;
+
+ nak)
+ echo "$0: Received a NAK: $message"
+ ;;
+
+ *)
+ echo "$0: Unknown udhcpc command: $1";
+ exit 1;
+ ;;
+esac