enable dhcp and add helper script for lease setup

This commit is contained in:
Trammell Hudson 2017-03-27 15:56:10 -04:00
parent 391d953623
commit f39dfd321d
Failed to extract signature
3 changed files with 49 additions and 3 deletions

View File

@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Busybox version: 1.25.0
# Mon Mar 27 14:20:49 2017
# Mon Mar 27 14:21:05 2017
#
CONFIG_HAVE_DOT_CONFIG=y
@ -909,7 +909,7 @@ CONFIG_FEATURE_UDHCPC_SANITIZEOPT=y
CONFIG_UDHCP_DEBUG=9
CONFIG_FEATURE_UDHCP_RFC3397=y
CONFIG_FEATURE_UDHCP_8021Q=y
CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script"
CONFIG_UDHCPC_DEFAULT_SCRIPT="/sbin/config-dhcp.sh"
CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80
CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS=""
# CONFIG_UDPSVD is not set

View File

@ -1,6 +1,6 @@
#!/bin/ash
# First thing it is vital to mount the /dev and other system directories
mkdir /proc /sys /dev /tmp /boot 2>&- 1>&-
mkdir /proc /sys /dev /tmp /etc /boot 2>&- 1>&-
mount -t devtmpfs none /dev
mount -t proc none /proc
mount -t sysfs none /sys

46
initrd/sbin/config-dhcp.sh Executable file
View File

@ -0,0 +1,46 @@
#!/bin/sh
# udhcpc script
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
RESOLV_CONF="/etc/resolv.conf"
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
[ -n "$subnet" ] && NETMASK="netmask $subnet"
case "$1" in
deconfig)
grep -q -v ip= /proc/cmdline
if [ $? -eq 0 ]; then
/sbin/ifconfig $interface up
fi
grep -q -v nfsroot= /proc/cmdline
if [ $? -eq 0 ]; then
/sbin/ifconfig $interface 0.0.0.0
fi
;;
renew|bound)
/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
if [ -n "$router" ] ; then
echo "deleting routers"
while route del default gw 0.0.0.0 dev $interface ; do
:
done
for i in $router ; do
route add default gw $i dev $interface
done
fi
echo -n > $RESOLV_CONF
[ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
for i in $dns ; do
echo adding dns $i
echo nameserver $i >> $RESOLV_CONF
done
;;
esac
exit 0