Index: Conf.pm
===================================================================
RCS file: /home/kroupware/jail/kolabrepository/server/perl-kolab/Kolab-Conf/Conf.pm,v
retrieving revision 1.55
diff -u -r1.55 Conf.pm
--- Conf.pm	8 Jun 2005 12:44:35 -0000	1.55
+++ Conf.pm	20 Jun 2005 15:41:13 -0000
@@ -107,7 +107,7 @@
     }
     my $config;
     if (!($config = new File::Temp( TEMPLATE => 'tmpXXXXX',
-				    DIR => $prefix.$ap::config->{sysconfdir}/kolab/,
+				    DIR => $prefix.$ap::config->{sysconfdir}. "/kolab/",
 				    SUFFIX => '.kolabtmp',
 				    UNLINK => 0 ))) {
         Kolab::log('T', "Unable to open configuration file `$cfg'", KOLAB_ERROR);
@@ -239,7 +239,7 @@
     copy($cfg, $oldcfg);
     chown($Kolab::config{'kolab_uid'}, $Kolab::config{'kolab_gid'}, $oldcfg);
     umask $oldmask;
-    copy("$ap::config->{sysconfdir}/kolab/templates/$map.template", $cfg);
+    copy($prefix . $ap::config->{sysconfdir} . "/kolab/templates/$map.template", $cfg);
 
     my $transport;
     if (!($transport = IO::File->new($cfg, 'a'))) {
@@ -283,7 +283,7 @@
 
     # FIXME: bad way of doing things...
     #system("chown root:root $ap::config->{sysconfdir}/postfix/*");
-    system("$ap::config->{sbindir}/postmap $ap::config->{sysconfdir}/etc/postfix/$map");
+    system($prefix . $ap::config->{sbindir} . "/postmap $ap::config->{sysconfdir}/etc/postfix/$map");
 
     if (-f $oldcfg) {
         my $rc = `diff -q $cfg $oldcfg`;
@@ -325,23 +325,23 @@
 
     while (<$cyrustemplate>) {
         if (/\@{3}cyrus-imap\@{3}/ && ($Kolab::config{"cyrus-imap"} =~ /true/i)) {
-            $_ = "imap cmd=\"imapd -C $ap::config->{sysconfdir}/imapd/imapd.conf\" listen=\"143\" prefork=0\n";
+            $_ = "imap cmd=\"imapd -C $prefix$ap::config->{sysconfdir}/imapd/imapd.conf\" listen=\"143\" prefork=0\n";
         }
         elsif (/\@{3}cyrus-imap\@{3}/ && ($Kolab::config{"cyrus-imap"} =~ /false/i)) {
 	    # Even if imapd is disabled, enable it for localhost -- resource handlers depend on it
-            $_ = "imap cmd=\"imapd -C $ap::config->{sysconfdir}/imapd/imapd.conf\" listen=\"127.0.0.1:143\" prefork=0\n";
+            $_ = "imap cmd=\"imapd -C $prefix$ap::config->{sysconfdir}/imapd/imapd.conf\" listen=\"127.0.0.1:143\" prefork=0\n";
         }
         elsif (/\@{3}cyrus-pop3\@{3}/ && ($Kolab::config{"cyrus-pop3"} =~ /true/i)) {
-            $_ = "pop3 cmd=\"pop3d -C $ap::config->{sysconfdir}/imapd/imapd.conf\" listen=\"110\" prefork=0\n";
+            $_ = "pop3 cmd=\"pop3d -C $prefix$ap::config->{sysconfdir}/imapd/imapd.conf\" listen=\"110\" prefork=0\n";
         }
         elsif (/\@{3}cyrus-imaps\@{3}/ && ($Kolab::config{"cyrus-imaps"} =~ /true/i)) {
-            $_ = "imaps cmd=\"imapd -s -C $ap::config->{sysconfdir}/imapd/imapd.conf\" listen=\"993\" prefork=0\n";
+            $_ = "imaps cmd=\"imapd -s -C $prefix$ap::config->{sysconfdir}/imapd/imapd.conf\" listen=\"993\" prefork=0\n";
         }
         elsif (/\@{3}cyrus-pop3s\@{3}/ && ($Kolab::config{"cyrus-pop3s"} =~ /true/i)) {
-            $_ = "pop3s cmd=\"pop3d -s -C $ap::config->{sysconfdir}/imapd/imapd.conf\" listen=\"995\" prefork=0\n";
+            $_ = "pop3s cmd=\"pop3d -s -C $prefix$ap::config->{sysconfdir}/imapd/imapd.conf\" listen=\"995\" prefork=0\n";
         }
         elsif (/\@{3}cyrus-sieve\@{3}/ && ($Kolab::config{"cyrus-sieve"} =~ /true/i)) {
-            $_ = "sieve cmd=\"timsieved -C $ap::config->{sysconfdir}/imapd/imapd.conf\" listen=\"2000\" prefork=0\n";
+            $_ = "sieve cmd=\"timsieved -C $prefix$ap::config->{sysconfdir}/imapd/imapd.conf\" listen=\"2000\" prefork=0\n";
         }
         $_ =~ s/\@{3}.*\@{3}//;
         print $cyrusconf $_;
@@ -378,7 +378,7 @@
     copy($cfg, $oldcfg);
     chown($Kolab::config{'kolab_uid'}, $Kolab::config{'kolab_gid'}, $oldcfg);
     umask $oldmask;
-    copy("$ap::config->{sysconfdir}/kolab/templates/imapd.group.template", $cfg);
+    copy($prefix . $ap::config->{sysconfdir} . "/kolab/templates/imapd.group.template", $cfg);
     my $groupconf;
     if (!($groupconf = IO::File->new($cfg, 'a'))) {
         Kolab::log('T', "Unable to open configuration file `$cfg'", KOLAB_ERROR);
@@ -453,7 +453,7 @@
     my $oldmask = umask 077;
     copy($cfg, $oldcfg);
     chown($Kolab::config{'kolab_uid'}, $Kolab::config{'kolab_gid'}, $oldcfg);
-    copy("$ap::config->{sysconfdir}/kolab/templates/slapd.replicas.template", $cfg);
+    copy($prefix . $ap::config->{sysconfdir} . "/kolab/templates/slapd.replicas.template", $cfg);
     my $repl;
     if (!($repl = IO::File->new($cfg, 'a'))) {
         Kolab::log('T', "Unable to open configuration file `$cfg'", KOLAB_ERROR);
@@ -557,79 +557,79 @@
 }
 
 my $prefix = $Kolab::config{'prefix'};
-my $templatedir = "$ap::config->{sysconfdir}/kolab/templates";
+my $templatedir = $prefix . $ap::config->{sysconfdir} . "/kolab/templates";
 
 my %templates = (
-		 "$templatedir/rc.conf.template" => "$ap::config->{sysconfdir}/rc.conf",
-		 "$templatedir/session_vars.php.template" => "$ap::config->{webadmindir}/php/admin/include/session_vars.php",
-		 "$templatedir/clamd.conf.template" => "$ap::config->{sysconfdir}/clamav/clamd.conf",
-		 "$templatedir/freshclam.conf.template" => "$ap::config->{sysconfdir}/clamav/freshclam.conf",
-		 "$templatedir/amavisd.conf.template" => "$ap::config->{sysconfdir}/amavisd/amavisd.conf",
-		 "$templatedir/main.cf.template" => "$ap::config->{sysconfdir}/postfix/main.cf",
-		 "$templatedir/master.cf.template" => "$ap::config->{sysconfdir}/postfix/master.cf",
-		 "$templatedir/saslauthd.conf.template" => "$ap::config->{sysconfdir}/sasl/saslauthd.conf",
-		 "$templatedir/imapd.conf.template" => "$ap::config->{sysconfdir}/imapd/imapd.conf",
-		 "$templatedir/httpd.conf.template" => "$ap::config->{webserver_confdir}/apache.conf",
-		 "$templatedir/httpd.local.template" => "$ap::config->{webserver_confdir}/apache.local",
-		 "$templatedir/php.ini.template" => "$ap::config->{webserver_confdir}/php.ini",
-		 "$templatedir/proftpd.conf.template" => "$ap::config->{ftpserver_confdir}/proftpd.conf",
-		 "$templatedir/ldap.conf.template" => "$ap::config->{sysconfdir}/openldap/ldap.conf",
-		 "$templatedir/slapd.conf.template" => "$ap::config->{sysconfdir}/openldap/slapd.conf",
-		 "$templatedir/DB_CONFIG.slapd.template" => "$prefix/var/openldap/openldap-data/DB_CONFIG",
-		 "$templatedir/freebusy.conf.template" => "$ap::config->{sysconfdir}/resmgr/freebusy.conf",
-		 "$templatedir/fbview.conf.template" => "$ap::config->{sysconfdir}/resmgr/fbview.conf",
-		 "$templatedir/resmgr.conf.template" => "$ap::config->{sysconfdir}/resmgr/resmgr.conf"
+		 "$templatedir/rc.conf.template"          => $prefix . $ap::config->{sysconfdir} . "/rc.conf",
+		 "$templatedir/session_vars.php.template" => $prefix . $ap::config->{webadmindir} . "/php/admin/include/session_vars.php",
+		 "$templatedir/clamd.conf.template"       => $prefix . $ap::config->{sysconfdir} . "/clamav/clamd.conf",
+		 "$templatedir/freshclam.conf.template"   => $prefix . $ap::config->{sysconfdir} . "/clamav/freshclam.conf",
+		 "$templatedir/amavisd.conf.template"     => $prefix . $ap::config->{sysconfdir} . "/amavisd/amavisd.conf",
+		 "$templatedir/main.cf.template"          => $prefix . $ap::config->{sysconfdir} . "/postfix/main.cf",
+		 "$templatedir/master.cf.template"        => $prefix . $ap::config->{sysconfdir} . "/postfix/master.cf",
+		 "$templatedir/saslauthd.conf.template"   => $prefix . $ap::config->{sysconfdir} . "/sasl/saslauthd.conf",
+		 "$templatedir/imapd.conf.template"       => $prefix . $ap::config->{sysconfdir} . "/imapd/imapd.conf",
+		 "$templatedir/httpd.conf.template"       => $prefix . $ap::config->{webserver_confdir} . "/apache.conf",
+		 "$templatedir/httpd.local.template"      => $prefix . $ap::config->{webserver_confdir} . "/apache.local",
+		 "$templatedir/php.ini.template"          => $prefix . $ap::config->{webserver_confdir} . "/php.ini",
+		 "$templatedir/proftpd.conf.template"     => $prefix . $ap::config->{ftpserver_confdir} . "/proftpd.conf",
+		 "$templatedir/ldap.conf.template"        => $prefix . $ap::config->{sysconfdir} . "/openldap/ldap.conf",
+		 "$templatedir/slapd.conf.template"       => $prefix . $ap::config->{sysconfdir} . "/openldap/slapd.conf",
+		 "$templatedir/DB_CONFIG.slapd.template"  => $prefix . "/var/openldap/openldap-data/DB_CONFIG",
+		 "$templatedir/freebusy.conf.template"    => $prefix . $ap::config->{sysconfdir} . "/resmgr/freebusy.conf",
+		 "$templatedir/fbview.conf.template"      => $prefix . $ap::config->{sysconfdir} . "/resmgr/fbview.conf",
+		 "$templatedir/resmgr.conf.template"      => $prefix . $ap::config->{sysconfdir} . "/resmgr/resmgr.conf"
 		);
 
 my %permissions = (
-		   "$ap::config->{sysconfdir}/rc.conf"                                  => 0644,
-		   "$ap::config->{webadmindir}/php/admin/include/session_vars.php" => 0640,
-		   "$ap::config->{sysconfdir}/resmgr/freebusy.conf"                     => 0640,
-		   "$ap::config->{sysconfdir}/resmgr/fbview.conf"                       => 0640,
-		   "$ap::config->{sysconfdir}/resmgr/resmgr.conf"                       => 0640,
-		   "$ap::config->{sysconfdir}/postfix/main.cf"                          => 0640,
-		   "$ap::config->{sysconfdir}/postfix/master.cf"                        => 0640,
-		   "$ap::config->{sysconfdir}/clamav/clamd.conf"                        => 0640,
-		   "$ap::config->{sysconfdir}/clamav/freshclam.conf"                    => 0640,
-		   "$ap::config->{sysconfdir}/amavisd/amavisd.conf"                     => 0640,
-		   "$ap::config->{sysconfdir}/sasl/saslauthd.conf"                      => 0600,
-		   "$ap::config->{sysconfdir}/imapd/imapd.conf"                         => 0640,
-		   "$ap::config->{webserver_confdir}/apache.conf"                       => 0640,
-		   "$ap::config->{webserver_confdir}/apache.local"                      => 0640,
-		   "$ap::config->{webserver_confdir}/php.ini"                           => 0640,
-		   "$ap::config->{ftpserver_confdir}/proftpd.conf"                     => 0640,
-		   "$ap::config->{sysconfdir}/openldap/slapd.conf"                      => 0640,
-		   "$prefix/var/openldap/openldap-data/DB_CONFIG"         => 0640,
-		   "$ap::config->{sysconfdir}/openldap/ldap.conf"                       => 0644,
-		   "$ap::config->{sysconfdir}/postfix/transport"                        => 0640,
-		   "$ap::config->{sysconfdir}/postfix/virtual"                          => 0640,
-		   "$ap::config->{sysconfdir}/imapd/cyrus.conf"                         => 0640,
-		   "$ap::config->{sysconfdir}/imapd/imapd.group"                        => 0640);
+		   "$prefix$ap::config->{sysconfdir}/rc.conf"                                  => 0644,
+		   "$prefix$ap::config->{libdir}/php/kolab-webadmin/include/session_vars.php"  => 0640,
+		   "$prefix$ap::config->{sysconfdir}/resmgr/freebusy.conf"                     => 0640,
+		   "$prefix$ap::config->{sysconfdir}/resmgr/fbview.conf"                       => 0640,
+		   "$prefix$ap::config->{sysconfdir}/resmgr/resmgr.conf"                       => 0640,
+		   "$prefix$ap::config->{sysconfdir}/postfix/main.cf"                          => 0640,
+		   "$prefix$ap::config->{sysconfdir}/postfix/master.cf"                        => 0640,
+		   "$prefix$ap::config->{sysconfdir}/clamav/clamd.conf"                        => 0640,
+		   "$prefix$ap::config->{sysconfdir}/clamav/freshclam.conf"                    => 0640,
+		   "$prefix$ap::config->{sysconfdir}/amavisd/amavisd.conf"                     => 0640,
+		   "$prefix$ap::config->{sysconfdir}/sasl/saslauthd.conf"                      => 0600,
+		   "$prefix$ap::config->{sysconfdir}/imapd/imapd.conf"                         => 0640,
+		   "$prefix$ap::config->{sysconfdir}/apache/conf/apache.conf"                  => 0640,
+		   "$prefix$ap::config->{sysconfdir}/apache/conf/apache.local"                 => 0640,
+		   "$prefix$ap::config->{sysconfdir}/apache/conf/php.ini"                      => 0640,
+		   "$prefix$ap::config->{sysconfdir}/proftpd/proftpd.conf"                     => 0640,
+		   "$prefix$ap::config->{sysconfdir}/openldap/slapd.conf"                      => 0640,
+		   "$prefix/var/lib/openldap-data/DB_CONFIG"                                   => 0640,
+		   "$prefix$ap::config->{sysconfdir}/openldap/ldap.conf"                       => 0644,
+		   "$prefix$ap::config->{sysconfdir}/postfix/transport"                        => 0640,
+		   "$prefix$ap::config->{sysconfdir}/postfix/virtual"                          => 0640,
+		   "$prefix$ap::config->{sysconfdir}/imapd/cyrus.conf"                         => 0640,
+		   "$prefix$ap::config->{sysconfdir}/imapd/imapd.group"                        => 0640);
 
 my %ownership = (
-		 "$ap::config->{sysconfdir}/rc.conf"                                  => "kolab:kolab",
-		 "$ap::config->{webadmindir}/php/admin/include/session_vars.php" => "kolab:kolab-n",
-		 "$ap::config->{sysconfdir}/resmgr/freebusy.conf"                     => "kolab:kolab-n",
-		 "$ap::config->{sysconfdir}/resmgr/fbview.conf"                       => "kolab:kolab-n",
-		 "$ap::config->{sysconfdir}/resmgr/resmgr.conf"                       => "kolab:kolab-n",
-		 "$ap::config->{sysconfdir}/postfix/main.cf"                          => "kolab:kolab-r",
-		 "$ap::config->{sysconfdir}/postfix/master.cf"                        => "kolab:kolab-r",
-		 "$ap::config->{sysconfdir}/clamav/clamd.conf"                        => "kolab:kolab-r",
-		 "$ap::config->{sysconfdir}/clamav/freshclam.conf"                    => "kolab:kolab-r",
-		 "$ap::config->{sysconfdir}/amavisd/amavisd.conf"                     => "kolab:kolab-r",
-		 "$ap::config->{sysconfdir}/sasl/saslauthd.conf"                      => "kolab:kolab",
-		 "$ap::config->{sysconfdir}/imapd/imapd.conf"                         => "kolab:kolab-r",
-		 "$ap::config->{webserver_confdir}/apache.conf"                       => "kolab:kolab-n",
-		 "$ap::config->{webserver_confdir}/apache.local"                      => "kolab:kolab-n",
-		 "$ap::config->{webserver_confdir}/php.ini"                           => "kolab:kolab-n",
-		 "$ap::config->{ftpserver_confdir}/proftpd.conf"                      => "kolab:kolab-n",
-		 "$ap::config->{sysconfdir}/openldap/ldap.conf"                       => "kolab:kolab",
-		 "$ap::config->{sysconfdir}/openldap/slapd.conf"                      => "kolab:kolab",
-		 "$prefix/var/openldap/openldap-data/DB_CONFIG"                       => "kolab:kolab",
-		 "$ap::config->{sysconfdir}/postfix/transport"                        => "root:kolab",
-		 "$ap::config->{sysconfdir}/postfix/virtual"                          => "root:kolab",
-		 "$ap::config->{sysconfdir}/imapd/cyrus.conf"                         => "kolab:kolab",
-		 "$ap::config->{sysconfdir}/imapd/imapd.group"                        => "kolab:kolab-r");
+		 "$prefix$ap::config->{sysconfdir}/rc.conf"                                  => "kolab:kolab",
+		 "$prefix$ap::config->{libdir}/php/kolab-webadmin/include/session_vars.php"  => "kolab:kolab-n",
+		 "$prefix$ap::config->{sysconfdir}/resmgr/freebusy.conf"                     => "kolab:kolab-n",
+		 "$prefix$ap::config->{sysconfdir}/resmgr/fbview.conf"                       => "kolab:kolab-n",
+		 "$prefix$ap::config->{sysconfdir}/resmgr/resmgr.conf"                       => "kolab:kolab-n",
+		 "$prefix$ap::config->{sysconfdir}/postfix/main.cf"                          => "kolab:kolab-r",
+		 "$prefix$ap::config->{sysconfdir}/postfix/master.cf"                        => "kolab:kolab-r",
+		 "$prefix$ap::config->{sysconfdir}/clamd.conf"                               => "kolab:kolab-r",
+		 "$prefix$ap::config->{sysconfdir}/freshclam.conf"                           => "kolab:kolab-r",
+		 "$prefix$ap::config->{sysconfdir}/amavisd/amavisd.conf"                     => "kolab:kolab-r",
+		 "$prefix$ap::config->{sysconfdir}/sasl/saslauthd.conf"                      => "kolab:kolab",
+		 "$prefix$ap::config->{sysconfdir}/imapd/imapd.conf"                         => "kolab:kolab-r",
+		 "$prefix$ap::config->{sysconfdir}/apache/conf/apache.conf"                  => "kolab:kolab-n",
+		 "$prefix$ap::config->{sysconfdir}/apache/conf/apache.local"                 => "kolab:kolab-n",
+		 "$prefix$ap::config->{sysconfdir}/apache/conf/php.ini"                      => "kolab:kolab-n",
+		 "$prefix$ap::config->{sysconfdir}/proftpd/proftpd.conf"                     => "kolab:kolab-n",
+		 "$prefix$ap::config->{sysconfdir}/openldap/ldap.conf"                       => "kolab:kolab",
+		 "$prefix$ap::config->{sysconfdir}/openldap/slapd.conf"                      => "kolab:kolab",
+		 "$prefix/var/lib/openldap-data/DB_CONFIG"                                   => "kolab:kolab",
+		 "$prefix$ap::config->{sysconfdir}/postfix/transport"                        => "root:kolab",
+		 "$prefix$ap::config->{sysconfdir}/postfix/virtual"                          => "root:kolab",
+		 "$prefix$ap::config->{sysconfdir}/imapd/cyrus.conf"                         => "kolab:kolab",
+		 "$prefix$ap::config->{sysconfdir}/imapd/imapd.group"                        => "kolab:kolab-r");
 
 
 sub rebuildTemplates
