From d15e07ff644461795cd3a03f8db003f3a70cbd3c Mon Sep 17 00:00:00 2001 From: Stew Benedict Date: Mon, 9 Feb 2004 17:26:45 +0000 Subject: Thierry compliance. Doesn't work anymore and fails perl_checker now :P --- perl-install/standalone/drakTermServ | 69 ++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 39 deletions(-) diff --git a/perl-install/standalone/drakTermServ b/perl-install/standalone/drakTermServ index 75934b15c..6b1fe4a0d 100755 --- a/perl-install/standalone/drakTermServ +++ b/perl-install/standalone/drakTermServ @@ -368,7 +368,7 @@ sub wizard_step { my ($do_step, $step) = @_; &$do_step(); gtkadd($wizard_buttons, - gtksignal_connect($previous_button = new Gtk2::Button(N("<-- Wizard Previous Step")), clicked => sub { + gtksignal_connect($previous_button = new Gtk2::Button(N("Previous")), clicked => sub { clear_buttons(); if ($step == 1) { exit_wizard(); @@ -389,7 +389,7 @@ sub wizard_step { }) ); gtkadd($wizard_buttons, - gtksignal_connect($next_button = new Gtk2::Button(N("Wizard Next Step -->")), clicked => sub { + gtksignal_connect($next_button = new Gtk2::Button(N("Next")), clicked => sub { clear_buttons(); wizard_step(\&dhcpd_config, 2) if $step == 1; if ($step == 2) { @@ -703,14 +703,10 @@ sub make_nbi() { my $list_nbis = Gtk2::TreeView->new_with_model($list_model); $list_nbis->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => 0)); $list_nbis->set_headers_visible(0); - my @nbis = grep { /\.nbi/ } all($tftpboot); my $nbi; my $nbi_iter; - my $iter; - foreach (@nbis) { - $list_model->append_set(undef, $_); - } + update_list($list_model); $list_nbis->get_selection->signal_connect(changed => sub { my ($model, $iter) = $_[0]->get_selected; @@ -728,12 +724,7 @@ sub make_nbi() { if ($kernel) { $in->ask_warn(N("Information"), N("This will take a few minutes.")); cursor_wait(); - system("/usr/bin/mknbi-set -k /boot/$kernel"); - $list_model->clear; - @nbis = grep { /\.nbi/ } all($tftpboot); - foreach (@nbis) { - $list_model->append_set($iter, $_); - } + build_n_update($list_model, "-k /boot/$kernel"); cursor_norm(); } else { $in->ask_warn(N("Error"), N("No kernel selected!")) if !($kernel); @@ -741,12 +732,7 @@ sub make_nbi() { }), gtksignal_connect(new Gtk2::Button(N("Build Single NIC -->")), clicked => sub { if ($nic) { - system("/usr/bin/mknbi-set -k /boot/$kernel -r $nic"); - $list_model->clear; - @nbis = grep { /\.nbi/ } all($tftpboot); - foreach (@nbis) { - $list_model->append_set($iter, $_); - } + build_n_update($list_model, "-k /boot/$kernel -r $nic"); } else { $in->ask_warn(N("Error"), N("No NIC selected!")); } @@ -754,18 +740,13 @@ sub make_nbi() { gtksignal_connect(new Gtk2::Button(N("Build All Kernels -->")), clicked => sub { $in->ask_warn(N("Information"), N("This will take a few minutes.")); cursor_wait(); - system("/usr/bin/mknbi-set"); - $list_model->clear; - @nbis = grep { /\.nbi/ } all($tftpboot); - foreach (@nbis) { - $list_model->append_set($iter, $_); - } + build_n_update($list_model, ""); cursor_norm(); }), new Gtk2::HBox(1,1), gtksignal_connect(new Gtk2::Button(N("<-- Delete")), clicked => sub { my $nbi = $tftpboot . "/" . $nbi; - my $result = unlink($nbi) || warn("Can't delete $nbi..."); + my $result = unlink($nbi) or warn("Can't delete $nbi..."); if ($result == 1) { $list_model->remove($nbi_iter); } @@ -789,6 +770,19 @@ sub make_nbi() { $nbi_box->show_all; } +sub update_list { + my ($list_model) = @_; + $list_model->clear; + $list_model->append_set(undef, $_) foreach grep { /\.nbi/ } all($tftpboot); +} + +sub build_n_update { + my ($list_model, $command) = @_; + system("/usr/bin/mknbi-set $command"); + update_list($list_model); +} + + sub maintain_users() { #- copy users from /etc/shadow to /etc/shadow$$CLIENT$$ to allow ts login my $user_box; @@ -1742,24 +1736,21 @@ sub update_hosts_allow { sub format_client_entry { #- create a client entry, in proper format my ($client, %ts_clients) = @_; - my ($pxe_img) = $ts_clients{$client}{filename} =~ /boot-(.*?)\./; - my $pxe; - $pxe_img .= ".zimg.pxe"; - $pxe = 1 if -f "$tftpboot/$pxe_img"; - + my $pxe_img = $ts_clients{$client}{filename} =~ /boot-(.*?)\./ . ".zimg.pxe"; + my $pxe = -f "$tftpboot/$pxe_img"; my $entry = "host $client {\n"; $entry .= "\thardware ethernet\t$ts_clients{$client}{hardware};\n"; $entry .= "\tfixed-address\t\t$ts_clients{$client}{address};\n"; $entry .= "\t#type\t\t\t$ts_clients{$client}{type};\n" if $ts_clients{$client}{type}; if ($ts_clients{$client}{filename}) { - $entry .= qq(\tif substring (option vendor-class-identifier, 0, 9) = "PXEClient"\n) if $pxe; - $entry .= qq(\t{\n\t) if $pxe; - $entry .= qq(\tfilename\t\t"$pxe_img";\n) if $pxe; - $entry .= qq(\t}\n) if $pxe; - $entry .= qq(\telse if substring (option vendor-class-identifier, 0, 9) = "Etherboot"\n) if $pxe; - $entry .= qq(\t{\n\t) if $pxe; - $entry .= qq(\tfilename\t\t"$ts_clients{$client}{filename}";\n); - $entry .= qq(\t}\n) if $pxe; + $entry .= join("\n", if_($pxe, qq(\tif substring (option vendor-class-identifier, 0, 9) = "PXEClient" +\t{ +\t\tfilename\t\t"$pxe_img"; +\t} +\telse if substring (option vendor-class-identifier, 0, 9) = "Etherboot" +\t{\n\t)), +qq(\tfilename\t\t"$ts_clients{$client}{filename}";), + if_($pxe, qq(\t}))) . "\n"; } $entry .= "\t#hdw_config\t\t$ts_clients{$client}{hdw_config};\n" if $ts_clients{$client}{hdw_config}; $entry .= "}\n"; -- cgit v1.2.1