I now do this with my mail toaster setup (http://matt.simerson.net/computing/mail/toaster/).

When you run the perl script (toaster_setup.pl -s vpopmail) it asks you a bunch of questions and then rewrites vmysql.h with your answers instead of the default values. Then it runs ./configure with the appropriate --enable-* stuff based on the interview.

Here's the useful logic:

sub set_up_vmysql {
   my ($mysql_repl, $my_write, $my_read, $my_user, $my_pass) = @_;
   copy("vmysql.h", "vmysql.h.orig");
   my @lines = read_file("vmysql.h");

   foreach my $line (@lines) {
      chomp $line;
      if      ( $line =~ /^#define MYSQL_UPDATE_SERVER/ ) {
         if ($mysql_repl) {
            $line = "#define MYSQL_UPDATE_SERVER \"$my_write\"";
         } else {
            $line = "#define MYSQL_UPDATE_SERVER \"$my_read\"";
         };
      } elsif ( $line =~ /^#define MYSQL_UPDATE_USER/ ) {
         $line = "#define MYSQL_UPDATE_USER   \"$my_user\"";
      } elsif ( $line =~ /^#define MYSQL_UPDATE_PASSWD/ ) {
         $line = "#define MYSQL_UPDATE_PASSWD \"$my_pass\"";
      } elsif ( $line =~ /^#define MYSQL_READ_SERVER/ ) {
         $line = "#define MYSQL_READ_SERVER   \"$my_read\"";
      } elsif ( $line =~ /^#define MYSQL_READ_USER/ ) {
         $line = "#define MYSQL_READ_USER     \"$my_user\"";
      } elsif ( $line =~ /^#define MYSQL_READ_PASSWD/ ) {
         $line = "#define MYSQL_READ_PASSWD   \"$my_pass\"";
      };
   };
   write_file("vmysql.h", @lines);
};



On Tuesday, February 25, 2003, at 10:14 AM, Andre Fortin wrote:

This sounds like a good idea to me.. I'd like to see this in the future.


Andre


-----Original Message-----
From: Robin Bowes [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 25, 2003 10:13 AM
To: [EMAIL PROTECTED]
Subject: Re: [vchkpw] Configure options for MySQL support?


David,


On Tue, February 25, 2003 2:13 pm, David Richardson said:

I don't plan on changing my MySQL params very often, but I'm _certain_
that I'll forget to update vmysql.h during a recompile and I'll foobar my
Vpopmail.

Can you guess what bit me resulting in my raising this as an issue?!!


Perhaps we could just cobble together a helper perl script to query for
and rewrite the vmysql.h params as part of the compile script(s) you use.

That's another possibility...


Without a lot of other "me too" votes, is there interest from the vpopmail
team in having this idea go a particular direction (into config/make or
external perl)? Is this even the appropriate venue to ask???

Let's wait and see...


R.
--
Robin Bowes | http://robinbowes.com







Reply via email to