--- scripts/grubby-compat
+++ scripts/grubby-compat	2011/09/07 10:54:41
@@ -0,0 +1,53 @@
+#! /usr/bin/perl
+
+use POSIX;
+use Getopt::Long;
+use Pod::Usage;
+use Bootloader::Tools;
+use strict;
+
+my %oper;
+my ($opt_args, $opt_update, $opt_initrd, $opt_add_image, $opt_default, $opt_title)
+    = ("",0,'','',undef,'');
+
+GetOptions (\%oper,
+    'add-kernel=s' => \$opt_add_image,
+    'bootloader-probe' ,
+    'update-kernel' => \$opt_update,
+    'make-default',
+    'args=s'      => \$opt_args,
+    'initrd=s'      => \$opt_initrd,
+    'title=s' => \$opt_title)
+    or pod2usage(2);
+
+if (defined $oper{'bootloader-probe'}){
+  print Bootloader::Tools::GetBootloader();
+  exit 0;
+}
+
+my $lib = InitLibrary();
+
+if ($opt_add_image ne ''){
+  print "add kernel\n";
+  my @sections = @{$lib->GetSections ()};
+  my $section = { 'name' => $opt_title,
+                  'append' => $opt_args,
+                  'type' => "image",
+                  'initrd' => $opt_initrd,
+                  'image' => $opt_add_image,
+                  'original_name' => 'linux',
+                  '__modified' => '1',
+                  'root' => $lib->GetMountPoints()->{"/"}};
+  unshift @sections, $section;
+  $lib->SetSections (\@sections);
+  print "set sections\n";
+  if (defined $oper{'make-default'}){
+    my $glob_ref = $lib->GetGlobalSettings();
+    $glob_ref->{"default"} = $section->{"name"};
+    $lib->SetGlobalSettings ($glob_ref);
+  }
+  $lib->WriteSettings(1);
+  $lib->UpdateBootloader (1);
+  print "bootloader updated\n";
+  Bootloader::Tools::DumpLog($lib->{"loader"});
+}
--- koan/app.py
+++ koan/app.py	2012/05/15 09:39:32
@@ -926,8 +926,12 @@
                return (0, "grub")
             else:
                return (0, "lilo") 
-        cmd = [ "/sbin/grubby", "--bootloader-probe" ]
-        probe_process = sub_process.Popen(cmd, stdout=sub_process.PIPE)
+        (make, version) = utils.os_release()
+        grubby_bin = "/sbin/grubby"
+        if (make == "suse"):
+            grubby_bin = "/sbin/grubby-compat"
+        cmd = [ grubby_bin, "--bootloader-probe" ]
+        probe_process = sub_process.Popen(cmd, stdout=sub_process.PIPE)
         which_loader = probe_process.communicate()[0]
         return probe_process.returncode, which_loader
 
@@ -950,14 +954,16 @@
     
 
         def after_download(self, profile_data):
-            if not os.path.exists("/sbin/grubby"):
-                raise InfoException, "grubby is not installed"
+            (make, version) = utils.os_release()
+            grubby_bin = "/sbin/grubby"
+            if (make == "suse"):
+                grubby_bin = "/sbin/grubby-compat"
+            if not os.path.exists(grubby_bin):
+                raise InfoException, "%s is not installed" % grubby_bin
             k_args = self.calc_kernel_args(profile_data,replace_self=1)
 
             kickstart = self.safe_load(profile_data,'kickstart')
 
-            (make, version) = utils.os_release()
-
             if (make == "centos" and version < 6) or (make == "redhat" and version < 6) or (make == "fedora" and version < 10):
 
                 # embed the initrd in the kickstart file because of libdhcp and/or pump
@@ -991,13 +997,19 @@
                 elif arch.startswith("s390"):
                     if len(k_args) > 895:
                         raise InfoException, "Kernel options are too long, 896 chars exceeded: %s" % k_args
-                elif len(k_args) > 255:
-                    raise InfoException, "Kernel options are too long, 255 chars exceeded: %s" % k_args
+                elif len(k_args) > 2047:
+                    raise InfoException, "Kernel options are too long, 2047 chars exceeded: %s" % k_args
+
+            kargs_string = ""
+            if make == "suse":
+                kargs_string = "%s" % k_args
+            else:
+                kargs_string = "\"%s\"" % k_args
 
-            cmd = [ "/sbin/grubby",
+            cmd = [ grubby_bin,
                     "--add-kernel", self.safe_load(profile_data,'kernel_local'),
                     "--initrd", self.safe_load(profile_data,'initrd_local'),
-                    "--args", "\"%s\"" % k_args
+                    "--args", kargs_string
             ]
 
             if self.grubby_copy_default:
--- setup.py
+++ setup.py	2012/05/15 09:40:54
@@ -170,6 +170,7 @@
         data_files = proc_data_files([
             # tftpd, hide in /usr/sbin
             ("/usr/sbin", ["scripts/tftpd.py"]),
+            ("/sbin", ["scripts/grubby-compat"]),
 
             ("%s" % webconfig,              ["config/cobbler.conf"]),
             ("%s" % vhostconfig,            ["config/cobbler_web.conf"]),
