public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [PATCH] config: Rely on systemd_requires for sysctl_apply default-yama-scope.
Date: Wed, 08 Nov 2017 10:41:00 -0000	[thread overview]
Message-ID: <1510137704-10105-1-git-send-email-mark@klomp.org> (raw)

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

                 reply	other threads:[~2017-11-08 10:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1510137704-10105-1-git-send-email-mark@klomp.org \
    --to=mark@klomp.org \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).