Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Alexander_Naumov:SLE12
cobbler
grubby-compat.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File grubby-compat.diff of Package cobbler
Index: scripts/grubby-compat =================================================================== --- /dev/null +++ scripts/grubby-compat @@ -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"}); +} Index: koan/app.py =================================================================== --- koan/app.py.orig +++ koan/app.py @@ -1001,7 +1001,11 @@ class Koan: return (0, "grub") else: return (0, "lilo") - cmd = [ "/sbin/grubby", "--bootloader-probe" ] + (make, version) = utils.os_release() + grubby_bin = "/sbin/grubby" + if (make == "suse"): + grubby_bin = "/usr/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 @@ -1027,11 +1031,16 @@ class Koan: def after_download(self, profile_data): use_grubby = False use_grub2 = False + use_grubby_compat = False (make, version) = utils.os_release() if make in ['ubuntu', 'debian']: if not os.path.exists("/usr/sbin/update-grub"): raise InfoException, "grub2 is not installed" use_grub2 = True + elif (make == "suse"): + if not os.path.exists("/usr/sbin/grubby-compat"): + raise InfoException, "grub2 is not installed" + use_grubby_compat = True else: if not os.path.exists("/sbin/grubby"): raise InfoException, "grubby is not installed" @@ -1130,6 +1139,25 @@ class Koan: cmd = [ "/sbin/lilo" ] utils.subprocess_call(cmd) + elif use_grubby_compat: + kargs_string = "%s" % k_args + cmd = [ "/usr/sbin/grubby-compat", + "--add-kernel", self.safe_load(profile_data,'kernel_local'), + "--initrd", self.safe_load(profile_data,'initrd_local'), + "--args", kargs_string + ] + + if self.add_reinstall_entry: + cmd.append("--title=Reinstall") + else: + cmd.append("--make-default") + cmd.append("--title=kick%s" % int(time.time())) + + if self.live_cd: + raise InfoException, "Live CD not supported by grubby-compat" + + utils.subprocess_call(cmd) + elif use_grub2: # Use grub2 for --replace-self kernel_local = self.safe_load(profile_data,'kernel_local') Index: setup.py =================================================================== --- setup.py.orig +++ setup.py @@ -215,7 +215,7 @@ if __name__ == "__main__": ], data_files = proc_data_files([ # tftpd, hide in /usr/sbin - ("/usr/sbin", ["bin/tftpd.py"]), + ("/usr/sbin", ["bin/tftpd.py", "scripts/grubby-compat"]), ("%s" % webconfig, ["config/cobbler.conf"]), ("%s" % vhostconfig, ["config/cobbler_web.conf"]),
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor