Make netlink support build-conditional

This commit is contained in:
Petr Písař 2017-07-04 15:17:52 +02:00
parent 070965ce07
commit ca339568be

View File

@ -1,5 +1,7 @@
# Allow setting quota remotely by default
%bcond_without rpcsetquota
# Use netlink to monitor quota usage and warn interractive users
%bcond_without quota_enables_netlink
# Allow setting quota remotely
%bcond_without quota_enables_rpcsetquota
Name: quota
Epoch: 1
@ -86,9 +88,11 @@ BuildRequires: gettext-devel
BuildRequires: glibc-common
BuildRequires: make
BuildRequires: openldap-devel
%if %{with quota_enables_netlink}
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(libnl-3.0) >= 3.1
BuildRequires: pkgconfig(libnl-genl-3.0)
%endif
BuildRequires: systemd
BuildRequires: tcp_wrappers-devel
Requires: tcp_wrappers
@ -100,6 +104,7 @@ The quota package contains system administration tools for monitoring
and limiting user and or group disk usage per file system.
%if %{with quota_enables_netlink}
%package nld
Group: System Environment/Daemons
Summary: quota_nld daemon
@ -114,6 +119,7 @@ Note, that you have to enable the kernel support for sending quota messages
over netlink (in Filesystems->Quota menu). The daemon supports forwarding
warning messages to the system D-Bus (so that desktop manager can display
a dialog) and writing them to the terminal user has last accessed.
%endif
%package rpc
@ -211,10 +217,15 @@ autoreconf -f -i
--enable-ext2direct=yes \
--enable-ldapmail=yes \
--enable-libwrap=yes \
%if %{with quota_enables_netlink}
--enable-netlink=yes \
%else
--disable-netlink \
%endif
--enable-nls \
--disable-rpath \
%if %{with rpcsetquota}
--enable-rpc=yes \
%if %{with quota_enables_rpcsetquota}
--enable-rpcsetquota=yes \
%else
--disable-rpcsetquota \
@ -228,9 +239,11 @@ make
make install DESTDIR=%{buildroot}
rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name}
%if %{with quota_enables_netlink}
install -p -m644 -D %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/quota_nld.service
install -p -m644 -D %{SOURCE2} \
$RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/quota_nld
%endif
install -p -m644 -D %{SOURCE3} $RPM_BUILD_ROOT%{_unitdir}/rpc-rquotad.service
install -p -m644 -D %{SOURCE4} \
$RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/rpc-rquotad
@ -242,6 +255,7 @@ install -p -m644 -D %{SOURCE4} \
make check
%if %{with quota_enables_netlink}
%post nld
%systemd_post quota_nld.service
@ -250,6 +264,7 @@ make check
%postun nld
%systemd_postun_with_restart quota_nld.service
%endif
%post rpc
@ -275,12 +290,14 @@ make check
%exclude %{_mandir}/man8/warnquota.8*
%doc Changelog
%if %{with quota_enables_netlink}
%files nld
%config(noreplace) %{_sysconfdir}/sysconfig/quota_nld
%{_unitdir}/quota_nld.service
%{_sbindir}/quota_nld
%{_mandir}/man8/quota_nld.8*
%doc Changelog
%endif
%files rpc
%config(noreplace) %{_sysconfdir}/sysconfig/rpc-rquotad