[vhffs-dev] [448] Added hostname choice

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 448
Author:   gradator
Date:     2007-02-15 20:15:22 +0000 (Thu, 15 Feb 2007)

Log Message:
-----------
Added hostname choice

Modified Paths:
--------------
    branches/vhffs_4.1/vhffs-compat/updatedb.pl


Modified: branches/vhffs_4.1/vhffs-compat/updatedb.pl
===================================================================
--- branches/vhffs_4.1/vhffs-compat/updatedb.pl	2007-02-15 17:25:35 UTC (rev 447)
+++ branches/vhffs_4.1/vhffs-compat/updatedb.pl	2007-02-15 20:15:22 UTC (rev 448)
@@ -88,15 +88,17 @@
     exit(-1);
 }
 
-my ($dbname, $dbuser, $dbpass);
+my ($dbhost, $dbname, $dbuser, $dbpass);
 
+print 'Enter VHFFS DB hostname : ';
+chomp($dbhost = <STDIN>);
 print 'Enter VHFFS DB name : ';
 chomp($dbname = <STDIN>);
 print 'Enter VHFFS DB username : ';
 chomp($dbuser = <STDIN>);
 $dbpass = read_password('Enter VHFFS DB password : ');
 
-my $dbh = DBI->connect("DBI:Pg:dbname=$dbname;host=localhost;port=5432",$dbuser, $dbpass);
+my $dbh = DBI->connect("DBI:Pg:dbname=$dbname;host=$dbhost;port=5432",$dbuser, $dbpass);
 if(!$dbh) {
     die "Cant connect to VHFFS DB\n";
 }
@@ -104,6 +106,7 @@
 # psql and pg_dump will not ask for a password using this
 my $pgpass = new File::Temp(DIR => '/tmp');
 print $pgpass "*:*:$dbname:$dbuser:$dbpass"; 
+$ENV{'PGHOST'} = $dbhost;
 $ENV{'PGDATABASE'} = $dbname;
 $ENV{'PGUSER'} = $dbuser;
 $ENV{'PGPASSFILE'} = $pgpass->filename;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/