From 0df1dc6aaffb620c6bfde464248a3a4b64034daf Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Wed, 6 Mar 2002 20:41:36 +0000
Subject: [PATCH] This simple patch fixes broken Makefile, broken ApplySnapshot
 and makes all utilities honour --verbose command line option.

--
Yours, Alexey V. Borzov, Webmaster of RDW.ru
---
 contrib/rserv/ApplySnapshot.in   | 4 +++-
 contrib/rserv/CleanLog.in        | 2 ++
 contrib/rserv/GetSyncID.in       | 2 ++
 contrib/rserv/Makefile           | 4 ++--
 contrib/rserv/MasterSync.in      | 2 ++
 contrib/rserv/PrepareSnapshot.in | 2 ++
 contrib/rserv/Replicate.in       | 2 ++
 7 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/contrib/rserv/ApplySnapshot.in b/contrib/rserv/ApplySnapshot.in
index a3b79e19eea..695605f139b 100644
--- a/contrib/rserv/ApplySnapshot.in
+++ b/contrib/rserv/ApplySnapshot.in
@@ -32,11 +32,13 @@ $sinfo = "$sinfo host=$opt_host" if (defined($opt_host));
 $sinfo = "$sinfo user=$opt_user" if (defined($opt_user));
 $sinfo = "$sinfo password=$opt_password" if (defined($opt_password));
 
-my $conn = Pg::connectdb(sinfo);
+my $conn = Pg::connectdb($sinfo);
 
 my $inpf = new IO::File;
 $inpf = STDIN;
 
+$RServ::quiet = !$verbose;
+
 $res = ApplySnapshot ($conn, $inpf);
 
 if ($res > 0)
diff --git a/contrib/rserv/CleanLog.in b/contrib/rserv/CleanLog.in
index 6fa1253de2d..f15baea0b18 100644
--- a/contrib/rserv/CleanLog.in
+++ b/contrib/rserv/CleanLog.in
@@ -38,6 +38,8 @@ print "Slave connection is $sinfo\n" if ($debug);
 
 my $conn = Pg::connectdb($minfo);
 
+$RServ::quiet = !$verbose;
+
 $res = CleanLog($conn, $howold);
 
 exit(1) if $res < 0;
diff --git a/contrib/rserv/GetSyncID.in b/contrib/rserv/GetSyncID.in
index d5b0755a2ea..10f4a93e47b 100644
--- a/contrib/rserv/GetSyncID.in
+++ b/contrib/rserv/GetSyncID.in
@@ -37,6 +37,8 @@ $sinfo = "$sinfo password=$opt_password" if (defined($opt_password));
 print("Connecting to '$sinfo'\n") if ($debug || $verbose);
 my $conn = Pg::connectdb($sinfo);
 
+$RServ::quiet = !$verbose;
+
 $res = GetSyncID($conn);
 
 die "ERROR\n" if $res < 0;
diff --git a/contrib/rserv/Makefile b/contrib/rserv/Makefile
index 27251197466..7a4cf72a57d 100644
--- a/contrib/rserv/Makefile
+++ b/contrib/rserv/Makefile
@@ -22,10 +22,10 @@ override DLLLIBS := $(BE_DLLLIBS) $(DLLLIBS)
 all: $(SQLS) $(TCLS) $(PERLS) $(SCRIPTS) $(SONAME)
 
 %.sql: %.sql.in
-	sed 's,@MODULE_FILENAME@,$$libdir/$(NAME),g' $< >$@
+	sed 's,@MODULE_FILENAME@,$(pkglibdir)/$(SONAME),g' $< >$@
 
 $(PERLS) $(TCLS) $(SCRIPTS): %: %.in
-	sed -e 's,@MODULE_FILENAME@,$$libdir/$(NAME),g' \
+	sed -e 's,@MODULE_FILENAME@,$(pkglibdir)/$(SONAME),g' \
 	    -e 's:@SQLDIR@:$(datadir)/contrib:g' \
 	    -e 's:@BINDIR@:$(bindir):g' \
 	    -e 's:@LIBDIR@:$(datadir)/contrib:g' $< >$@
diff --git a/contrib/rserv/MasterSync.in b/contrib/rserv/MasterSync.in
index abbe69ee0bf..8328d78cc1d 100644
--- a/contrib/rserv/MasterSync.in
+++ b/contrib/rserv/MasterSync.in
@@ -36,6 +36,8 @@ $minfo = "$minfo password=$opt_password" if (defined($opt_password));
 
 my $conn = Pg::connectdb($minfo);
 
+$RServ::quiet = !$verbose;
+
 $res = SyncSyncID($conn, $server, $syncid);
 
 if ($res == 0)
diff --git a/contrib/rserv/PrepareSnapshot.in b/contrib/rserv/PrepareSnapshot.in
index fe57ab949cc..bd0fa237dc6 100644
--- a/contrib/rserv/PrepareSnapshot.in
+++ b/contrib/rserv/PrepareSnapshot.in
@@ -39,6 +39,8 @@ my $conn = Pg::connectdb($minfo);
 my $outf = new IO::File;
 $outf = STDOUT;
 
+$RServ::quiet = !$verbose;
+
 $res = PrepareSnapshot ($conn, $outf, $server);
 
 if ($res == 0)
diff --git a/contrib/rserv/Replicate.in b/contrib/rserv/Replicate.in
index ccb9749b930..bd7c089a597 100644
--- a/contrib/rserv/Replicate.in
+++ b/contrib/rserv/Replicate.in
@@ -49,6 +49,8 @@ print "Slave connection is $sinfo\n" if ($debug);
 my $mconn = Pg::connectdb($minfo);
 my $sconn = Pg::connectdb($sinfo);
 
+$RServ::quiet = !$verbose;
+
 SyncSync($mconn, $sconn);
 
 my $outf = new IO::File;
-- 
GitLab