From c08d5470aa797923f613ada052b399e8ddfee54b Mon Sep 17 00:00:00 2001
From: Lucas Alvares Gomes <lucasagomes@gmail.com>
Date: Mon, 23 Feb 2015 15:39:22 +0000
Subject: [PATCH] Fix Ironic for Syslinux >= 5.00

Syslinux >= 5.00 pxelinux.0 binary is not "stand-alone"
anymore, it depends on some c32 modules to work correctly.
See: http://www.syslinux.org/wiki/index.php/Library_modules

Closes-Bug: #1419867
Change-Id: Ia62e980052ece3d5e2abf090b5609dea31f0d6b8
---
 lib/ironic | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/ironic b/lib/ironic
index 7ffa6a5caf..b39d2cc619 100644
--- a/lib/ironic
+++ b/lib/ironic
@@ -238,7 +238,15 @@ function configure_ironic_dirs {
         die $LINENO "PXE boot file $IRONIC_PXE_BOOT_IMAGE not found."
     fi
 
-    cp $IRONIC_PXE_BOOT_IMAGE $IRONIC_TFTPBOOT_DIR
+    # Copy PXE binary
+    if [[ "$IRONIC_IPXE_ENABLED" == "True" ]] ; then
+        cp $IRONIC_PXE_BOOT_IMAGE $IRONIC_TFTPBOOT_DIR
+    else
+        # Syslinux >= 5.00 pxelinux.0 binary is not "stand-alone" anymore,
+        # it depends on some c32 modules to work correctly.
+        # More info: http://www.syslinux.org/wiki/index.php/Library_modules
+        cp -aR $(dirname $IRONIC_PXE_BOOT_IMAGE)/*.{c32,0} $IRONIC_TFTPBOOT_DIR
+    fi
 }
 
 # configure_ironic() - Set config files, create data dirs, etc