summaryrefslogtreecommitdiffstats
path: root/packaging
diff options
context:
space:
mode:
authorAustin S. Hemmelgarn <austin@netdata.cloud>2022-10-17 08:25:25 -0400
committerGitHub <noreply@github.com>2022-10-17 08:25:25 -0400
commitf4a4918cc9aef526cb02eec1e3629c148c2af06b (patch)
tree3ba8df8c6165ddff9cb706ff6b8c31c5b96e854d /packaging
parentdf38c0c2c4336d2d6fdac471fc0f2f6c3db6531c (diff)
Further improvements to the new service installation code. (#13774)
* Improve OpenRC detection. - Check for rc-update command, without that we don’t work so it’s ‘not OpenRC’. - Sort checks so that less expensive ones run first. - If we see `/etc/init.d/local` and it’s got a shebang line with `openrc-run`, then assume we’re dealing with OpenRC. This file gets installed by default as part of OpenRC itself. * Fix runit detection. - `/lib/rc/sv.d` is only used on some runit systems (notably Artix), not all, so don’t bail if we can’t find it. - Check not just for a `runit` command, but also `runsvdir`. * Add support for systemd in WSL. THis just involves running the normal systemd check if we detected WSL, and updating the service manager type appropriately. * Fix tmpdir handling for service installation. * Fix invocation of service install script. * Add fallback to detected but not running service managers. Currently supported for systemd and OpenRC. If no other service manager is detected, but we detected that either systemd or OpenRC is present but not running, fall back to them instead of outright failing. This does not allow starting/stopping the agent using the service manager, but _does_ happen to work for installing the service properly on an offline system. * Fix service-type fallback handling. If we see systemd, even if it not booted into it, we should not install init.d or LSB init scripts. * Fix recursion bug in initd install type checking. * Skip initd if OpenRC is found. Just like systemd, any OpenRC on the system automatically means that it’s _not_ a classic init.d setup. * Fall back to init.d in WSL in some cases. If there is no _usable_ systemd, and the service manager otherwise looks like an init.d setup, fall back to an init.d setup. * Support LSB style init scripts in WSL as well. Also consolidate and update the error message that gets printed when running under WSL. * Fix typo in LSB init script handling code. * Fix command handling for LSB and initd service management. Instead of using `service`, just run the init scripts directly. This way we avoid any bugs in `service` that would cause it to pretend that systemd is in use even though it isn’t. * Fix botched partial commit. * Restructure service type detection to not rely on return codes. * Added option to display service type detection results. This should simplify debugging.
Diffstat (limited to 'packaging')
-rw-r--r--packaging/installer/functions.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/packaging/installer/functions.sh b/packaging/installer/functions.sh
index c3fb25bcea..d3421ea80f 100644
--- a/packaging/installer/functions.sh
+++ b/packaging/installer/functions.sh
@@ -476,10 +476,14 @@ install_non_systemd_init() {
}
run_install_service_script() {
+ if [ -z "${tmpdir}" ]; then
+ tmpdir="${TMPDIR:-/tmp}"
+ fi
+
# shellcheck disable=SC2154
save_path="${tmpdir}/netdata-service-cmds"
# shellcheck disable=SC2068
- run "${NETDATA_PREFIX}/usr/libexec/netdata/install-service.sh" --save-cmds "${save_path}" ${@}
+ "${NETDATA_PREFIX}/usr/libexec/netdata/install-service.sh" --save-cmds "${save_path}" ${@}
case $? in
0)
@@ -532,7 +536,7 @@ run_install_service_script() {
install_netdata_service() {
if [ "${UID}" -eq 0 ]; then
if [ -x "${NETDATA_PREFIX}/usr/libexec/netdata/install-service.sh" ]; then
- run_install_service_script
+ run_install_service_script && return 0
else
# This is used by netdata-installer.sh
# shellcheck disable=SC2034