summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drakpxelinux.pl26
1 files changed, 15 insertions, 11 deletions
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;