blob: ad24e633399612e9947fbfc2c90f229f027b7607 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
Name: postgresql-common
Version: %{version}
Release: 1%{?dist}
BuildArch: noarch
Summary: PostgreSQL database-cluster manager
Packager: Debian PostgreSQL Maintainers <pkg-postgresql-public@lists.alioth.debian.org>
License: GPLv2+
URL: https://packages.debian.org/sid/%{name}
Source0: http://ftp.debian.org/debian/pool/main/p/%{name}/%{name}_%{version}.tar.xz
Requires: postgresql-client-common
%description
The postgresql-common package provides a structure under which
multiple versions of PostgreSQL may be installed and/or multiple
clusters maintained at one time.
%package -n postgresql-client-common
Summary: manager for multiple PostgreSQL client versions
%description -n postgresql-client-common
The postgresql-client-common package provides a structure under which
multiple versions of PostgreSQL client programs may be installed at
the same time. It provides a wrapper which selects the right version
for the particular cluster you want to access (with a command line
option, an environment variable, /etc/postgresql-common/user_clusters,
or ~/.postgresqlrc).
%prep
# unpack tarball, ignoring the name of the top level directory inside
%setup -c
mv */* .
%build
make
%install
rm -rf %{buildroot}
# install in subpackages using the Debian files
for inst in debian/*.install; do
pkg=$(basename $inst .install)
[ "$pkg" = "postgresql-server-dev-all" ] && continue
echo "### Reading $pkg files list from $inst ###"
while read file dir; do
mkdir -p %{buildroot}/$dir
cp -r $file %{buildroot}/$dir
echo "/$dir/${file##*/}" >> files-$pkg
done < $inst
done
# install manpages
for manpages in debian/*.manpages; do
pkg=$(basename $manpages .manpages)
[ "$pkg" = "postgresql-server-dev-all" ] && continue
echo "### Reading $pkg manpages list from $manpages ###"
while read file; do
section="${file##*.}"
mandir="%{buildroot}%{_mandir}/man$section"
mkdir -p $mandir
for f in $file; do # expand wildcards
cp $f $mandir
echo "%doc %{_mandir}/man$section/$(basename $f).gz" >> files-$pkg
done
done < $manpages
done
# install pg_wrapper symlinks by augmenting the existing pgdg.rpm alternatives
while read dest link; do
name="pgsql-$(basename $link)"
echo "update-alternatives --install /$link $name /$dest 9999" >> postgresql-client-common.post
echo "update-alternatives --remove $name /$dest" >> postgresql-client-common.preun
done < debian/postgresql-client-common.links
# activate rpm-specific tweaks
sed -i -e 's/#redhat# //' \
%{buildroot}/usr/bin/pg_config \
%{buildroot}/usr/bin/pg_virtualenv \
%{buildroot}/usr/share/perl5/PgCommon.pm \
%{buildroot}/usr/share/postgresql-common/init.d-functions
# install init script
mkdir -p %{buildroot}/etc/init.d %{buildroot}/etc/logrotate.d
cp debian/postgresql-common.postgresql.init %{buildroot}/etc/init.d/postgresql
#cp debian/postgresql-common.postinst %{buildroot}/usr/share/postgresql-common
cp rpm/init-functions-compat %{buildroot}/usr/share/postgresql-common
# ssl defaults to 'off' here because we don't have pregenerated snakeoil certs
sed -e 's/__SSL__/off/' createcluster.conf > %{buildroot}/etc/postgresql-common/createcluster.conf
cp debian/postgresql-common.logrotate %{buildroot}/etc/logrotate.d/postgresql-common
%if 0%{?rhel} >= 7
# Prepare systemd unit files, but only for RHEL/CentOS 7 and above...
pushd systemd
DESTDIR=%{buildroot} gmake install
sed -i -e 's/#redhat# //' %{buildroot}/lib/systemd/system-generators/postgresql-generator
popd
%endif
%files -n postgresql-common -f files-postgresql-common
%attr(0755, root, root) %config /etc/init.d/postgresql
#%attr(0755, root, root) /usr/share/postgresql-common/postgresql-common.postinst
/usr/share/postgresql-common/init-functions-compat
%config /etc/postgresql-common/createcluster.conf
%config /etc/logrotate.d/postgresql-common
%if 0%{?rhel} >= 7
%config /lib/systemd/system/postgresql.service
%config /lib/systemd/system/postgresql@.service
%config /lib/systemd/system-generators/postgresql-generator
%endif
%files -n postgresql-client-common -f files-postgresql-client-common
%post
# create postgres user
groupadd -g 26 -o -r postgres >/dev/null 2>&1 || :
useradd -M -n -g postgres -o -r -d /var/lib/pgsql -s /bin/bash \
-c "PostgreSQL Server" -u 26 postgres >/dev/null 2>&1 || :
# create directories so postgres can create clusters without root
install -d -o postgres -g postgres /etc/postgresql /var/lib/postgresql /var/lib/pgsql /var/log/postgresql /var/run/postgresql
# install logrotate config
version_lt () {
newest=$( ( echo "$1"; echo "$2" ) | sort -V | tail -n1)
[ "$1" != "$newest" ]
}
lrversion=$(rpm --queryformat '%{VERSION}' -q logrotate)
if version_lt $lrversion 3.8; then
echo "Adjusting /etc/logrotate.d/postgresql-common for logrotate version $lrversion"
sed -i -e '/ su /d' /etc/logrotate.d/postgresql-common || :
fi
%post -n postgresql-client-common -f postgresql-client-common.post
update-alternatives --install /usr/bin/ecpg pgsql-ecpg /usr/share/postgresql-common/pg_wrapper 9999
%preun -n postgresql-client-common -f postgresql-client-common.preun
update-alternatives --remove pgsql-ecpg /usr/share/postgresql-common/pg_wrapper
%changelog
* Tue Sep 29 2020 Christoph Berg <myon@debian.org> 217-1
- Drop postgresql-server-dev-all package, it's debian-specific only.
* Fri Dec 09 2016 Bernd Helmle <bernd.helmle@credativ.de> 177-1
- New upstream release 177
* Fri Jun 03 2016 Bernd Helmle <bernd.helmle@credativ.de> 174-2
- Fix package dependencies and systemd integration
* Thu Aug 7 2014 Christoph Berg <christoph.berg@credativ.de> 160-1
- Omit the LD_PRELOAD logic in pg_wrapper
* Thu Jun 5 2014 Christoph Berg <christoph.berg@credativ.de> 158-1
- Initial specfile version
|