From: Kris Van Hees <kris.van.hees@oracle.com>
To: Nick Alcock <nick.alcock@oracle.com>
Cc: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com,
kris.van.hees@oracle.com
Subject: Re: [PATCH v2 8/9] build: make dtrace and dtprobed relocatable
Date: Fri, 2 Aug 2024 01:31:45 -0400 [thread overview]
Message-ID: <ZqxvQc6j0d5JNeLx@oracle.com> (raw)
In-Reply-To: <20240801132156.286780-9-nick.alcock@oracle.com>
On Thu, Aug 01, 2024 at 02:21:55PM +0100, Nick Alcock wrote:
> The majority of the complexity here involves figuring out what to
> do about the systemd service file. We presume that if the user
> is installing such that the service file lands inone of the two fixed
> locations systemd knows how to find persistent service files in, or
> if the user has explicitly passed --systemd-unit-dir to configure,
> it makes sense to install the systemd service file (because systemd
> will find it): otherwise, we avoid installing it and print a
> warning that the user must do so if dtprobed is to be properly
> started.
>
> Provide a new installation target, install-dtprobed-autostart, to do
> so.
>
> (Regardless, the service file is changed to substitute in the real
> installed path of dtprobed.)
>
> Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
> ---
> Maketargets | 3 ++
> cmd/Build | 4 +--
> dtprobed/Build | 36 ++++++++++++++-----
> .../{dtprobed.service => dtprobed.service.in} | 2 +-
> 4 files changed, 34 insertions(+), 11 deletions(-)
> rename dtprobed/{dtprobed.service => dtprobed.service.in} (95%)
>
> diff --git a/Maketargets b/Maketargets
> index 11ad9fed4dcf..5b4906a86d26 100644
> --- a/Maketargets
> +++ b/Maketargets
> @@ -14,6 +14,9 @@ help::
> @printf "dlibs Build translator files\n" >&2
> @printf "install Install (DESTDIR supported)\n" >&2
> @printf "install-test Install testsuite (DESTDIR supported)\n" >&2
> + @printf "install-dtprobed-autostart Install udev / systemd rules to start dtprobed" >&2
> + @printf " (done by make install unless prefix or sbindir" >&2
> + @printf " are changed)" >&2
> @printf "clean / realclean Clean up build tree\n" >&2
> @printf "TAGS / tags / gtags Make tags files\n" >&2
> @printf "\n" >&2
> diff --git a/cmd/Build b/cmd/Build
> index 55c622c19dc0..68800fbeb5fc 100644
> --- a/cmd/Build
> +++ b/cmd/Build
> @@ -1,5 +1,5 @@
> # Oracle Linux DTrace.
> -# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
> +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
> # Licensed under the Universal Permissive License v 1.0 as shown at
> # http://oss.oracle.com/licenses/upl.
>
> @@ -36,7 +36,7 @@ if [[ -z \$$_DTRACE_CHECK_INSTALLED ]]; then\n\
> export LD_LIBRARY_PATH=$(objdir)\n\
> dtrace_cmd=$(objdir)/dtrace\n\
> else\n\
> - dtrace_cmd=/usr/sbin/dtrace\n\
> + dtrace_cmd=$(SBINDIR)/dtrace\n\
> fi\n\
> \n\
> if [[ -n \$$DTRACE_GDB ]]; then\n\
> diff --git a/dtprobed/Build b/dtprobed/Build
> index 0f5d1c08aee8..9132c3e31c8a 100644
> --- a/dtprobed/Build
> +++ b/dtprobed/Build
> @@ -42,17 +42,13 @@ dtprobed.c_CFLAGS := -Wno-pedantic
> seccomp-assistance.c_CFLAGS := -fno-lto
> endif
>
> -install::
> - mkdir -p $(INSTSBINDIR)
> - $(call describe-install-target,$(INSTSBINDIR),dtprobed)
> - install -m 755 $(objdir)/dtprobed $(INSTSBINDIR)
> - mkdir -p $(INSTUDEVDIR)
> - $(call describe-install-target,$(INSTUDEVDIR),60-dtprobed.rules)
> - install -m 644 $(dtprobed_DIR)60-dtprobed.rules $(INSTUDEVDIR)
> +install-dtprobed-autostart::
> ifdef HAVE_LIBSYSTEMD
> mkdir -p $(INSTSYSTEMDUNITDIR) $(INSTSYSTEMDPRESETDIR)
> $(call describe-install-target,$(INSTSYSTEMDUNITDIR),dtprobed.service)
> - install -m 644 $(dtprobed_DIR)dtprobed.service $(INSTSYSTEMDUNITDIR)
> + sed 's,@SBINDIR@,$(SBINDIR),' < $(dtprobed_DIR)dtprobed.service.in > $(INSTSYSTEMDUNITDIR)/dtprobed.service
> + chown root:root $(INSTSYSTEMDUNITDIR)/dtprobed.service
> + chmod 0644 $(INSTSYSTEMDUNITDIR)/dtprobed.service
> $(call describe-install-target,$(INSTSYSTEMDUNITDIR),dtrace-usdt.target)
> install -m 644 $(dtprobed_DIR)dtrace-usdt.target $(INSTSYSTEMDUNITDIR)
> $(call describe-install-target,$(INSTSYSTEMDPRESETDIR),50-dtprobed.preset)
> @@ -61,3 +57,27 @@ ifdef HAVE_LIBSYSTEMD
> systemctl enable dtprobed.service dtrace-usdt.target; \
> fi
> endif
> +
> +install::
> + mkdir -p $(INSTSBINDIR)
> + $(call describe-install-target,$(INSTSBINDIR),dtprobed)
> + install -m 755 $(objdir)/dtprobed $(INSTSBINDIR)
> + mkdir -p $(INSTUDEVDIR)
> + $(call describe-install-target,$(INSTUDEVDIR),60-dtprobed.rules)
> + install -m 644 $(dtprobed_DIR)60-dtprobed.rules $(INSTUDEVDIR)
> + if [[ "$(SYSTEMDUNITDIR)" = /usr/lib/systemd/system ]] || \
> + [[ "$(SYSTEMDUNITDIR)" = /usr/local/lib/systemd/system ]] || \
> + [[ -n "$(filter SYSTEMDUNITDIR,$(CONFIGURED_VARS))" ]] ; then \
> + $(MAKE) install-dtprobed-autostart; \
> + else \
> + echo " === WARNING WARNING WARNING === " >&2; \
> + echo "systemd service files for dtprobed not installed." >&2; \
> + echo "USDT probes (and the testsuite) will not work unless this is" >&2; \
> + echo "done. Try make install-dtprobed-autostart, but this may not" >&2; \
> + echo "be enough: you may need to manually move the systemd service" >&2; \
> + echo "files somewhere udev and systemd will find them." >&2; \
> + echo "If there is already a running dtprobed, it may or may not work" >&2; \
> + echo "in conjunction with this DTrace." >&2; \
> + echo "Configure with --systemd-unit-dir to override this decision." >&2; \
> + echo " === WARNING WARNING WARNING === " >&2; \
> + fi
> diff --git a/dtprobed/dtprobed.service b/dtprobed/dtprobed.service.in
> similarity index 95%
> rename from dtprobed/dtprobed.service
> rename to dtprobed/dtprobed.service.in
> index 8e491fe28ad1..2e590701d03e 100644
> --- a/dtprobed/dtprobed.service
> +++ b/dtprobed/dtprobed.service.in
> @@ -12,7 +12,7 @@ Before=basic.target
>
> [Service]
> Type=notify
> -ExecStart=/usr/sbin/dtprobed -F
> +ExecStart=@SBINDIR@/dtprobed -F
> Restart=on-failure
> RestartPreventExitStatus=1
> ProtectSystem=strict
> --
> 2.46.0.277.ge12b8151ed
next prev parent reply other threads:[~2024-08-02 5:31 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-01 13:21 [PATCH v2 0/9] relocatable DTrace Nick Alcock
2024-08-01 13:21 ` [PATCH v2 1/9] spec: install sdt*.h in /usr/lib64/dtrace/include/sys Nick Alcock
2024-08-02 5:23 ` Kris Van Hees
2024-08-01 13:21 ` [PATCH v2 2/9] build: initial pkg-config support Nick Alcock
2024-08-02 5:24 ` Kris Van Hees
2024-08-01 13:21 ` [PATCH v2 3/9] build: track configured vars Nick Alcock
2024-08-02 5:28 ` Kris Van Hees
2024-08-01 13:21 ` [PATCH v2 4/9] build: --bindir is supposed to be equivalent to --sbindir Nick Alcock
2024-08-02 5:28 ` Kris Van Hees
2024-08-01 13:21 ` [PATCH v2 5/9] build: the TESTDIR is relative to the LIBDIR by default Nick Alcock
2024-08-02 5:29 ` Kris Van Hees
2024-08-01 13:21 ` [PATCH v2 6/9] build: add a pkg-config file for dtrace consumers: use it Nick Alcock
2024-08-02 5:30 ` Kris Van Hees
2024-08-01 13:21 ` [PATCH v2 7/9] runtest: remove obsolete kernel coverage data collection Nick Alcock
2024-08-02 5:31 ` Kris Van Hees
2024-08-01 13:21 ` [PATCH v2 8/9] build: make dtrace and dtprobed relocatable Nick Alcock
2024-08-02 5:31 ` Kris Van Hees [this message]
2024-08-01 13:21 ` [PATCH v2 9/9] test: work when relocated Nick Alcock
2024-08-02 5:32 ` Kris Van Hees
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=ZqxvQc6j0d5JNeLx@oracle.com \
--to=kris.van.hees@oracle.com \
--cc=dtrace-devel@oss.oracle.com \
--cc=dtrace@lists.linux.dev \
--cc=nick.alcock@oracle.com \
/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