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

Index: cobbler-2.6.6/cobbler/pxegen.py
===================================================================
--- cobbler-2.6.6.orig/cobbler/pxegen.py
+++ cobbler-2.6.6/cobbler/pxegen.py
@@ -153,6 +153,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
@@ -388,6 +391,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:
@@ -411,6 +415,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:
@@ -430,7 +441,7 @@ class PXEGen:
                 contents = self.write_memtest_pxe("/%s" % base)
                 pxe_menu_items = pxe_menu_items + contents + "\n"
 
-        return {'pxe' : pxe_menu_items, 'grub' : grub_menu_items}
+        return {'pxe' : pxe_menu_items, 'grub' : grub_menu_items, 'yaboot' : yaboot_menu_items}
 
     def get_menu_items_nexenta(self):
         """
@@ -462,7 +473,7 @@ class PXEGen:
                 grub_contents = self.write_pxe_file(filename=None, system=None, profile=profile, distro=distro, arch=distro.arch, include_header=False, format="nexenta")
                 if grub_contents is not None:
                     grub_menu_items = grub_menu_items + grub_contents + "\n"
-              
+
         return {'pxe' : pxe_menu_items, 'grub' : grub_menu_items}
 
     def make_actual_pxe_menu(self):
@@ -495,6 +506,14 @@ class PXEGen:
         self.templar.render(template_data, metadata, outfile, None)
         template_src.close()
 
+        # Write the yaboot menu:
+        metadata = { "yaboot_menu_items" : menu_items['yaboot'] }
+        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()
+
         # write the nexenta menu
         menu_items = self.get_menu_items_nexenta()
         metadata = { "grub_menu_items": menu_items['grub'] }
@@ -582,13 +601,15 @@ class PXEGen:
             # not image based, it's something normalish
 
             img_path = os.path.join("/images",distro.name)
+            if distro.arch.startswith("ppc"):
+                 img_path = img_path.replace(":","_")
 
             if 'nexenta' == distro.breed:
                 kernel_path = os.path.join("/images", distro.name, 'platform', 'i86pc', 'kernel', 'amd64', os.path.basename(distro.kernel))
                 initrd_path = os.path.join("/images", distro.name, 'platform', 'i86pc', 'amd64', os.path.basename(distro.initrd))
             else:
-                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))
+                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:
@@ -630,6 +651,8 @@ class PXEGen:
                     local = os.path.join(self.settings.pxe_template_dir, "grublocal.template")
                     if os.path.exists(local):
                         template = local
+            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")
@@ -679,7 +702,9 @@ 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")
-            if arch.startswith("arm"):
+            elif arch.startswith("ppc") and format == "yaboot":
+                template = os.path.join(self.settings.pxe_template_dir,"pxeprofile_ppc.template")
+            elif arch.startswith("arm"):
                 template = os.path.join(self.settings.pxe_template_dir,"pxeprofile_arm.template")
             elif format == "grub":
                 template = os.path.join(self.settings.pxe_template_dir,"grubprofile.template")
Index: cobbler-2.6.6/templates/pxe/pxeprofile_ppc.template
===================================================================
--- /dev/null
+++ cobbler-2.6.6/templates/pxe/pxeprofile_ppc.template
@@ -0,0 +1,5 @@
+image=$kernel_path
+    label=$profile_name
+    initrd=$initrd_path
+    append="$append_line"
+
Index: cobbler-2.6.6/templates/pxe/yabootdefault.template
===================================================================
--- /dev/null
+++ cobbler-2.6.6/templates/pxe/yabootdefault.template
@@ -0,0 +1 @@
+$yaboot_menu_items
openSUSE Build Service is sponsored by