summaryrefslogtreecommitdiffstats
path: root/perl-install/drakcluster/server_conf_drakx.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/drakcluster/server_conf_drakx.pm')
-rw-r--r--perl-install/drakcluster/server_conf_drakx.pm58
1 files changed, 58 insertions, 0 deletions
diff --git a/perl-install/drakcluster/server_conf_drakx.pm b/perl-install/drakcluster/server_conf_drakx.pm
new file mode 100644
index 000000000..07e27b95b
--- /dev/null
+++ b/perl-install/drakcluster/server_conf_drakx.pm
@@ -0,0 +1,58 @@
+package drakcluster::server_conf_drakx;
+
+use strict;
+
+use run_program;
+use detect_devices;
+use 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},
+ NTPSERVER => $o->{intf}{eth0}{IPADDR},
+ IPOFFORWARDER => 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 {
+ 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;