aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-core-ivi/busybox/files/busybox-udhcpc
blob: 28ef9e1e9f3139224eda783240d7ba87fc38e43e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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