package drakcluster::server_conf_drakx; use strict; use run_program; use detect_devices; use network::network; use common; use drakcluster::server_conf; # for compatibility #sub drakcluster::server_conf::N { &_ } #sub N { &_ } sub generate_rndc() { run_program::rooted($::prefix, 'rndc-confgen', '-a'); first(cat_("$::prefix/etc/rndc.key") =~ /secret "(\S*)";/); } sub default_conf { my ($o) = @_; { DOMAINNAME => $o->{netc}{DOMAINNAME}, NISDOMAINNAME => $o->{netc}{DOMAINNAME}, NTPSERVER => $o->{intf}{eth0}{IPADDR}, IPOFFORWARDER => network::network::dnsServers($o->{netc}), ORIGIN => $o->{netc}{DOMAINNAME}, }; } my $force_size; sub my_gtk::show { my ($o) = @_; $o->{rwindow}->set_usize($::windowwidth * 0.9, $::windowheight * 0.9) if $force_size; $force_size = 0; $o->{window}->show; $o->{rwindow}->show; } sub main_cluster { my ($o) = @_; my @network_interfaces = detect_devices::getNet(); my $conf = drakcluster::server_conf::read(); $conf->{DNSKEY} ||= generate_rndc(); my @fields = drakcluster::server_conf::fields($conf, \@network_interfaces, default_conf($o)); $force_size = 1; $o->ask_from('', N("Cluster Server Configuration"), [ @fields ], complete => sub { my $i = eval { find_index { !drakcluster::server_conf::check_field($o, $_) } @fields }; $@ ? 0 : (1, $i); }) or return; drakcluster::server_conf::done($conf, \@network_interfaces); } 1;