From 3a010088ba0c132e016bd9a527663cb66e29c09f Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Sun, 15 Jan 2012 20:51:23 +0000 Subject: extract get_initrd_name --- lib/MDV/Draklive/Initrd.pm | 4 ++-- lib/MDV/Draklive/Live.pm | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/MDV/Draklive/Initrd.pm b/lib/MDV/Draklive/Initrd.pm index adeea0a..b5ea5a7 100644 --- a/lib/MDV/Draklive/Initrd.pm +++ b/lib/MDV/Draklive/Initrd.pm @@ -301,8 +301,8 @@ sub create_classical_initrd { my $kernel = $live->find_kernel; print "using kernel $kernel->{version}\n"; - my $initrd_long = '/boot/initrd-'. $kernel->{version} . '.img'; - unlink($root . $initrd_long); + my $initrd_file = $root . '/boot/' . $live->get_initrd_name; + unlink($initrd_file); { my $bootloader = {}; diff --git a/lib/MDV/Draklive/Live.pm b/lib/MDV/Draklive/Live.pm index 49af192..9603879 100644 --- a/lib/MDV/Draklive/Live.pm +++ b/lib/MDV/Draklive/Live.pm @@ -47,6 +47,11 @@ sub find_kernel { $kernel ||= first(@kernels) or die "no kernel can be found\n"; } +sub get_initrd_name { + my ($live) = @_; + 'initrd-'. $live->find_kernel->{version} . '.img'; +} + sub get_lib_prefix { my ($live) = @_; my $lib_prefix = find { glob($live->get_system_root . $_ . '/libc.so.*') } qw(/lib64 /lib); -- cgit v1.2.1