public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] config: Rely on systemd_requires for sysctl_apply default-yama-scope.
@ 2017-11-08 10:41 Mark Wielaard
  0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2017-11-08 10:41 UTC (permalink / raw)
  To: elfutils-devel; +Cc: Mark Wielaard

We try to run %sysctl_apply in %post. But that will only work if the
systemd requires are there. Also since there is a circular dependency
(systemd -> elfutils-libs -> default-yama-scope -> systemd) we need
to double check that systemd-sysctl has already been installed before
calling it.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 config/ChangeLog        | 5 +++++
 config/elfutils.spec.in | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/config/ChangeLog b/config/ChangeLog
index ae40cc0..83263bd 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,8 @@
+2017-11-08  Mark Wielaard  <mark@klomp.org>
+
+	* elfutils.spec.in: Add systemd_requires.
+	Check systemd-sysctl exists.
+
 2017-11-02  Mark Wielaard  <mark@klomp.org>
 
 	* elfutils.spec.in: Config files under /usr/lib/sysctl.d (_sysctldir)
diff --git a/config/elfutils.spec.in b/config/elfutils.spec.in
index 1d0a4f8..21a18b2 100644
--- a/config/elfutils.spec.in
+++ b/config/elfutils.spec.in
@@ -107,6 +107,9 @@ Group: Development/Tools
 License: GPLv2+ or LGPLv3+
 Provides: default-yama-scope
 BuildArch: noarch
+# For the sysctl_apply macro
+%{?systemd_requires}
+BuildRequires: systemd >= 215
 
 %description default-yama-scope
 Yama sysctl setting to enable default attach scope settings
@@ -157,7 +160,11 @@ rm -rf ${RPM_BUILD_ROOT}
 %postun libelf -p /sbin/ldconfig
 
 %post default-yama-scope
+# Due to circular dependencies might not be installed yet, so double check.
+# (systemd -> elfutils-libs -> default-yama-scope -> systemd)
+if [ -x /usr/lib/systemd/systemd-sysctl ] ; then
 %sysctl_apply 10-default-yama-scope.conf
+fi
 
 %files
 %defattr(-,root,root)
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-11-08 10:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-08 10:41 [PATCH] config: Rely on systemd_requires for sysctl_apply default-yama-scope Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).