gforge-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gforge-commits] gforge/deb-specific install-exim4.sh, 1.4, 1.5 install-


From: lo-lan-do
Subject: [Gforge-commits] gforge/deb-specific install-exim4.sh, 1.4, 1.5 install-db.sh, 1.33, 1.34 db-upgrade.pl, 1.64, 1.65
Date: Sun, 31 Oct 2004 08:18:05 -0600

Update of /cvsroot/gforge/gforge/deb-specific
In directory db.perdue.net:/tmp/cvs-serv7103/deb-specific

Modified Files:
        install-exim4.sh install-db.sh db-upgrade.pl 
Log Message:
Continued work on replacing LDAP by direct PostgreSQL lookups: Exim4
done, for both e-mail forwarding and mailing-lists.


Index: install-exim4.sh
===================================================================
RCS file: /cvsroot/gforge/gforge/deb-specific/install-exim4.sh,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- install-exim4.sh    26 Oct 2004 21:03:56 -0000      1.4
+++ install-exim4.sh    31 Oct 2004 14:18:02 -0000      1.5
@@ -74,8 +74,9 @@
 while (($l = <>) !~ /^\s*domainlist\s*local_domains/) {
   print $l;
   $seen_gf_domains = 1 if ($l =~ /\s*GFORGE_DOMAINS=/);
+  $seen_pg_servers = 1 if ($l =~ m,hide pgsql_servers = 
$sys_dbhost.*/gforge_mta,);
 };
-# hide pgsql_servers = "localhost/gforge/some_user/some_password"
+print "hide pgsql_servers = $sys_dbhost/$sys_dbname/gforge_mta/\n" unless 
$seen_pg_servers;
 print "GFORGE_DOMAINS=users.$domain_name:$sys_lists_host\n" unless 
