summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-10-28 20:26:06 +0000
committerOlivier Blin <oblin@mandriva.com>2008-10-28 20:26:06 +0000
commit1c72da4b765932ad694ec1a3865eff3620cafb62 (patch)
tree801a75f173a5292092ee657d2b44a68eef361f77
parent218b22da76f5ebc2d954813246c8822c38685ed4 (diff)
downloaddrakiso-1c72da4b765932ad694ec1a3865eff3620cafb62.tar
drakiso-1c72da4b765932ad694ec1a3865eff3620cafb62.tar.gz
drakiso-1c72da4b765932ad694ec1a3865eff3620cafb62.tar.bz2
drakiso-1c72da4b765932ad694ec1a3865eff3620cafb62.tar.xz
drakiso-1c72da4b765932ad694ec1a3865eff3620cafb62.zip
move find_kernel as method in MDV::Draklive::Live object
-rwxr-xr-xdraklive17
-rw-r--r--lib/MDV/Draklive/Live.pm11
2 files changed, 14 insertions, 14 deletions
diff --git a/draklive b/draklive
index e17f434..19c6fa6 100755
--- a/draklive
+++ b/draklive
@@ -378,17 +378,6 @@ sub get_syslinux_path {
'/' . $media->{storage} . '/syslinux' . ($opts->{boot} && '-boot-' . $opts->{boot}) . '.cfg';
}
-sub find_kernel {
- my ($live) = @_;
- my $kernel = $live->{system}{kernel};
- unless ($kernel) {
- my $vmlinuz = readlink($live->get_system_root . '/boot/vmlinuz');
- $vmlinuz ||= find { -e $_ && ! -l $_ } glob_($live->get_system_root . '/boot/vmlinuz-*');
- ($kernel) = $vmlinuz =~ /\bvmlinuz-(.*)$/ or die "no kernel can be found\n";
- }
- $kernel;
-}
-
sub need_media_specific_boot {
my ($live) = @_;
to_bool(list_selected_loopbacks($live));
@@ -491,7 +480,7 @@ sub create_initrd_for_media {
mkdir_p($initrd_tree . "/dev/loop");
cp_af($initrd_tree . "/dev/loop$_", $initrd_tree . "/dev/loop/$_") foreach 0 .. $loop_nb;
- my $kernel = find_kernel($live);
+ my $kernel = $live->find_kernel;
print "using kernel $kernel\n";
my $kernel_root = "/lib/modules/" . $kernel;
list_modules::load_dependencies($live->get_system_root . $kernel_root . "/modules.dep");
@@ -641,7 +630,7 @@ sub add_splash {
sub create_classical_initrd {
my ($live) = @_;
- my $kernel = find_kernel($live);
+ my $kernel = $live->find_kernel;
#- FIXME: use bootloader-config and allow it not to require a bootloader?
print "using kernel $kernel\n";
my $initrd_long = '/boot/initrd-'. $kernel . '.img';
@@ -1123,7 +1112,7 @@ sub create_bootloader {
sub create_media_bootloader {
my ($live) = @_;
- cp_f($live->get_system_root . '/boot/vmlinuz-' . find_kernel($live), $live->get_builddir . $live->{prefix}{build}{boot} . '/vmlinuz');
+ cp_f($live->get_system_root . '/boot/vmlinuz-' . $live->find_kernel, $live->get_builddir . $live->{prefix}{build}{boot} . '/vmlinuz');
require bootsplash;
my $theme = do {
local $::prefix = $live->get_system_root;
diff --git a/lib/MDV/Draklive/Live.pm b/lib/MDV/Draklive/Live.pm
index 25ec4c2..43b741e 100644
--- a/lib/MDV/Draklive/Live.pm
+++ b/lib/MDV/Draklive/Live.pm
@@ -22,4 +22,15 @@ sub get_system_root {
$live->{settings}{chroot} . '/' . $live->get_name;
}
+sub find_kernel {
+ my ($live) = @_;
+ my $kernel = $live->{system}{kernel};
+ unless ($kernel) {
+ my $vmlinuz = readlink($live->get_system_root . '/boot/vmlinuz');
+ $vmlinuz ||= find { -e $_ && ! -l $_ } glob_($live->get_system_root . '/boot/vmlinuz-*');
+ ($kernel) = $vmlinuz =~ /\bvmlinuz-(.*)$/ or die "no kernel can be found\n";
+ }
+ $kernel;
+}
+
1;