summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2024-09-12 01:06:23 +0100
committerSam James <sam@gentoo.org>2024-09-12 01:06:31 +0100
commit0b93226603134a169a41d1ae2213688167bd2b2c (patch)
treeeaa26cf18decc079150c15e426657d4c786a34d0 /dev-debug
parentapp-emacs/magit: Stabilize 4.0.0 ALLARCHES, #939491 (diff)
downloadgentoo-0b93226603134a169a41d1ae2213688167bd2b2c.tar.gz
gentoo-0b93226603134a169a41d1ae2213688167bd2b2c.tar.bz2
gentoo-0b93226603134a169a41d1ae2213688167bd2b2c.zip
dev-debug/dtrace: rework pkg_postinst
For first installs, we enable the service and start it. This is unusual, but the behaviour without dtprobed running is untested/unsupported. It's not a network service, it has no configuration, reads a single device node, and does all parsing within a seccomp jail. It also leads to hard-to-diagnose issues because USDT probes won't be registered and an application might have already started up which needs to be traced. Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-debug')
-rw-r--r--dev-debug/dtrace/dtrace-2.0.1.1-r2.ebuild42
-rw-r--r--dev-debug/dtrace/dtrace-9999.ebuild42
2 files changed, 70 insertions, 14 deletions
diff --git a/dev-debug/dtrace/dtrace-2.0.1.1-r2.ebuild b/dev-debug/dtrace/dtrace-2.0.1.1-r2.ebuild
index 413cba677aed..3032bf884998 100644
--- a/dev-debug/dtrace/dtrace-2.0.1.1-r2.ebuild
+++ b/dev-debug/dtrace/dtrace-2.0.1.1-r2.ebuild
@@ -171,26 +171,54 @@ pkg_postinst() {
# We need a udev reload to pick up the CUSE device node rules.
udev_reload
- # TODO: Restart it on upgrade? (it will carry across its own persistent state)
+ # TODO: One option for this is to detect when it's needed (DOF stash layout changes)
+ # and then e.g. sleep and restart for the user.
if [[ -n ${REPLACING_VERSIONS} ]]; then
# TODO: Make this more intelligent wrt comparison
if systemd_is_booted ; then
- einfo "Restart the DTrace 'dtprobed' service after upgrades:"
+ einfo "Restart the DTrace 'dtprobed' service after upgrades"
+ einfo "once all dtraces are stopped with:"
einfo " systemctl try-restart dtprobed"
else
- einfo "Restart the DTrace 'dtprobed' service with:"
+ einfo "Restart the DTrace 'dtprobed' service after upgrades"
+ einfo "once all dtraces are stopped with:"
einfo " /etc/init.d/dtprobed restart"
fi
else
einfo "See https://wiki.gentoo.org/wiki/DTrace for getting started."
- if systemd_is_booted ; then
- einfo "Enable and start the DTrace 'dtprobed' service with:"
+ # We can't do magic for people with ROOT=.
+ if [[ -n ${ROOT} ]] ; then
+ einfo "Enable and start the DTrace 'dtprobed' service for systemd with:"
einfo " systemctl enable --now dtprobed"
- else
- einfo "Enable and start the DTrace 'dtprobed' service with:"
+ einfo
+ einfo "Enable and start the DTrace 'dtprobed' service for OpenRC with:"
einfo " rc-update add dtprobed"
einfo " /etc/init.d/dtprobed start"
+ return
+ fi
+
+ # For first installs, we enable the service and start it.
+ #
+ # This is unusual, but the behaviour without dtprobed running
+ # is untested/unsupported. It's not a network service, it
+ # has no configuration, reads a single device node, and
+ # does all parsing within a seccomp jail. It also leads
+ # to hard-to-diagnose issues because USDT probes won't
+ # be registered and an application might have already
+ # started up which needs to be traced.
+ if systemd_is_booted ; then
+ ebegin "Enabling & starting DTrace 'dtprobed' service"
+ systemctl enable --now dtprobed
+ eend $?
+ else
+ ebegin "Enabling DTrace 'dtprobed' service"
+ rc-update add dtprobed
+ eend $?
+
+ ebegin "Starting DTrace 'dtprobed' service"
+ rc-service start dtprobed
+ eend $?
fi
fi
}
diff --git a/dev-debug/dtrace/dtrace-9999.ebuild b/dev-debug/dtrace/dtrace-9999.ebuild
index 1b544c426da4..9eb7d366c037 100644
--- a/dev-debug/dtrace/dtrace-9999.ebuild
+++ b/dev-debug/dtrace/dtrace-9999.ebuild
@@ -171,26 +171,54 @@ pkg_postinst() {
# We need a udev reload to pick up the CUSE device node rules.
udev_reload
- # TODO: Restart it on upgrade? (it will carry across its own persistent state)
+ # TODO: One option for this is to detect when it's needed (DOF stash layout changes)
+ # and then e.g. sleep and restart for the user.
if [[ -n ${REPLACING_VERSIONS} ]]; then
# TODO: Make this more intelligent wrt comparison
if systemd_is_booted ; then
- einfo "Restart the DTrace 'dtprobed' service after upgrades:"
+ einfo "Restart the DTrace 'dtprobed' service after upgrades"
+ einfo "once all dtraces are stopped with:"
einfo " systemctl try-restart dtprobed"
else
- einfo "Restart the DTrace 'dtprobed' service with:"
+ einfo "Restart the DTrace 'dtprobed' service after upgrades"
+ einfo "once all dtraces are stopped with:"
einfo " /etc/init.d/dtprobed restart"
fi
else
einfo "See https://wiki.gentoo.org/wiki/DTrace for getting started."
- if systemd_is_booted ; then
- einfo "Enable and start the DTrace 'dtprobed' service with:"
+ # We can't do magic for people with ROOT=.
+ if [[ -n ${ROOT} ]] ; then
+ einfo "Enable and start the DTrace 'dtprobed' service for systemd with:"
einfo " systemctl enable --now dtprobed"
- else
- einfo "Enable and start the DTrace 'dtprobed' service with:"
+ einfo
+ einfo "Enable and start the DTrace 'dtprobed' service for OpenRC with:"
einfo " rc-update add dtprobed"
einfo " /etc/init.d/dtprobed start"
+ return
+ fi
+
+ # For first installs, we enable the service and start it.
+ #
+ # This is unusual, but the behaviour without dtprobed running
+ # is untested/unsupported. It's not a network service, it
+ # has no configuration, reads a single device node, and
+ # does all parsing within a seccomp jail. It also leads
+ # to hard-to-diagnose issues because USDT probes won't
+ # be registered and an application might have already
+ # started up which needs to be traced.
+ if systemd_is_booted ; then
+ ebegin "Enabling & starting DTrace 'dtprobed' service"
+ systemctl enable --now dtprobed
+ eend $?
+ else
+ ebegin "Enabling DTrace 'dtprobed' service"
+ rc-update add dtprobed
+ eend $?
+
+ ebegin "Starting DTrace 'dtprobed' service"
+ rc-service start dtprobed
+ eend $?
fi
fi
}