richard: server/kolabconf/lib/Kolab Conf.pm,1.19,1.20

cvs at kolab.org cvs at kolab.org
Sat Sep 6 16:41:48 CEST 2008


Author: richard

Update of /kolabrepository/server/kolabconf/lib/Kolab
In directory doto:/tmp/cvs-serv2138/lib/Kolab

Modified Files:
	Conf.pm 
Log Message:
Added support to define the comment character in the META part of a
template file



Index: Conf.pm
===================================================================
RCS file: /kolabrepository/server/kolabconf/lib/Kolab/Conf.pm,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- Conf.pm	6 Sep 2008 11:45:52 -0000	1.19
+++ Conf.pm	6 Sep 2008 14:41:46 -0000	1.20
@@ -61,6 +61,7 @@
 my %permissions = ();
 my %templatehaschanged = ();
 my %haschanged = ();
+my %commentchar = ();
 
 sub fixup {
     my $file = shift;
@@ -617,7 +618,7 @@
 sub loadMetaTemplates
 {	
     my $templatedir = shift;
-    my ($tref, $pref, $oref, $cmdref) = @_;
+    my ($tref, $pref, $oref, $cmdref, $ccharref) = @_;
 
     Kolab::log('T', 'Collecting template files', KOLAB_DEBUG );
     opendir(DIR, $templatedir) or Kolab::log('T', 'Given templatedir $templatedir does not exist!', KOLAB_ERROR );
@@ -626,6 +627,7 @@
 
     foreach my $template (@metatemplates) {
 	my $runonchange = undef;
+	my $commentchar = undef;
 	#Open each file and check for the META
 	if (open (TEMPLATE, "$templatedir/$template" )) {
 	    my $line = <TEMPLATE>;
@@ -653,6 +655,9 @@
 			    } elsif ($key =~ /^RUNONCHANGE$/) {
 				$runonchange = replaceMetaVar($value);
 				Kolab::log('T', 'META Cmd to execute '.$runonchange, KOLAB_DEBUG );
+			    } elsif ($key =~ /^COMMENT_CHAR$/) {
+			      $commentchar = replaceMetaVar($value);
+			      Kolab::log('T', 'META CommentChar to use: '.$commentchar, KOLAB_DEBUG );
 			    } else {
 			        Kolab::log('T', 'incorrect META key "'.$key.'" in: '.$template, KOLAB_WARN );
 			    }
@@ -667,6 +672,7 @@
 		    $$pref{$target} = $permissions;
 		    my $runcmdtemplate = $templatedir."/".$template;
 		    $$cmdref{$runcmdtemplate} = $runonchange if (defined $runonchange);
+		    $$ccharref{$target} = $commentchar if (defined $commentchar);
 		}
 		
 	    }
@@ -689,7 +695,7 @@
     Kolab::log('T', 'Regenerating configuration files', KOLAB_DEBUG );
 
     Kolab::log('T', 'Loading meta-template data', KOLAB_DEBUG );
-    loadMetaTemplates( $templatedir, \%templates, \%permissions, \%ownership, \%runonchange );
+    loadMetaTemplates( $templatedir, \%templates, \%permissions, \%ownership, \%runonchange, \%commentchar );
 
     foreach $key (keys %templates) {
 	my $tpl = $templates{$key};
@@ -728,7 +734,7 @@
  
     my %runonchange;
 
-    loadMetaTemplates( $templatedir, \%templates, \%permissions, \%ownership, \%runonchange );
+    loadMetaTemplates( $templatedir, \%templates, \%permissions, \%ownership, \%runonchange, \%commentchar );
 
     my $cfg;
     my $out;





More information about the commits mailing list