summaryrefslogtreecommitdiffstats
path: root/drakpxelinux.pl
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2005-02-11 10:47:14 +0000
committerAntoine Ginies <aginies@mandriva.com>2005-02-11 10:47:14 +0000
commit60aa47a9bca73eb9383e882d6c82e0d2c17bdfc4 (patch)
treef35b546fc0335bac73385b19f971e471b9a119ab /drakpxelinux.pl
parentf58d9a3501746d6d398bff3959959440e385ac28 (diff)
downloaddrakpxelinux-60aa47a9bca73eb9383e882d6c82e0d2c17bdfc4.tar
drakpxelinux-60aa47a9bca73eb9383e882d6c82e0d2c17bdfc4.tar.gz
drakpxelinux-60aa47a9bca73eb9383e882d6c82e0d2c17bdfc4.tar.bz2
drakpxelinux-60aa47a9bca73eb9383e882d6c82e0d2c17bdfc4.tar.xz
drakpxelinux-60aa47a9bca73eb9383e882d6c82e0d2c17bdfc4.zip
fix bug (update vmlinuz and initrd files)
Diffstat (limited to 'drakpxelinux.pl')
-rw-r--r--drakpxelinux.pl27
1 files changed, 20 insertions, 7 deletions
diff --git a/drakpxelinux.pl b/drakpxelinux.pl
index 75b523e..b87ebc1 100644
--- a/drakpxelinux.pl
+++ b/drakpxelinux.pl
@@ -40,6 +40,15 @@ use ugtk2 qw(:ask :helpers :wrappers :create :dialogs);
use constant FALSE => 0;
use constant TRUE => 1;
+
+sub AmIRoot() {
+ unless ($> == 0) {
+ err_dialog(N("Error!"), N("You are not root. Exiting...")) and !$::testing && die;
+ }
+}
+
+AmIRoot();
+
# ie of entry menu in PXE:
#label linux
# KERNEL images/vmlinuz
@@ -510,7 +519,7 @@ sub edit_box_item {
# create file dialog widget, with file or directory selection
my $fdwidget = sub {
- my ($data, $test, $filetotest) = @_;
+ my ($data, $test, $filetotest, $label) = @_;
chdir($X86);
my $fd = new Gtk2::FileSelection(N("Selection"));
$fd->set_modal(TRUE);
@@ -525,13 +534,17 @@ sub edit_box_item {
}
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 $IMGPATH/vmlinuz-$label");
+ $data->set_text("images/vmlinuz-$label");
} 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 $IMGPATH/$label.rdz");
+ $data->set_text("images/$label.rdz");
}
- my $d = dirname($file);
- if ($d =~ /images/) { $filesel = "images/" . $filesel }
- print "$filesel\n";
- $data->set_text($filesel);
+# my $d = dirname($file);
+# if ($d =~ /images/) { $filesel = "images/" . $filesel }
+# print "$filesel\n";
+# $data->set_text($filesel);
$fd->hide;
}, $fd);
$fd->cancel_button->signal_connect(clicked => sub { $fd->hide });
@@ -543,7 +556,7 @@ sub edit_box_item {
$kernel->set_text($listpxe[$i]{kernel});
set_help_tip($kernel, 'kernel');
- my $file_dialogk = $fdwidget->($kernel, "", "kernel");
+ my $file_dialogk = $fdwidget->($kernel, "", "kernel", $listpxe[$i]{label});
# button kernel
my $buttonkernel = Gtk2::Button->new(N("Select kernel to boot"));
$buttonkernel->signal_connect(clicked => sub { $file_dialogk->show });
@@ -552,7 +565,7 @@ sub edit_box_item {
$initrd->set_text($listpxe[$i]{initrd});
set_help_tip($initrd, 'initrd');
- my $file_dialog = $fdwidget->($initrd, "", "initrd");
+ my $file_dialog = $fdwidget->($initrd, "", "initrd", $listpxe[$i]{label});
my $buttoninitrd = Gtk2::Button->new(N("Select associated initrd"));
$buttoninitrd->signal_connect(clicked => sub { $file_dialog->show });