File fix-cobbler-yaboot-handling.patch of Package cobbler

Index: cobbler-2.2.2/cobbler/pxegen.py
===================================================================
--- cobbler-2.2.2.orig/cobbler/pxegen.py
+++ cobbler-2.2.2/cobbler/pxegen.py
@@ -139,6 +139,9 @@ class PXEGen:
     def copy_single_distro_files(self, d, dirtree, symlink_ok):
         distros = os.path.join(dirtree, "images")
         distro_dir = os.path.join(distros,d.name)
+        # ppc can't have : in image path
+        if d.arch.startswith("ppc"):
+            distro_dir = distro_dir.replace(":","_")
         utils.mkdir(distro_dir)
         kernel = utils.find_kernel(d.kernel) # full path
         initrd = utils.find_initrd(d.initrd) # full path
@@ -361,6 +364,7 @@ class PXEGen:
         # the default menus:
         pxe_menu_items = ""
         grub_menu_items = ""
+        yaboot_menu_items = ""
 
         # For now, profiles are the only items we want grub EFI boot menu entries for:
         for profile in profile_list:
@@ -384,6 +388,13 @@ class PXEGen:
             if grub_contents is not None:
                 grub_menu_items = grub_menu_items + grub_contents + "\n"
 
+            if distro.arch.startswith("ppc"):
+                yaboot_contents = self.write_pxe_file(filename=None, system=None,
+                        profile=profile, distro=distro,
+                        arch=distro.arch, include_header=False,format="yaboot")
+                if yaboot_contents is not None:
+                    yaboot_menu_items = yaboot_menu_items + yaboot_contents + "\n"
+
 
         # image names towards the bottom
         for image in image_list:
@@ -419,6 +430,15 @@ class PXEGen:
         self.templar.render(template_data, metadata, outfile, None)
         template_src.close()
 
+        # Write the yaboot menu:
+        metadata = { "yaboot_menu_items" : yaboot_menu_items }
+        outfile = os.path.join(self.bootloc, "yaboot.conf")
+        template_src = open(os.path.join(self.settings.pxe_template_dir, "yabootdefault.template"))
+        template_data = template_src.read()
+        self.templar.render(template_data, metadata, outfile, None)
+        template_src.close()
+
+
     def write_memtest_pxe(self,filename):
         """
         Write a configuration file for memtest
@@ -491,8 +511,11 @@ class PXEGen:
             # not image based, it's something normalish
 
             img_path = os.path.join("/images",distro.name)
-            kernel_path = os.path.join("/images",distro.name,os.path.basename(distro.kernel))
-            initrd_path = os.path.join("/images",distro.name,os.path.basename(distro.initrd))
+            if distro.arch.startswith("ppc"):
+                 img_path = img_path.replace(":","_")
+
+            kernel_path = os.path.join(img_path,os.path.basename(distro.kernel))
+            initrd_path = os.path.join(img_path,os.path.basename(distro.initrd))
         
             # Find the kickstart if we inherit from another profile
             if system:
@@ -525,6 +548,8 @@ class PXEGen:
         if system:
             if format == "grub":
                 template = os.path.join(self.settings.pxe_template_dir, "grubsystem.template")
+            elif format =="yaboot":
+                template = os.path.join(self.settings.pxe_template_dir,"pxesystem_ppc.template")
             else: # pxe
                 if system.netboot_enabled:
                     template = os.path.join(self.settings.pxe_template_dir,"pxesystem.template")
@@ -572,6 +597,8 @@ class PXEGen:
             # not a system record, so this is a profile record or an image
             if arch.startswith("s390"):
                 template = os.path.join(self.settings.pxe_template_dir,"pxeprofile_s390x.template")
+            elif arch.startswith("ppc") and format == "yaboot":
+                template = os.path.join(self.settings.pxe_template_dir,"pxeprofile_ppc.template")
             elif format == "grub":
                 template = os.path.join(self.settings.pxe_template_dir,"grubprofile.template")
             elif distro and distro.os_version.startswith("esxi"):
Index: cobbler-2.2.2/templates/pxe/pxeprofile_ppc.template
===================================================================
--- /dev/null
+++ cobbler-2.2.2/templates/pxe/pxeprofile_ppc.template
@@ -0,0 +1,5 @@
+image=$kernel_path
+    label=$profile_name
+    initrd=$initrd_path
+    append="$append_line"
+
Index: cobbler-2.2.2/templates/pxe/yabootdefault.template
===================================================================
--- /dev/null
+++ cobbler-2.2.2/templates/pxe/yabootdefault.template
@@ -0,0 +1 @@
+$yaboot_menu_items
openSUSE Build Service is sponsored by