From ccfedc8c7e380e3619f1102f161560ca26991452 Mon Sep 17 00:00:00 2001 From: Sean Brewer Date: Mon, 6 Feb 2023 01:25:04 -0500 Subject: [PATCH] Give user option to exit early in order to avoid issue with containers that have remnants of systemd, but no actual working systemd. --- build-linux/deb/postinst | 11 +++++++++++ build-linux/rpm/postinst | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/build-linux/deb/postinst b/build-linux/deb/postinst index 3546cb6..b22c008 100755 --- a/build-linux/deb/postinst +++ b/build-linux/deb/postinst @@ -60,6 +60,17 @@ if [ "$1" = "configure" ]; then pycompile -p pdagent + # If you install pdagent in a container without systemd, + # but remnants of systemd exist even though they won't + # be used, like with ubuntu, the install will fail. + # Particularly annoying when building Docker images. + # Setting PDAGENT_SKIP_SERVICE_START=yes gives user the + # option to not start service after install to avoid + # this problem. + if [[ -z "${PDAGENT_SKIP_SERVICE_START}" ]]; then + exit 0 + fi + if which systemctl >/dev/null; then install_systemd else diff --git a/build-linux/rpm/postinst b/build-linux/rpm/postinst index 99888ca..27a13e1 100755 --- a/build-linux/rpm/postinst +++ b/build-linux/rpm/postinst @@ -70,6 +70,17 @@ chmod -R a+r $INSTALL_PATH/root_certs # Compile module .py to .pyc python -m compileall -q -f "$INSTALL_PATH/" +# If you install pdagent in a container without systemd, +# but remnants of systemd exist even though they won't +# be used, like with ubuntu, the install will fail. +# Particularly annoying when building Docker images. +# Setting PDAGENT_SKIP_SERVICE_START=yes gives user the +# option to not start service after install to avoid +# this problem. +if [[ -z "${PDAGENT_SKIP_SERVICE_START}" ]]; then + exit 0 +fi + if which systemctl >/dev/null; then install_systemd else