diff options
author | Antoine Ginies <aginies@mandriva.com> | 2004-01-14 18:28:03 +0000 |
---|---|---|
committer | Antoine Ginies <aginies@mandriva.com> | 2004-01-14 18:28:03 +0000 |
commit | b2f8d6ac7d8acc830af5c5ae232af06498c773b4 (patch) | |
tree | fdd3d4d6e644ca9c04eb005cb575a43fca54ff15 | |
parent | 7d413421242ce09645eb27c42590ae644e0adda3 (diff) | |
download | drakwizard-b2f8d6ac7d8acc830af5c5ae232af06498c773b4.tar drakwizard-b2f8d6ac7d8acc830af5c5ae232af06498c773b4.tar.gz drakwizard-b2f8d6ac7d8acc830af5c5ae232af06498c773b4.tar.bz2 drakwizard-b2f8d6ac7d8acc830af5c5ae232af06498c773b4.tar.xz drakwizard-b2f8d6ac7d8acc830af5c5ae232af06498c773b4.zip |
now can remove entry in PXE
-rw-r--r-- | pxe_wizard/Pxe.pm | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/pxe_wizard/Pxe.pm b/pxe_wizard/Pxe.pm index 007ed6bb..67ad1bdf 100644 --- a/pxe_wizard/Pxe.pm +++ b/pxe_wizard/Pxe.pm @@ -54,6 +54,7 @@ my $o = { IMG => '/tmp/t.img', PXENAME => '92', DESCR => 'install 9.2', + IMGTOREMOVE => '', }, needed_rpm => [ 'pxe', 'tftp-server', 'xinetd' ], }; @@ -64,6 +65,8 @@ my %level = ( 3 => N("remove - remove image in PXE"), # 4 => N("Modify - Modify image in PXE"), ); +# to get menu entry +list_menu(); $o->{pages} = { welcome => { @@ -99,7 +102,7 @@ $o->{pages} = { removeimg => { name => N("Remove a boot Image") . "\n\n" . N("Which one ?"), data => [ - { label => "Wich one ?", val => \$o->{var}{PXENAME} }, + { label => N("Which one:"), val => \$o->{var}{IMGTOREMOVE} }, ], next => 'summaryremove', }, @@ -148,6 +151,9 @@ $o->{pages} = { }, summaryremove => { name => N('Now will remove your PXE boot image'), + data => [ + { label => N("PXE entry to remove:"), fixed_val => \$o->{var}{IMGTOREMOVE} }, + ], post => \&do_it_remove, next => 'endremove', }, @@ -255,27 +261,35 @@ sub add_img { sub get_menu_entry { my ($NAME) = @_; - my ($NAME_bloc) = $PXEDEFAULT =~ /# TAG: ${NAME}_BEGIN(.*?)# TAG: ${NAME}_END/s or die "unable to find Menu entry section"; - $NAME_bloc; + my $conf = cat_($PXEDEFAULT) . "#EndOfFile"; + my ($NAME_bloc) = $conf =~ /(# TAG: ${NAME}_BEGIN.*?# TAG: ${NAME}_END)#EndOfFile/s or die "unable to find Menu entry section"; + print "$NAME_bloc"; } sub remove_in_menu { my ($NAME) = @_; - substInFile { - s/${NAME}_BEGIN.* \n\n\n//; - } $PXEDEFAULT; + my $conf = cat_($PXEDEFAULT) . "#EndOfFile"; + my ($begin, $NAME_bloc, $end) = $conf =~ /(.*?)(# TAG: ${NAME}_BEGIN.*?# TAG: ${NAME}_END)\n(.*)#EndOfFile/s or die "unable to find Menu entry section"; + output($PXEDEFAULT, $begin, $end); +} + +sub list_menu { + foreach (cat_($PXEDEFAULT)) { + my ($ent) = /\# TAG: (\w+)_BEGIN/; + ! $ent or print "$ent\n"; + } } sub remove_in_help { my ($NAME) = @_; substInFile { - s/^$NAME//; + s/^$NAME :.*//x; } $PXEHELP; } sub remove_img { - my ($PXENAME) = @_; - rm_rf($IMGPATH . "/" . $PXENAME . '.img'); + my ($NAME) = @_; + rm_rf($IMGPATH . "/" . $NAME . '.img'); } sub default_pxe_menu { @@ -327,6 +341,9 @@ sub do_it_add { sub do_it_remove { return if $::testing; + remove_in_menu($o->{var}{IMGTOREMOVE}); + remove_in_help($o->{var}{IMGTOREMOVE}); + remove_img($o->{var}{IMGTOREMOVE}); } sub do_it_modify { |