From 427472e980cd6254a5e4ef37209b327e15af259b Mon Sep 17 00:00:00 2001 From: Mark Hatle Date: Thu, 3 Feb 2011 19:29:50 -0600 Subject: 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 Signed-off-by: Mark Hatle --- meta/recipes-core/busybox/files/busybox-udhcpc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 meta/recipes-core/busybox/files/busybox-udhcpc (limited to 'meta/recipes-core/busybox/files/busybox-udhcpc') 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 -- cgit v1.2.3