-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathiplike.spec.in
102 lines (74 loc) · 2.46 KB
/
iplike.spec.in
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
%{!?rel:%define rel @RELEASE@%{?dist}}
%{!?ver:%define ver @VERSION@}
%{!?pkgname:%define pkgname @PACKAGE@-pgsql@PG_TYPE_VERSION@}
%{!?postgresql_dev:%define postgresql_dev postgresql-devel}
%define srcdir @PACKAGE@-%{ver}
%define install_iplike install_iplike-@PG_TYPE_VERSION@.sh
Name: %{pkgname}
Version: %{ver}
Release: %{rel}
License: GPL
Group: Applications/Databases
Summary: PostgreSQL complex IP Address text field query
Source: %{srcdir}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: %{postgresql_dev}, gcc, make
Requires: sudo
Provides: iplike = %{version}-%{release}
%description
PostgreSQL function for doing complex IP address queries
on a text field.
%prep
%setup -n %{srcdir}
%build
export PG_PLUGINDIR="%{_libdir}/iplike/@PG_API_VERSION@"
%configure
make
%install
make install DESTDIR="$RPM_BUILD_ROOT"
mv "%{buildroot}%{_sbindir}/install_iplike.sh" "%{buildroot}%{_sbindir}/%{install_iplike}"
%post
if [ -z "$SKIP_IPLIKE_INSTALL" ]; then
FAILED=0
echo -e "- installing iplike into the opennms db (if it exists)... \c"
if %{_sbindir}/%{install_iplike} -s postgres -d opennms >>/tmp/install_iplike.log 2>&1; then
echo "OK"
else
echo "failed"
# FAILED=1
fi
if [ $FAILED -eq 1 ]; then
cat <<END
!!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!!
Failed to install iplike into the opennms database.
See /tmp/install_iplike.log for details.
To install iplike into your database, use the %{_sbindir}/%{install_iplike}
script. See \`%{install_iplike} -h\` for more details.
END
exit 0
fi
fi
if [ -x /usr/sbin/update-alternatives ]; then
/usr/sbin/update-alternatives --install "%{_sbindir}/install_iplike.sh" "install_iplike.sh" "%{_sbindir}/install_iplike-@PG_TYPE_VERSION@.sh" "@PG_MAJOR_VERSION@"
fi
exit 0
%preun
if [ -x /usr/sbin/update-alternatives ]; then
/usr/sbin/update-alternatives --remove "install_iplike.sh" "%{_sbindir}/install_iplike-@PG_TYPE_VERSION@.sh"
fi
%clean
if [ "$RPM_BUILD_ROOT" != "/" ]; then
rm -rf "$RPM_BUILD_ROOT"
fi
%files
%attr(755,root,root) %{_libdir}/iplike/@PG_API_VERSION@
%attr(755,root,root) %{_sbindir}/%{install_iplike}
%changelog
* Wed Oct 23 2019 Benjamin Reed <ranger@opennms.org>
- convert to support multi-postgresql builds
* Mon Jun 18 2007 Benjamin Reed <ranger@opennms.org>
- add RPM build to the autotools stuff
- add postinstall to insert iplike into template1
- many other RPM-related fixes
* Wed Jun 13 2007 Benjamin Reed <ranger@opennms.org>
- initial package