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.
This commit is contained in:
Zach Wasserman 2022-01-01 15:18:30 -08:00 committed by GitHub
parent f20762b431
commit 08ff4e941c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
`))