From fd6079f5e834b023bef9f761dcb9b7426e690110 Mon Sep 17 00:00:00 2001 From: Antoine Ginies Date: Fri, 2 Sep 2005 14:26:50 +0000 Subject: fix memdis/data.img and kernel/initrd test --- drakpxelinux.pl | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'drakpxelinux.pl') diff --git a/drakpxelinux.pl b/drakpxelinux.pl index 151145b..9ea92f8 100644 --- a/drakpxelinux.pl +++ b/drakpxelinux.pl @@ -460,20 +460,24 @@ sub edit_box_item { } else { -f $file or err_dialog(N("Error!"), N("Should be a file")) and return; } + print "file $file\n"; if ($filetotest eq "kernel") { - run_program::get_stdout("file $file") =~ /boot sector/ or err_dialog(N("Error!"), N("Should be a boot sector file")) and return; - run_program::get_stdout("cp -avf $file " . $network::pxe::pxelinux_images . "/vmlinuz-$label"); - $data->set_text("images/vmlinuz-$label"); + if (basename($file) ne "memdisk") { + run_program::get_stdout("file $file") =~ /boot sector/ or err_dialog(N("Error!"), N("Should be a boot sector file")) and return; + run_program::get_stdout("cp -avf $file " . $network::pxe::pxelinux_images . "/vmlinuz-$label"); + $data->set_text("images/vmlinuz-$label"); + } else { $data->set_text("memdisk") } } elsif ($filetotest eq "initrd") { - run_program::get_stdout("file $file") =~ /initrd/ or err_dialog(N("Error!"), N("Should be an initrd file")) and return; - system("cp -avf $file " . $network::pxe::pxelinux_images . "/$label.rdz"); - $data->set_text("images/$label.rdz"); + if (basename($file) !~ /^\w+\.img$/) { + run_program::get_stdout("file $file") =~ /initrd/ or err_dialog(N("Error!"), N("Should be an initrd file")) and return; + system("cp -avf $file " . $network::pxe::pxelinux_images . "/$label.rdz"); + $data->set_text("images/$label.rdz"); + } else { + system("cp -avf $file " . $network::pxe::pxelinux_images . "/$label.img"); + $data->set_text("images/$label.img"); + } } -# my $d = dirname($file); -# if ($d =~ /images/) { $filesel = "images/" . $filesel } -# print "$filesel\n"; -# $data->set_text($filesel); - $fd->hide; + $fd->hide; }, $fd); $fd->cancel_button->signal_connect(clicked => sub { $fd->hide }); return $fd; -- cgit v1.2.1