mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-24 22:15:45 +03:00
Pull request: 4213 add bsd syslog
Merge in DNS/adguard-home from 4213-bsd-syslog to master Updates #4046. Closes #4213. Squashed commit of the following: commit 1e57c75c4184e83b09cfd27456340ca9447791be Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 28 16:20:32 2022 +0300 home: imp error msg commit 63059d031153ff9b6dc9aecd9522d2ad4f8448da Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 28 15:36:37 2022 +0300 all: imp log of changes commit 682c3c9e8986b6bdf2d0c665c9cad4a71fd2cc83 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 28 15:29:29 2022 +0300 home: imp code commit 86c311a71d07823c18521890bea7c898c117466b Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Mon Feb 28 15:03:02 2022 +0300 home: add bsd syslog
This commit is contained in:
parent
773b80a969
commit
ff1e108bfe
2 changed files with 20 additions and 5 deletions
|
@ -17,6 +17,8 @@ and this project adheres to
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
- Logs are now collected by default on FreeBSD and OpenBSD when AdGuard Home is
|
||||||
|
installed as a service ([#4213]).
|
||||||
- `windows/arm64` support ([#3057]).
|
- `windows/arm64` support ([#3057]).
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
@ -87,6 +89,7 @@ In this release, the schema version has changed from 12 to 13.
|
||||||
[#3367]: https://github.com/AdguardTeam/AdGuardHome/issues/3367
|
[#3367]: https://github.com/AdguardTeam/AdGuardHome/issues/3367
|
||||||
[#3381]: https://github.com/AdguardTeam/AdGuardHome/issues/3381
|
[#3381]: https://github.com/AdguardTeam/AdGuardHome/issues/3381
|
||||||
[#3503]: https://github.com/AdguardTeam/AdGuardHome/issues/3503
|
[#3503]: https://github.com/AdguardTeam/AdGuardHome/issues/3503
|
||||||
|
[#4213]: https://github.com/AdguardTeam/AdGuardHome/issues/4213
|
||||||
[#4216]: https://github.com/AdguardTeam/AdGuardHome/issues/4216
|
[#4216]: https://github.com/AdguardTeam/AdGuardHome/issues/4216
|
||||||
[#4221]: https://github.com/AdguardTeam/AdGuardHome/issues/4221
|
[#4221]: https://github.com/AdguardTeam/AdGuardHome/issues/4221
|
||||||
[#4238]: https://github.com/AdguardTeam/AdGuardHome/issues/4238
|
[#4238]: https://github.com/AdguardTeam/AdGuardHome/issues/4238
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -82,10 +83,15 @@ func svcStatus(s service.Service) (status service.Status, err error) {
|
||||||
// On OpenWrt, the service utility may not exist. We use our service script
|
// On OpenWrt, the service utility may not exist. We use our service script
|
||||||
// directly in this case.
|
// directly in this case.
|
||||||
func svcAction(s service.Service, action string) (err error) {
|
func svcAction(s service.Service, action string) (err error) {
|
||||||
if runtime.GOOS == "darwin" &&
|
if runtime.GOOS == "darwin" && action == "start" {
|
||||||
action == "start" &&
|
var exe string
|
||||||
!strings.HasPrefix(Context.workDir, "/Applications/") {
|
if exe, err = os.Executable(); err != nil {
|
||||||
log.Info("warning: service must be started from within the /Applications directory")
|
log.Error("starting service: getting executable path: %s", err)
|
||||||
|
} else if exe, err = filepath.EvalSymlinks(exe); err != nil {
|
||||||
|
log.Error("starting service: evaluating executable symlinks: %s", err)
|
||||||
|
} else if !strings.HasPrefix(exe, "/Applications/") {
|
||||||
|
log.Info("warning: service must be started from within the /Applications directory")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = service.Control(s, action)
|
err = service.Control(s, action)
|
||||||
|
@ -579,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
|
// TODO(a.garipov): Don't use .WorkingDirectory here. There are currently no
|
||||||
// guarantees that it will actually be the required directory.
|
// guarantees that it will actually be the required directory.
|
||||||
//
|
//
|
||||||
|
@ -587,14 +596,16 @@ const freeBSDScript = `#!/bin/sh
|
||||||
# PROVIDE: {{.Name}}
|
# PROVIDE: {{.Name}}
|
||||||
# REQUIRE: networking
|
# REQUIRE: networking
|
||||||
# KEYWORD: shutdown
|
# KEYWORD: shutdown
|
||||||
|
|
||||||
. /etc/rc.subr
|
. /etc/rc.subr
|
||||||
|
|
||||||
name="{{.Name}}"
|
name="{{.Name}}"
|
||||||
{{.Name}}_env="IS_DAEMON=1"
|
{{.Name}}_env="IS_DAEMON=1"
|
||||||
{{.Name}}_user="root"
|
{{.Name}}_user="root"
|
||||||
pidfile_child="/var/run/${name}.pid"
|
pidfile_child="/var/run/${name}.pid"
|
||||||
pidfile="/var/run/${name}_daemon.pid"
|
pidfile="/var/run/${name}_daemon.pid"
|
||||||
command="/usr/sbin/daemon"
|
command="/usr/sbin/daemon"
|
||||||
command_args="-P ${pidfile} -p ${pidfile_child} -f -r {{.WorkingDirectory}}/{{.Name}}"
|
command_args="-P ${pidfile} -p ${pidfile_child} -T ${name} -r {{.WorkingDirectory}}/{{.Name}}"
|
||||||
run_rc_command "$1"
|
run_rc_command "$1"
|
||||||
`
|
`
|
||||||
|
|
||||||
|
@ -604,6 +615,7 @@ const openBSDScript = `#!/bin/sh
|
||||||
|
|
||||||
daemon="{{.Path}}"
|
daemon="{{.Path}}"
|
||||||
daemon_flags={{ .Arguments | args }}
|
daemon_flags={{ .Arguments | args }}
|
||||||
|
daemon_logger="daemon.info"
|
||||||
|
|
||||||
. /etc/rc.d/rc.subr
|
. /etc/rc.d/rc.subr
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue