From 5671a38e8ed211034bb613d2b5c2fef6a49242f1 Mon Sep 17 00:00:00 2001 From: Derek Higgins Date: Fri, 6 Feb 2015 14:27:35 +0000 Subject: [PATCH] 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 --- elements/ramdisk/binary-deps.d/ramdisk | 1 + lib/ramdisk-functions | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/elements/ramdisk/binary-deps.d/ramdisk b/elements/ramdisk/binary-deps.d/ramdisk index e56a617de..ddd494977 100644 --- a/elements/ramdisk/binary-deps.d/ramdisk +++ b/elements/ramdisk/binary-deps.d/ramdisk @@ -1,2 +1,3 @@ dhclient +ip busybox diff --git a/lib/ramdisk-functions b/lib/ramdisk-functions index b472ceb86..a1e02f47b 100644 --- a/lib/ramdisk-functions +++ b/lib/ramdisk-functions @@ -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