Fix dhclient in Fedora ramdisks

Copy all of the necessary parts for a Fedora based dhclient to work. This
includes a number of network scripts. Also grab the ip command supplied by
the iproute package, the busybox "ip addr" command was missing the valid_lft
and preferred_lft options.

This will allow the dhcp to work in the ramdisk instead of getting passed the
PXE net config.

Related-Bug: #1417026
Change-Id: I8feee9a740855dab7b47162c5727bf91db77fcc6
This commit is contained in:
Derek Higgins 2015-02-06 14:27:35 +00:00
parent 7b702acd9c
commit 5671a38e8e
2 changed files with 15 additions and 3 deletions

View File

@ -1,2 +1,3 @@
dhclient
ip
busybox

View File

@ -52,8 +52,18 @@ function create_ramdisk_base () {
cp -a "$LIB_UDEV/firmware" "$TMP_MOUNT_PATH/lib/udev"
fi
# cjk adding for hwdiscovery support
cp "/sbin/dhclient-script" "$TMP_MOUNT_PATH/sbin"
# cjk adding dhclient for hwdiscovery support
# dhclient scripts on some distros appear in different places, copy any we find
for FILE in /sbin/dhclient-script /usr/sbin/dhclient-script /etc/sysconfig/network-scripts/* /etc/rc.d/init.d/functions /etc/init.d/functions ; do
if [ -f $FILE ] ; then
mkdir -p $(dirname $TMP_MOUNT_PATH/$FILE)
cp $FILE $TMP_MOUNT_PATH/$FILE
fi
done
# /var/lib/dhclient is a directory on Fedora
if [ -d "/var/lib/dhclient" ] ; then
mkdir -p "$TMP_MOUNT_PATH/var/lib/dhclient"
fi
mkdir -p "$TMP_MOUNT_PATH/etc/modprobe.d"
echo "blacklist evbug" > "$TMP_MOUNT_PATH/etc/modprobe.d/blacklist.conf"
@ -143,7 +153,8 @@ function populate_lib () {
for i in "$BUSYBOX" bash lsmod modprobe udevadm \
wget reboot shutdown $UDEVD $UDEV_FIRMWARE \
$(cat /etc/dib_binary_deps) ; do
if busybox_list | grep "^$i\$" >/dev/null; then
# Don't take the ip command from busybox, its missing some features
if busybox_list | grep -v "^ip$" | grep "^$i\$" >/dev/null; then
continue
fi
path=`which $i 2>/dev/null` || path=$i