--- repmgr.spec-orig	2014-03-20 16:50:25.214990304 -0300
+++ repmgr.spec	2014-03-20 17:03:04.370999108 -0300
@@ -1,19 +1,19 @@
-%global pgmajorversion 91
-%global pginstdir /usr/pgsql-9.1
+%global pgmajorversion 9.1
+%define pgpackageversion 91
+%global pginstdir /usr/pgsql-%{pgmajorversion}
 
 Name:           repmgr
 Version:        2.0
-Release:        1%{?dist}
+Release:        1PGDG%{?dist}
 Summary:        Replication Manager for	PostgreSQL Clusters
 Group:		Applications/Databases
 License:        GPLv3
 URL:            http://www.repmgr.org
 Source0:        http://repmgr.org/download/%{name}-%{version}.tar.gz
-Patch0:		repmgr-makefile-pgxs.patch
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
-BuildRequires:  postgresql%{pgmajorversion}
-Requires:       postgresql%{pgmajorversion}-server
+BuildRequires:  postgresql%{pgpackageversion}
+Requires:       postgresql%{pgpackageversion}-server rsync openssh
 
 %description
 repmgr is a set of open source tools that helps DBAs and System 
@@ -31,18 +31,20 @@
 
 %prep
 %setup -q
-%patch0 -p0
 
 %build
+PATH="${PATH}:%{pginstdir}/bin/" ; export PATH
 USE_PGXS=1 make %{?_smp_mflags}
 
 %install
 rm -rf %{buildroot}
 %{__mkdir} -p %{buildroot}/%{pginstdir}/bin/
+PATH="${PATH}:%{pginstdir}/bin/" ; export PATH
 USE_PGXS=1 make install DESTDIR=%{buildroot}
 #mv repmgr %{buildroot}/%{pginstdir}/bin/
 
 %clean
+PATH="${PATH}:%{pginstdir}/bin/" ; export PATH
 make USE_PGXS=1 clean
 
 %files
