diff options
author | Antoine Ginies <aginies@mandriva.com> | 2005-09-01 06:55:27 +0000 |
---|---|---|
committer | Antoine Ginies <aginies@mandriva.com> | 2005-09-01 06:55:27 +0000 |
commit | aaf6f9e733af7f3aea0200aa53b87add19bc5f8b (patch) | |
tree | 1f1a748dc38656d831131a22460c99f4950c102f /kolab_wizard/Kolab.pm | |
parent | 2510383f1183fa3513be741e61778ea027061a77 (diff) | |
download | drakwizard-aaf6f9e733af7f3aea0200aa53b87add19bc5f8b.tar drakwizard-aaf6f9e733af7f3aea0200aa53b87add19bc5f8b.tar.gz drakwizard-aaf6f9e733af7f3aea0200aa53b87add19bc5f8b.tar.bz2 drakwizard-aaf6f9e733af7f3aea0200aa53b87add19bc5f8b.tar.xz drakwizard-aaf6f9e733af7f3aea0200aa53b87add19bc5f8b.zip |
new kolab2 wizard (need mode fix)
Diffstat (limited to 'kolab_wizard/Kolab.pm')
-rwxr-xr-x | kolab_wizard/Kolab.pm | 220 |
1 files changed, 175 insertions, 45 deletions
diff --git a/kolab_wizard/Kolab.pm b/kolab_wizard/Kolab.pm index 8d03f5f1..f49eb966 100755 --- a/kolab_wizard/Kolab.pm +++ b/kolab_wizard/Kolab.pm @@ -23,6 +23,7 @@ use strict; use common; use MDK::Wizard::IFCFG; use MDK::Wizard::Wizcommon; +use MDK::Wizard::Wizcommon_gtk2; my $wiz = new MDK::Wizard::Wizcommon; @@ -35,6 +36,7 @@ if (!$IPSERVER) { } my $DOMAINNAME = chomp_(`dnsdomainname`); #my $kolab_config = "/etc/kolab/kolab.conf"; +my $CAYESORNO; my $o = { name => N("Kolab configuration wizard"), @@ -42,32 +44,78 @@ my $o = { test_host_domain($HOSTNAME, $DOMAINNAME); }, var => { - HOSTNAME => $HOSTNAME, + hostname => $HOSTNAME, ip1 => $IPSERVER, - maildomain => $DOMAINNAME, + domain => $DOMAINNAME, password => '', + capasswd => '', + keypasswd => '', }, - needed_rpm => [ 'proftpd', 'openldap-servers', 'apache2', 'kolab-server' ], + needed_rpm => [ 'proftpd', 'openldap-servers', 'kolab' ], # defaultimage => $ENV{__WIZ_HOME__}, }; +$::Wizard_pix_up = "/usr/share/mcc/themes/default/kolab-mdk.png"; + +my %type = ( + 1 => N("Master kolab server"), + 2 => N("Slave kolab server"), + ); $o->{pages} = { welcome => { name => N("Welcome to the Kolab Groupware server configuration Wizard.") . "\n\n" . N("Kolab is a secure, scalable and reliable groupware server. Some of the major features include: a web administration interface, a shared address book with provision for mailbox users as well as contacts and a POP3 as well as IMAP4(rev1) access to mail") . "\n\n" . N("Warning: Kolab needs to configure many other services: Proftpd, LDAP, Cyrus, Postfix, Imap, Saslauth. Wizard will make a backup of all your previous configuration files for these services."), no_back => 1, -# post => \&rpm_needed_kolab, - next => 'password', + next => 'masterslave', + }, + masterslave => { + name => N("Master or slave Kolab server"), + post => sub { + if ($o->{var}{wiz_type} == 1) { + $o->{var}{masterslave} = "1"; + return 'slaveserver'; + } else { + $o->{var}{masterslave} = "2"; + return 'domain'; + } + }, + data => [ + { label => "", val => \$o->{var}{wiz_type}, type => 'list', list => [ sort keys %type ], format => sub { $type{$_[0]} } }, + ], + next => '', + }, + master => { + name => N("You choose a Master Kolab server"), + next => 'slaveserver', + }, + slaveserver => { + name => N("You choose to configure a master Kolab server.") . "\n\n" . N("Enter fully qualified hostname of slave kolab server e.g. thishost.domain.tld (leave empty if none)."), + data => [ + { label => N("Slave kolab server:"), val => \$o->{var}{slaveserver} }, + ], + next => 'domain', + }, + domain => { + name => N("Kolab Domain") . "\n\n" . N("Please enter your Maildomain - if you do not know your mail domain use the FQDN from above. Kolab primary email addresses will be of the type user\@yourdomain"), + pre => sub { + $o->{var}{domain} = $DOMAINNAME; }, - # hostname => { - # name => N("Hostname"), - # data => [ - # { label => N("Hostname:"), val => \$o->{var}{HOSTNAME} }, - # { label => N("Mail domain:"), val => \$o->{var}{maildomain} }, - # ], - # next => 'password', - # }, + data => [ + { label => N("Domain:"), val => \$o->{var}{domain} }, + ], + next => 'password', + complete => sub { + if (!$o->{var}{domain}) { + $::in->ask_warn(N("Error"), N("You need a Kolab domain")); + return 1; + } else { return 0 } + }, + }, password => { - name => N("Enter password for the manager account of Kolab server."), + name => N("Enter password for the 'manager' account of Kolab server."), + pre => sub { + $o->{var}{password} = "dfgdfg"; + $o->{var}{password2} = "dfgdfg"; + }, complete => sub { if ($o->{var}{password} ne $o->{var}{password2} || $o->{var}{password} eq "") { $::in->ask_warn(N("Error:"), N("Password mismatch, or null password, please correct.")); @@ -75,24 +123,98 @@ $o->{pages} = { } }, data => [ - { - label => N("Password:"), val => \$o->{var}{password}, hidden => 1 }, - { - label => N("Password again:"), val => \$o->{var}{password2}, hidden => 1 }, + { label => N("Password:"), val => \$o->{var}{password}, hidden => 1 }, + { label => N("Password again:"), val => \$o->{var}{password2}, hidden => 1 }, ], - next => 'summary', + next => 'organame', }, + organame => { + name => N("Enter organisation name and organisational unit"), + pre => sub { + $o->{var}{wiz_organame} = "kolab"; + $o->{var}{wiz_orgaunit} = "Test_CA"; + }, + data => [ + { label => N("Organisation name:"), val => \$o->{var}{wiz_organame} }, + { label => N("Organisational unit:"), val => \$o->{var}{wiz_orgaunit} }, + ], + complete => sub { + if (!$o->{var}{wiz_orgaunit} || !$o->{var}{wiz_organame}) { + $::in->ask_warn(N("Error"), N("You need to enter an Organisation name and an organisational unit")); + return 1; + } else { return 0 } + }, + next => 'cayesorno', + }, + cayesorno => { + name => N("Kolab can create and manage a certificate authority that can be used to create SSL certificates for use within the Kolab environment.") . "\n\n" . N("You can choose to skip this section if you already have certificates for the Kolab server.CA and certificate"), + post => sub { + if ($o->{var}{cayesorno}) { + $CAYESORNO = "y"; + return 'capassword'; + } else { + $CAYESORNO = "n"; + return 'summary_noca'; + } + }, + pre => sub { + $o->{var}{cayesorno} = 1; + }, + data => [ + { label => "Do you want to create CA and certificates:", type => 'bool', val => \$o->{var}{cayesorno} }, + ], + }, + capassword => { + name => N("Enter the passpahre for CA, and the passphrase for the RSA key."), + complete => sub { + if ($o->{var}{capasswd} ne $o->{var}{capasswd2} || $o->{var}{capasswd} eq "") { + $::in->ask_warn(N("Error:"), N("Password mismatch, or null password, please correct.")); + return 1; + } + if ($o->{var}{keycapasswd} ne $o->{var}{keycapasswd2} || $o->{var}{keycapasswd} eq "") { + $::in->ask_warn(N("Error:"), N("Password mismatch, or null password, please correct.")); + return 1; + } + }, + pre => sub { + foreach ($o->{var}{capasswd}, $o->{var}{capasswd2}, $o->{var}{keycapasswd}, $o->{var}{keycapasswd2}) { + $_ = "rrrrrrrrrr"; + } + }, + data => [ + { label => N("CA passphrase:"), val => \$o->{var}{capasswd}, hidden => 1 }, + { label => N("CA passphrase again:"), val => \$o->{var}{capasswd2}, hidden => 1 }, + { label => ' ', }, + { label => N("RSA key passphrase:"), val => \$o->{var}{keycapasswd}, hidden => 1 }, + { label => N("RSA key passphrase:"), val => \$o->{var}{keycapasswd2}, hidden => 1 }, + ], + next => 'summary', + }, summary => { name => N("The wizard will now configure Kolab server with these parameters"), data => [ - { - label => N("Hostname:"), fixed_val => \$o->{var}{HOSTNAME} }, - { - label => N("Mail domain:"), fixed_val => \$o->{var}{maildomain} }, + { label => N("Hostname:"), fixed_val => \$o->{var}{hostname} }, + { label => N("Domain:"), fixed_val => \$o->{var}{domain} }, + { label => "" }, + { label => N("Organisation name:"), fixed_val => \$o->{var}{wiz_organame} }, + { label => N("Organisationnal unit:"), fixed_val => \$o->{var}{wiz_orgaunit} }, + { label => N("With CA") }, ], - post => \&do_it, + post => \&do_it_master, next => 'end', }, + summary_noca => { + name => N("The wizard will now configure Kolab server with these parameters"), + data => [ + { label => N("Hostname:"), fixed_val => \$o->{var}{hostname} }, + { label => N("Domain:"), fixed_val => \$o->{var}{domain} }, + { label => "" }, + { label => N("Organisation name:"), fixed_val => \$o->{var}{wiz_organame} }, + { label => N("Organisationnal unit:"), fixed_val => \$o->{var}{wiz_orgaunit} }, + ], + post => \&do_it_master_withoutca, + next => 'end', + }, end => { name => N("Congratulations") . "\n\n" . N("The kolab server is now configured and running. Log in as 'manager' with the password you entered at https://127.0.0.1/kolab/admin/"), end => 1, @@ -101,42 +223,50 @@ $o->{pages} = { }; -sub rpm_needed_kolab { - my $in = 'interactive'->vnew('su', 'Installing Kolab'); - my $w = $in->wait_message(N("Install in progress"), N("Installing Kolab server on your system...")); - system("urpmi --no-verify-rpm --auto kolab-server"); - undef $w; - if (!$in->do_pkgs->is_installed("kolab-server")) { - $::Wizard_finished = 1; - $in->ask_okcancel(N("Error"), N("Installation failed")); - $in->exit; - } -} - - sub new { my ($class) = @_; -# rpm_needed_kolab(); bless { o => $o, }, $class; } -sub do_it { +sub do_it_master_withoutca { return if $::testing; my $in = 'interactive'->vnew('su', 'Kolab server'); my $w = $in->wait_message(N("Kolab server"), N("Configuring Kolab server on your system...")); +} - local *F; - open(F, "|/usr/sbin/kolab_bootstrap -b\n"); - print F "$o->{var}{HOSTNAME} -$o->{var}{maildomain} +sub do_it_master { + return if $::testing; + my $in = 'interactive'->vnew('su', 'Kolab server'); + my $w = $in->wait_message(N("Kolab server"), N("Configuring Kolab server on your system...")); + system("service kolab stop"); + +# my $command = "/usr/sbin/kolab_bootstrap -b"; +# MDK::Wizard::Wizcommon_gtk2::wizard_progress_bar($command, "config en cours"); + + my $F; + open($F, "|/usr/sbin/kolab_bootstrap -b\n"); + print $F "y +$o->{var}{hostname} +$o->{var}{masterslave} +$o->{var}{domain} $o->{var}{password} +$o->{var}{slaveserver} +$CAYESORNO +$o->{var}{wiz_organame} +$o->{var}{wiz_orgaunit} + +y +y "; - close F; + close $F; - system("service kolab-server restart"); + # system("service kolab restart"); undef $w; } +#$o->{var}{capasswd} +#$o->{var}{capasswd2} +#$o->{var}{keycapasswd} 1; |