From 682c3c9e8986b6bdf2d0c665c9cad4a71fd2cc83 Mon Sep 17 00:00:00 2001 From: Eugene Burkov Date: Mon, 28 Feb 2022 15:29:29 +0300 Subject: [PATCH] home: imp code --- CHANGELOG.md | 2 ++ internal/home/service.go | 12 +++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2976e276d6c..1000ed30550 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to ### Added +- Default service log output on FreeBSD and OpenBSD ([#4213]). - `windows/arm64` support ([#3057]). ### Changed @@ -87,6 +88,7 @@ In this release, the schema version has changed from 12 to 13. [#3367]: https://github.com/AdguardTeam/AdGuardHome/issues/3367 [#3381]: https://github.com/AdguardTeam/AdGuardHome/issues/3381 [#3503]: https://github.com/AdguardTeam/AdGuardHome/issues/3503 +[#4213]: https://github.com/AdguardTeam/AdGuardHome/issues/4213 [#4216]: https://github.com/AdguardTeam/AdGuardHome/issues/4216 [#4221]: https://github.com/AdguardTeam/AdGuardHome/issues/4221 [#4238]: https://github.com/AdguardTeam/AdGuardHome/issues/4238 diff --git a/internal/home/service.go b/internal/home/service.go index b19a960157c..90e901ea6a4 100644 --- a/internal/home/service.go +++ b/internal/home/service.go @@ -93,11 +93,6 @@ func svcAction(s service.Service, action string) (err error) { log.Info("warning: service must be started from within the /Applications directory") } } - if runtime.GOOS == "darwin" && - action == "start" && - !strings.HasPrefix(Context.workDir, "/Applications/") { - log.Info("warning: service must be started from within the /Applications directory") - } err = service.Control(s, action) if err != nil && service.Platform() == "unix-systemv" && @@ -590,6 +585,9 @@ status() { } ` +// freeBSDScript is the source of the daemon script for FreeBSD. Keep as close +// as possible to the https://github.com/kardianos/service/blob/18c957a3dc1120a2efe77beb401d476bade9e577/service_freebsd.go#L204. +// // TODO(a.garipov): Don't use .WorkingDirectory here. There are currently no // guarantees that it will actually be the required directory. // @@ -602,8 +600,8 @@ const freeBSDScript = `#!/bin/sh . /etc/rc.subr name="{{.Name}}" -eval ${name}_env="IS_DAEMON=1" -eval ${name}_user="root" +{{.Name}}_env="IS_DAEMON=1" +{{.Name}}_user="root" pidfile_child="/var/run/${name}.pid" pidfile="/var/run/${name}_daemon.pid" command="/usr/sbin/daemon"