$seen_gf_domains;
 chomp $l;
 $l .= ":GFORGE_DOMAINS" unless ($l =~ /^[^#]*GFORGE_DOMAINS/);
@@ -97,12 +98,11 @@
 # keep it in the Directors Configuration section (between the second and the
 # third occurences of a line containing only the word \"end\")
 
-hide pgsql_servers = $db_host/$db_name/gforge_nss/''
 forward_for_gforge:
   domains = users.$domain_name
   driver = redirect
   file_transport = address_file
-  data = \${lookup pgsql {select email from users where 
user_name=\'\$local_part\'}}
+  data = \${lookup pgsql {select email from mta_users where 
login=".chr(39)."\$local_part".chr(39)."}{$value}{fail}}
   user = nobody
   group = nogroup
 
@@ -110,7 +110,7 @@
   domains = $sys_lists_host
   driver = redirect
   pipe_transport = address_pipe
-  data = \${lookup ldap 
{ldap:///cn=\$local_part,ou=mailingList,$sys_ldap_base_dn?debGforgeListPostaddress}}
+  data = \${lookup pgsql {select post_address from mta_lists where 
list_name=".chr(39)."\$local_part".chr(39)."}{$value}{fail}}
   user = nobody
   group = nogroup
 
@@ -119,7 +119,7 @@
   local_part_suffix = -owner
   driver = redirect
   pipe_transport = address_pipe
-  data = \${lookup ldap 
{ldap:///cn=\$local_part,ou=mailingList,$sys_ldap_base_dn?debGforgeListOwnerAddress}}
+  data = \${lookup pgsql {select owner_address from mta_lists where 
list_name=".chr(39)."\$local_part".chr(39)."}{$value}{fail}}
   user = nobody
   group = nogroup
 
@@ -128,7 +128,7 @@
   local_part_suffix = -request
   driver = redirect
   pipe_transport = address_pipe
-  data = \${lookup ldap 
{ldap:///cn=\$local_part,ou=mailingList,$sys_ldap_base_dn?debGforgeListRequestAddress}}
+  data = \${lookup pgsql {select request_address from mta_lists where 
list_name=".chr(39)."\$local_part".chr(39)."}{$value}{fail}}
   user = nobody
   group = nogroup
 
@@ -137,7 +137,7 @@
   local_part_suffix = -admin
   driver = redirect
   pipe_transport = address_pipe
-  data = \${lookup ldap 
{ldap:///cn=\$local_part,ou=mailingList,$sys_ldap_base_dn?debGforgeListAdminAddress}}
+  data = \${lookup pgsql {select admin_address from mta_lists where 
list_name=".chr(39)."\$local_part".chr(39)."}{$value}{fail}}
   user = nobody
   group = nogroup
 
@@ -146,7 +146,7 @@
   local_part_suffix = -bounces
   driver = redirect
   pipe_transport = address_pipe
-  data = \${lookup ldap 
{ldap:///cn=\$local_part,ou=mailingList,$sys_ldap_base_dn?debGforgeListBouncesAddress}}
+  data = \${lookup pgsql {select bounces_address from mta_lists where 
list_name=".chr(39)."\$local_part".chr(39)."}{$value}{fail}}
   user = nobody
   group = nogroup
 
@@ -155,7 +155,7 @@
   local_part_suffix = -confirm
   driver = redirect
   pipe_transport = address_pipe
-  data = \${lookup ldap 
{ldap:///cn=\$local_part,ou=mailingList,$sys_ldap_base_dn?debGforgeListConfirmAddress}}
+  data = \${lookup pgsql {select confirm_address from mta_lists where 
list_name=".chr(39)."\$local_part".chr(39)."}{$value}{fail}}
   user = nobody
   group = nogroup
 
@@ -164,7 +164,7 @@
   local_part_suffix = -join
   driver = redirect
   pipe_transport = address_pipe
-  data = \${lookup ldap 
{ldap:///cn=\$local_part,ou=mailingList,$sys_ldap_base_dn?debGforgeListJoinAddress}}
+  data = \${lookup pgsql {select join_address from mta_lists where 
list_name=".chr(39)."\$local_part".chr(39)."}{$value}{fail}}
   user = nobody
   group = nogroup
 
@@ -173,7 +173,7 @@
   local_part_suffix = -leave
   driver = redirect
   pipe_transport = address_pipe
-  data = \${lookup ldap 
{ldap:///cn=\$local_part,ou=mailingList,$sys_ldap_base_dn?debGforgeListLeaveAddress}}
+  data = \${lookup pgsql {select leave_address from mta_lists where 
list_name=".chr(39)."\$local_part".chr(39)."}{$value}{fail}}
   user = nobody
   group = nogroup
 
@@ -182,7 +182,7 @@
   local_part_suffix = -subscribe
   driver = redirect
   pipe_transport = address_pipe
-  data = \${lookup ldap 
{ldap:///cn=\$local_part,ou=mailingList,$sys_ldap_base_dn?debGforgeListSubscribeAddress}}
+  data = \${lookup pgsql {select subscribe_address from mta_lists where 
list_name=".chr(39)."\$local_part".chr(39)."}{$value}{fail}}
   user = nobody
   group = nogroup
 
@@ -191,7 +191,7 @@
   local_part_suffix = -unsubscribe
   driver = redirect
   pipe_transport = address_pipe
-  data = \${lookup ldap 
{ldap:///cn=\$local_part,ou=mailingList,$sys_ldap_base_dn?debGforgeListUnsubscribeAddress}}
+  data = \${lookup pgsql {select unsubscribe_address from mta_lists where 
list_name=".chr(39)."\$local_part".chr(39)."}{$value}{fail}}
   user = nobody
   group = nogroup
 # END GFORGE BLOCK #
@@ -244,6 +244,7 @@
 
   configure)
     [ -x /usr/bin/newaliases ] && newaliases
+    invoke-rc.d exim4 restart
   ;;
 
   purge-files)

Index: install-db.sh
===================================================================
RCS file: /cvsroot/gforge/gforge/deb-specific/install-db.sh,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- install-db.sh       26 Oct 2004 20:31:25 -0000      1.33
+++ install-db.sh       31 Oct 2004 14:18:02 -0000      1.34
@@ -19,6 +19,8 @@
     target=$1
 fi
 
+export LC_ALL=C
+
 case "$target" in
     default)
        echo "Usage: $0 
{configure-files|configure|purge|purge-files|dump|restore}"
@@ -85,7 +87,7 @@
            rm -f $cur
            
            cur=$(mktemp /tmp/$pattern)
-           perl -e "open F, '/etc/postgresql/pg_hba.conf.gforge-new' or die 
\$!; undef \$/; \$l=<F>; \$l=~ s/^### BEGIN GFORGE BLOCK -- DO NOT EDIT.*### 
END GFORGE BLOCK -- DO NOT EDIT\$/### BEGIN GFORGE BLOCK -- DO NOT EDIT\nhost 
$db_name $db_user $ip_address 255.255.255.255 password\nhost $db_name 
gforge_nss $ip_address 255.255.255.255 trust\n### END GFORGE BLOCK -- DO NOT 
EDIT/ms; print \$l;" > $cur
+           perl -e "open F, '/etc/postgresql/pg_hba.conf.gforge-new' or die 
\$!; undef \$/; \$l=<F>; \$l=~ s/^### BEGIN GFORGE BLOCK -- DO NOT EDIT.*### 
END GFORGE BLOCK -- DO NOT EDIT\$/### BEGIN GFORGE BLOCK -- DO NOT EDIT\nhost 
$db_name $db_user $ip_address 255.255.255.255 password\nhost $db_name 
gforge_nss $ip_address 255.255.255.255 trust\nhost $db_name gforge_mta 
$ip_address 255.255.255.255 trust\n### END GFORGE BLOCK -- DO NOT EDIT/ms; 
print \$l;" > $cur
            cat $cur > /etc/postgresql/pg_hba.conf.gforge-new
            rm -f $cur
 
@@ -158,6 +160,23 @@
                rm -f $tmp1 $tmp2
                exit 1
            fi
+           if su -s /bin/sh postgres -c "/usr/bin/psql template1" &> /dev/null 
<<-EOF
+CREATE USER gforge_mta WITH PASSWORD '' ;
+EOF
+               then
+               rm -f $tmp1 $tmp2
+           else
+               echo "Cannot create PostgreSQL user...  This shouldn't have 
happened."
+               echo "Maybe a problem in your PostgreSQL configuration?"
+               echo "Please report a bug to the Debian bug tracking system"
+               echo "Please include the following output:"
+               echo "CREATE USER's STDOUT:"
+               cat $tmp1
+               echo "CREATE USER's STDERR:"
+               cat $tmp2
+               rm -f $tmp1 $tmp2
+               exit 1
+           fi
        fi
 
         # Create the appropriate database

Index: db-upgrade.pl
===================================================================
RCS file: /cvsroot/gforge/gforge/deb-specific/db-upgrade.pl,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- db-upgrade.pl       26 Oct 2004 20:57:21 -0000      1.64
+++ db-upgrade.pl       31 Oct 2004 14:18:02 -0000      1.65
@@ -1778,6 +1778,39 @@
         $dbh->commit () ;
     }
 
+    $version = &get_db_version ;
+    $target = "4.0.0-0+2" ;
+    if (&is_lesser ($version, $target)) {
+        &debug ("Upgrading with 20041031.sql") ;
+
+        @reqlist = @{ &parse_sql_file ("/usr/lib/gforge/db/20041031.sql") } ;
+        foreach my $s (@reqlist) {
+            $query = $s ;
+            # debug $query ;
+            $sth = $dbh->prepare ($query) ;
+            $sth->execute () ;
+            $sth->finish () ;
+        }
+        @reqlist = () ;
+
+        &debug ("Granting read access permissions to NSS") ;
+
+        @reqlist = ( "GRANT SELECT ON mta_users TO gforge_mta",
+                    "GRANT SELECT ON mta_lists TO gforge_mta",
+                   ) ;
+        foreach my $s (@reqlist) {
+            $query = $s ;
+            # debug $query ;
+            $sth = $dbh->prepare ($query) ;
+            $sth->execute () ;
+            $sth->finish () ;
+        }
+        @reqlist = () ;
+
+        &update_db_version ($target) ;
+        &debug ("Committing.") ;
+        $dbh->commit () ;
+    }
 
     &debug ("It seems your database $action went well and smoothly.  That's 
cool.") ;
     &debug ("Please enjoy using Gforge.") ;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]