Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

specfile fix for EPEL users of zabbix #8

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions rpmbuild/libzbxpgsql.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Name : libzbxpgsql
Vendor : cavaliercoder
Version : 1.1.0
Release : 1
Release : 2
Summary : PostgreSQL monitoring module for Zabbix

Group : Applications/Internet
Expand All @@ -10,6 +10,7 @@ URL : https://github.com/cavaliercoder/libzbxpgsql

# Zabbix sources (Customized)
Source0 : %{name}-%{version}.tar.gz
Source1 : query.conf

Buildroot : %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

Expand All @@ -32,12 +33,33 @@ libzbxpgsql is a comprehensive PostgreSQL discovery and monitoring module for th
# Extract and configure sources into $RPM_BUILD_ROOT
%setup0 -q -n %{name}-%{version}

err=0

if ! type -p pg_config && [[ -z "$PG_CONFIG" ]] ; then
echo >&2 "pg_config must be in your path or set in $PG_CONFIG"
err=1
fi

if ! test -d /usr/src/zabbix/include ; then
if [[ -z "$ZABBIX_SOURCE" ]] || ! test -d "$ZABBIX_SOURCE" ;then
echo >&2 "set ZABBIX_SOURCE to the location where we can find zabbix .h files (eg /usr/src/zabbix)"
err=1
fi
fi

[[ $err = 0 ]] || exit $err

test -f configure || ./autogen.sh

# fix up some lib64 issues
sed -i.orig -e 's|_LIBDIR=/usr/lib|_LIBDIR=%{_libdir}|g' configure

# fix up errant documentation in config file (easier than patching)
sed -i.orig -e 's|pg_query\.|pg.query.|' conf/libzbxpgsql.conf

%build
# Configure and compile sources into $RPM_BUILD_ROOT
%configure --enable-dependency-tracking
%configure --enable-dependency-tracking --with-zabbix="$ZABBIX_SOURCE"
make %{?_smp_mflags}

%install
Expand All @@ -54,7 +76,7 @@ mv $RPM_BUILD_ROOT%{_libdir}/%{name}.so $RPM_BUILD_ROOT%{moddir}/modules/%{name}
install -dm 755 $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_agentd.d
echo "LoadModule=libzbxpgsql.so" > $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_agentd.d/%{name}.conf
install -dm 755 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d
install -m 644 query.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/
install -m 644 %{S:1} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/

%clean
# Clean out the build root
Expand All @@ -66,6 +88,11 @@ rm -rf $RPM_BUILD_ROOT
%{_sysconfdir}/%{name}.d/query.conf

%changelog
* Wed Mar 17 2021 Otheus <[email protected]> 1.1.0-2
- Check for Zabbix source directory and pg_config variables
- Require query.conf to be in source tree. It's not clear which
directory this file should be pulled from, since a spec file
should define all sources within itself.
* Sat Aug 20 2016 Ryan Armstrong <[email protected]> 1.1.0-1
- Added configuration file for long custom queries - Rob Brucks

Expand Down