From d33e1149d1d9d92a72630ce1ae4c6ac884b357b6 Mon Sep 17 00:00:00 2001 From: Bruno Loreto Date: Thu, 9 May 2019 19:42:43 +0200 Subject: [PATCH] Testing systemctl existence before executing it Since commit c9614c429822b kpatch has support for upstart systems, which means we should test the existence of `systemctl` before executing it. The command `command` is POSIX compliant, and should be widely available. Signed-of-by: Bruno Loreto --- kpatch/kpatch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kpatch/kpatch b/kpatch/kpatch index bdceff1..4583ad1 100755 --- a/kpatch/kpatch +++ b/kpatch/kpatch @@ -469,7 +469,7 @@ case "$1" in echo "installing $PATCH ($KVER)" mkdir -p "$INSTALLDIR/$KVER" || die "failed to create install directory" cp -f "$PATCH" "$INSTALLDIR/$KVER" || die "failed to install module $PATCH" - systemctl enable kpatch.service + command -v systemctl > /dev/null 2>&1 && systemctl enable kpatch.service ;; "uninstall")