steffen: server/perl-kolab/Kolab-Conf Conf.pm,1.15,1.16
cvs at intevation.de
cvs at intevation.de
Fri Jun 11 11:55:26 CEST 2004
Author: steffen
Update of /kolabrepository/server/perl-kolab/Kolab-Conf
In directory doto:/tmp/cvs-serv11563/Kolab-Conf
Modified Files:
Conf.pm
Log Message:
allow multivalued attributes, added new config templates
Index: Conf.pm
===================================================================
RCS file: /kolabrepository/server/perl-kolab/Kolab-Conf/Conf.pm,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- Conf.pm 8 Jun 2004 10:40:14 -0000 1.15
+++ Conf.pm 11 Jun 2004 09:55:24 -0000 1.16
@@ -45,6 +45,7 @@
&buildPostfixTransportMap
&buildCyrusConfig
&buildCyrusGroups
+ &buildCyrusReplicas
&rebuildTemplates
%haschanged
) ]
@@ -120,9 +121,21 @@
} elsif (/\@{3}endif\@{3}/) {
( $skip > 0 ) && $skip--;
s/\@{3}endif\@{3}//;
- } elsif (/\@{3}(\S+)\@{3}/) {
- if ($Kolab::config{$1}) {
- s/\@{3}(\S+)\@{3}/$Kolab::config{$1}/g;
+ } elsif (/\@{3}(\S+)(|[^\@]+)?\@{3}/) {
+ my $attr = $1;
+ my $opt = $2;
+ if ($Kolab::config{$attr}) {
+ my $val = "";
+ if( ref $Kolab::config{$attr} eq "ARRAY" ) {
+ if( $opt && $opt =~ /|join(.*)/ ) {
+ $val = join $1, @$Kolab::config{$attr};
+ } else {
+ $val = $Kolab::config{$attr}[0];
+ }
+ } else {
+ $val = $Kolab::config{$attr};
+ }
+ s/\@{3}(\S+)\@{3}/$val/g;
} else {
Kolab::log('T', "No configuration variable corresponding to `$1' exists", KOLAB_WARN);
s/\@{3}(\S+)\@{3}//g;
@@ -374,6 +387,48 @@
Kolab::log('T', 'Finished building Cyrus groups');
}
+sub buildCyrusReplicas
+{
+ Kolab::log('T', 'Building Cyrus replicas');
+
+ my $prefix = $Kolab::config{'prefix'};
+ my $cfg = "$prefix/etc/imapd/imapd.replicas";
+ my $oldcfg = $cfg . '.old';
+ copy($cfg, $oldcfg);
+ chown($Kolab::config{'kolab_uid'}, $Kolab::config{'kolab_gid'}, $oldcfg);
+ copy("$prefix/etc/kolab/templates/imapd.replicas.template", $cfg);
+ my $repl;
+ if (!($repl = IO::File->new($cfg, 'a'))) {
+ Kolab::log('T', "Unable to open configuration file `$cfg'", KOLAB_ERROR);
+ exit(1);
+ }
+
+ print join ',',@{$Kolab::config{'kolabhost'}};
+ for my $h ( @{$Kolab::config{'kolabhost'}} ) {
+ next if $h eq $Kolab::config{'fqhostname'};
+ print $repl "replica host=$h\n"
+ ." binddn=\"cn=replicator\"\n"
+ ." bindmethod=simple credentials=secret\n\n";
+ }
+
+ $repl->close;
+
+ chown($Kolab::config{'kolab_uid'}, $Kolab::config{'kolab_gid'}, $cfg);
+
+ if (-f $oldcfg) {
+ my $rc = `diff -q $cfg $oldcfg`;
+ chomp($rc);
+ if ($rc) {
+ Kolab::log('T', "`$cfg' change detected: $rc", KOLAB_DEBUG);
+ $Kolab::haschanged{'imapd'} = 1;
+ }
+ } else {
+ $Kolab::haschanged{'imapd'} = 1;
+ }
+
+ Kolab::log('T', 'Finished building Cyrus replicas');
+}
+
sub rebuildTemplates
{
my $key;
@@ -396,11 +451,17 @@
"$templatedir/legacy.conf.template" => "$prefix/etc/apache/legacy.conf",
"$templatedir/php.ini.template" => "$prefix/etc/apache/php.ini",
"$templatedir/proftpd.conf.template" => "$prefix/etc/proftpd/proftpd.conf",
- "$templatedir/slapd.conf.template" => "$prefix/etc/openldap/slapd.conf"
+ "$templatedir/slapd.conf.template" => "$prefix/etc/openldap/slapd.conf",
+ "$templatedir/freebusy.conf.template" => "$prefix/etc/resmgr/freebusy.conf",
+ "$templatedir/fbview.conf.template" => "$prefix/etc/resmgr/fbview.conf",
+ "$templatedir/resmgr.conf.template" => "$prefix/etc/resmgr/resmgr.conf"
);
my %permissions = (
"$prefix/var/kolab/php/admin/include/session_vars.php" => 0640,
+ "$prefix/etc/resmgr/freebusy.conf" => 0640,
+ "$prefix/etc/resmgr/fbview.conf" => 0640,
+ "$prefix/etc/resmgr/resmgr.conf" => 0640,
"$prefix/etc/postfix/main.cf" => 0640,
"$prefix/etc/postfix/master.cf" => 0640,
"$prefix/etc/clamav/clamav.conf" => 0640,
@@ -419,6 +480,9 @@
my %ownership = (
"$prefix/var/kolab/php/admin/include/session_vars.php" => "kolab:kolab-n",
+ "$prefix/etc/resmgr/freebusy.conf" => "kolab:kolab-n",
+ "$prefix/etc/resmgr/fbview.conf" => "kolab:kolab-n",
+ "$prefix/etc/resmgr/resmgr.conf" => "kolab:kolab-n",
"$prefix/etc/postfix/main.cf" => "root:kolab",
"$prefix/etc/postfix/master.cf" => "root:kolab",
"$prefix/etc/clamav/clamav.conf" => "kolab:kolab-r",
@@ -446,6 +510,7 @@
buildPostfixTransportMap;
buildCyrusConfig;
buildCyrusGroups;
+ buildCyrusReplicas;
Kolab::log('T', 'Finished regenerating configuration files');
}
More information about the commits
mailing list