From 6ac28ee8eeb290ef27603a7e92a12bc4e26e8af3 Mon Sep 17 00:00:00 2001 From: Ainar Garipov Date: Fri, 17 Sep 2021 16:24:44 +0300 Subject: [PATCH] Pull request: home: do not add linux deps on non-linux systems Updates #3609. Squashed commit of the following: commit 8f890d2806938db1aee05833d1b2ae8ff1bc9fd4 Author: Ainar Garipov Date: Fri Sep 17 16:10:09 2021 +0300 home: do not add linux deps on non-linux systems --- internal/home/service.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/internal/home/service.go b/internal/home/service.go index b5515ce4..9078f5f9 100644 --- a/internal/home/service.go +++ b/internal/home/service.go @@ -17,8 +17,8 @@ import ( "github.com/kardianos/service" ) -// TODO(a.garipov): Move shell templates into actual files. Either during the -// v0.106.0 cycle using packr or during the following cycle using go:embed. +// TODO(a.garipov): Consider moving the shell templates into actual files and +// using go:embed instead of using large string constants. const ( launchdStdoutPath = "/var/log/AdGuardHome.stdout.log" @@ -313,18 +313,21 @@ func configureService(c *service.Config) { // POSIX / systemd // Redirect stderr and stdout to files. Make sure we always restart. - // Start only once network is up on Linux/systemd. c.Option["LogOutput"] = true c.Option["Restart"] = "always" - c.Dependencies = []string{ - "After=syslog.target network-online.target", + + // Start only once network is up on Linux/systemd. + if runtime.GOOS == "linux" { + c.Dependencies = []string{ + "After=syslog.target network-online.target", + } } - // Use modified service file templates. + // Use the modified service file templates. c.Option["SystemdScript"] = systemdScript c.Option["SysvScript"] = sysvScript - // On OpenWrt we're using a different type of sysvScript. + // Use different scripts on OpenWrt and FreeBSD. if aghos.IsOpenWrt() { c.Option["SysvScript"] = openWrtScript } else if runtime.GOOS == "freebsd" {