summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2004-10-07 05:44:54 +0000
committerMike Frysinger <vapier@gentoo.org>2004-10-07 05:44:54 +0000
commita3428dfb43f37816240abea1c95deee4e3254a92 (patch)
tree98cc803af26174c649157e2ca851db4c9cfc53b1 /src/netboot-base
parentNew version - automated copy from gentoo/misc/herds.xml (diff)
downloadgentoo-a3428dfb43f37816240abea1c95deee4e3254a92.tar.gz
gentoo-a3428dfb43f37816240abea1c95deee4e3254a92.tar.bz2
gentoo-a3428dfb43f37816240abea1c95deee4e3254a92.zip
udhcp script for busybox
Diffstat (limited to 'src/netboot-base')
-rw-r--r--src/netboot-base/lib/udhcpc.script32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/netboot-base/lib/udhcpc.script b/src/netboot-base/lib/udhcpc.script
new file mode 100644
index 0000000000..2d77f81bf8
--- /dev/null
+++ b/src/netboot-base/lib/udhcpc.script
@@ -0,0 +1,32 @@
+#!/bin/sh
+# $Header: /var/cvsroot/gentoo/src/netboot-base/lib/udhcpc.script,v 1.1 2004/10/07 05:44:54 vapier Exp $
+# Stripped down udhcpc script
+
+deconfig() {
+ ifconfig $interface 0.0.0.0
+}
+
+bound() {
+ ifconfig $interface $ip netmask $subnet
+ [ -n "$router" ] && route add default gw $router
+ rm /etc/resolv.conf >/dev/null 2>&1
+ for ns in $dns; do echo "nameserver $ns" >> /etc/resolv.conf; done
+ [ -n "$domain" ] && echo "search $domain" >> /etc/resolv.conf
+}
+
+renew() {
+ route del default > /dev/null 2>&1
+ ifconfig $interface $ip netmask $subnet
+ [ -n "$router" ] && route add default gw $router
+}
+
+leasefail() {
+ ifconfig $interface down
+}
+
+case $1 in
+ deconfig) deconfig;;
+ bound) bound;;
+ renew) renew;;
+ leasefail) leasefail;;
+esac