diff options
author | Thomas Arendsen Hein <thomas@intevation.de> | 2009-03-17 16:46:31 (GMT) |
---|---|---|
committer | Thomas Arendsen Hein <thomas@intevation.de> | 2009-03-17 16:46:31 (GMT) |
commit | c61273f97f643f07e4f4bd09d5cb91ec0524ef62 (patch) | |
tree | 70949869c794122d4ed4b4cb0034369a0fd14ea4 /lib | |
parent | 8c1e8b1c6045d8c0e027b780f35dbfd621aef67c (diff) | |
download | perl-Kolab-c61273f97f643f07e4f4bd09d5cb91ec0524ef62.tar.gz |
Use RUNONCHANGE mechanism for postfix reload and postmap.
Adding entries to virtual.template and transport.template from LDAP ist the
remaining postfix handling in kolabconf.
header_checks.template, ldapdistlist.cf.template and ldapvirtual.cf.template.in
need no RUNONCHANGE, because
- regexp or ldap tables do not need postmap
- they are used by the short-living cleanup, no postfix reload needed
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kolab/Conf.pm | 52 |
1 files changed, 11 insertions, 41 deletions
diff --git a/lib/Kolab/Conf.pm b/lib/Kolab/Conf.pm index b248918..f5a46d4 100644 --- a/lib/Kolab/Conf.pm +++ b/lib/Kolab/Conf.pm @@ -42,7 +42,6 @@ our @ISA = qw(Exporter); our %EXPORT_TAGS = ( 'all' => [ qw( - &buildPostfixTransportMap &buildCyrusGroups &buildLDAPReplicas &rebuildTemplates @@ -282,16 +281,12 @@ sub build { move($config->filename, $cfg) || Kolab::log('T', "Error moving configfile to $cfg, error: $!", KOLAB_ERROR ); fixup( $cfg, $owner, $perm ); - #chown($Kolab::config{'kolab_uid'}, $Kolab::config{'kolab_gid'}, $cfg); - #chmod(0600, $cfg) if ($cfg =~ /openldap/); if (-f $oldcfg && !defined $special_templates{$tmpl} ) { my $rc = `diff -q $cfg $oldcfg`; chomp($rc); if ($rc) { - if ($cfg =~ /postfix/) { - $haschanged{'postfix'} = 1; - } elsif ($cfg =~ /openldap/) { + if ($cfg =~ /openldap/) { $haschanged{'slapd'} = 1; } elsif ($cfg =~ /imapd/) { $haschanged{'imapd'} = 1; @@ -305,16 +300,6 @@ sub build { Kolab::log('T', "Finished creating configuration file `$cfg'", KOLAB_DEBUG ); } -sub buildPostfixTransportMap -{ - buildPostfixMap( 'transport' ); -} - -sub buildPostfixVirtualMap -{ - buildPostfixMap( 'virtual' ); -} - sub buildPostfixMap { my $map = shift; @@ -326,14 +311,8 @@ sub buildPostfixMap my $cfg = $templates{$keytemplate}; my $oldcfg = $cfg . '.old'; - #my $oldmask = umask 077; - #copy($cfg, $oldcfg); - #chown($Kolab::config{'kolab_uid'}, $Kolab::config{'kolab_gid'}, $oldcfg); - #umask $oldmask; - #delete $templates{$keytemplate}; - - my $transport; - if (!($transport = IO::File->new($cfg, 'a'))) { + my $cfgfile; + if (!($cfgfile = IO::File->new($cfg, 'a'))) { Kolab::log('T', "Unable to create Postfix $map map: $!", KOLAB_ERROR); exit(1); } @@ -362,7 +341,7 @@ sub buildPostfixMap foreach (@$routes) { $_ = trim($_); Kolab::log('T', "Adding entry `$_' to $map"); - print $transport $_ . "\n"; + print $cfgfile $_ . "\n"; } } } else { @@ -370,22 +349,18 @@ sub buildPostfixMap } Kolab::LDAP::destroy($ldap); - $transport->close; - - # FIXME: bad way of doing things... - #system("chown root:root @emailserver_confdir@/*"); - fixup( $cfg, $ownership{$cfg}, $permissions{$cfg}); - system("$Kolab::config{'postmapping'}/$map"); + $cfgfile->close; if (-f $oldcfg) { my $rc = `diff -q $cfg $oldcfg`; chomp($rc); if ($rc) { - Kolab::log('T', "`$cfg' change detected: $rc", KOLAB_DEBUG); - $haschanged{'postfix'} = 1; + Kolab::log('T', "`$cfg' change detected: $rc", KOLAB_DEBUG); + $templatehaschanged{$keytemplate} = 1; } } else { - $haschanged{'postfix'} = 1; + Kolab::log('T', "`$cfg' creation detected", KOLAB_DEBUG); + $templatehaschanged{$keytemplate} = 1; } Kolab::log('T', "Finished building Postfix $map map", KOLAB_DEBUG); @@ -750,8 +725,8 @@ sub rebuildTemplates build($tpl, $cfg, $ownership{$cfg}, $permissions{$cfg}, $commentchar{$cfg}); } - buildPostfixTransportMap; - buildPostfixVirtualMap; + buildPostfixMap('transport'); + buildPostfixMap('virtual'); buildLDAPAccess; buildLDAPReplicas; buildCyrusGroups; @@ -835,11 +810,6 @@ sub reload system("$Kolab::config{'KOLABRC'} rc openldap restart &"); } - if ($haschanged{'postfix'}) { - &Kolab::log('K', 'Reloading Postfix...'); - system("$Kolab::config{sbindir}/postfix reload"); - } - if ($haschanged{'imapd'}) { &Kolab::log('K', 'Restarting imapd...'); # Would it be enough with a reload here? /steffen |