richard: server/kolabconf/lib/Kolab Conf.pm,1.14,1.15
cvs at kolab.org
cvs at kolab.org
Wed Aug 20 22:14:05 CEST 2008
Author: richard
Update of /kolabrepository/server/kolabconf/lib/Kolab
In directory doto:/tmp/cvs-serv19064/lib/Kolab
Modified Files:
Conf.pm
Log Message:
Added function bootstrapConfig to create config
files needed during kolab bootstrapping, see kolab/issue1755
Index: Conf.pm
===================================================================
RCS file: /kolabrepository/server/kolabconf/lib/Kolab/Conf.pm,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- Conf.pm 9 Aug 2008 09:42:38 -0000 1.14
+++ Conf.pm 20 Aug 2008 20:14:03 -0000 1.15
@@ -703,6 +703,43 @@
}
}
+sub bootstrapConfig
+{
+ my $templatedir = $Kolab::config{"templatedir"};
+
+ # FIXME: it would be better if the templates can be given as an
+ # argument to this function.
+ my @templ = ("$templatedir/slapd.access.template",
+ "$templatedir/slapd.conf.template",
+ "$templatedir/slapd.replicas.template");
+
+ my %runonchange;
+
+ loadMetaTemplates( $templatedir, \%templates, \%permissions, \%ownership, \%runonchange );
+
+ my $cfg;
+ my $out;
+ foreach my $tpl (@templ) {
+ $cfg = $templates{$tpl};
+ # print STDOUT "Rebuilding $tpl => $cfg\n";
+ build($tpl, $cfg, $ownership{$cfg}, $permissions{$cfg} );
+
+ if ($tpl eq "$templatedir/slapd.conf.template") {
+ # Update file in place
+ if (open (CFG, "+< $cfg" )) {
+ while (<CFG>) {
+ s/^TLSCertificate/#TLSCertificate/;
+ $out .= $_;
+ }
+ seek(CFG, 0, 0);
+ print CFG $out;
+ truncate(CFG, tell(CFG));
+ close(CFG);
+ }
+ }
+ }
+}
+
sub checkPermissions {
my $key;
my $value;
More information about the commits
mailing list