From 08ff4e941c90f4cfa6722948494aed73e5bd717c Mon Sep 17 00:00:00 2001 From: Zach Wasserman Date: Sat, 1 Jan 2022 15:18:30 -0800 Subject: [PATCH] Make Linux postinstall more permissive (#3550) In some installations (observed on GitHub Actions), the postinstall script would fail to start the service because the `systemctl` binary was at a different path than expected, or the `systemd` binary was not found running. This change allows the service to start on these environments. --- orbit/pkg/packaging/linux_shared.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/orbit/pkg/packaging/linux_shared.go b/orbit/pkg/packaging/linux_shared.go index 14655532f7..b2946369a0 100644 --- a/orbit/pkg/packaging/linux_shared.go +++ b/orbit/pkg/packaging/linux_shared.go @@ -225,10 +225,10 @@ var postInstallTemplate = template.Must(template.New("postinstall").Parse(` set -e # If we have a systemd, daemon-reload away now -if [ -x /bin/systemctl ] && pidof systemd ; then - /bin/systemctl daemon-reload 2>/dev/null 2>&1 +if which systemctl; then + systemctl daemon-reload 2>/dev/null 2>&1 {{ if .StartService -}} - /bin/systemctl restart orbit.service 2>&1 + systemctl restart orbit.service 2>&1 {{- end}} fi `))