aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/busybox/files
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2011-02-03 19:29:50 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-07 16:52:41 +0000
commit427472e980cd6254a5e4ef37209b327e15af259b (patch)
tree3e49401693b1b6b0334cd69e90cb763d5bbd660b /meta/recipes-core/busybox/files
parent5ade6c7de84893b4f94f7c068d775beeaecb9f5f (diff)
downloadopenembedded-core-contrib-427472e980cd6254a5e4ef37209b327e15af259b.tar.gz
busybox: Support DHCP refresh without restarting the interface
When the kernel is started using ip=dhcp, we want a way to be able to run the udhcp client within busybox and not reset the interface. When using the '-D' option to udhcpc, the defconfig script will be skipped allowing the refresh without changing the network settings. Also provide an initscript that can be used to detect ip=dhcp on the kernel command line, if detected it will refresh the lease and set the proper resolve.conf and related files, but not reset the interface. Original code in Wind River Linux by Greg Moffatt <greg.moffat@windriver.com> Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Diffstat (limited to 'meta/recipes-core/busybox/files')
-rwxr-xr-xmeta/recipes-core/busybox/files/busybox-udhcpc25
1 files changed, 25 insertions, 0 deletions
diff --git a/meta/recipes-core/busybox/files/busybox-udhcpc b/meta/recipes-core/busybox/files/busybox-udhcpc
new file mode 100755
index 0000000000..2c43f8da2e
--- /dev/null
+++ b/meta/recipes-core/busybox/files/busybox-udhcpc
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# (c) 2010-2011 Wind River Systems, Inc.
+#
+# Busybox udhcpc init script
+#
+# script to start the udpchc DHCP client on boots where
+# the parameter 'ip=dhcp' was included in the kernel parameters
+
+# ensure the required binaries are present
+[ -x /sbin/udhcpc ] || exit 1
+[ -x /bin/grep ] || exit 1
+[ -x /bin/mount ] || exit 1
+
+# ensure /proc is mounted
+if ! mount | grep -q "/proc "; then
+ exit 2
+fi
+
+rc=0
+if grep -q -E "\bip=dhcp\b" /proc/cmdline; then
+ /sbin/udhcpc -D -s /usr/share/udhcpc/default.script
+ rc=$?
+fi
+exit $rc