mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-22 13:05:36 +03:00
Pull request: 4046 darwin service message
Merge in DNS/adguard-home from 4046-log-dir to master Closes #4046. Squashed commit of the following: commit 05140550b14f477f52487c575f56428ce9e6fa10 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Wed Jan 5 17:54:11 2022 +0500 all: add macOS service msg
This commit is contained in:
parent
e9c59b098e
commit
34c95f99f8
3 changed files with 15 additions and 29 deletions
|
@ -393,9 +393,9 @@ func run(args options, clientBuildFS fs.FS) {
|
||||||
// Go memory hacks
|
// Go memory hacks
|
||||||
memoryUsage(args)
|
memoryUsage(args)
|
||||||
|
|
||||||
// print the first message after logger is configured
|
// Print the first message after logger is configured.
|
||||||
log.Println(version.Full())
|
log.Println(version.Full())
|
||||||
log.Debug("Current working directory is %s", Context.workDir)
|
log.Debug("current working directory is %s", Context.workDir)
|
||||||
if args.runningAsService {
|
if args.runningAsService {
|
||||||
log.Info("AdGuard Home is running as a service")
|
log.Info("AdGuard Home is running as a service")
|
||||||
}
|
}
|
||||||
|
@ -631,13 +631,13 @@ func configureLogger(args options) {
|
||||||
log.SetLevel(log.DEBUG)
|
log.SetLevel(log.DEBUG)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure that we see the microseconds in logs, as networking stuff
|
// Make sure that we see the microseconds in logs, as networking stuff can
|
||||||
// can happen pretty quickly.
|
// happen pretty quickly.
|
||||||
log.SetFlags(log.LstdFlags | log.Lmicroseconds)
|
log.SetFlags(log.LstdFlags | log.Lmicroseconds)
|
||||||
|
|
||||||
if args.runningAsService && ls.LogFile == "" && runtime.GOOS == "windows" {
|
if args.runningAsService && ls.LogFile == "" && runtime.GOOS == "windows" {
|
||||||
// When running as a Windows service, use eventlog by default if nothing else is configured
|
// When running as a Windows service, use eventlog by default if nothing
|
||||||
// Otherwise, we'll simply loose the log output
|
// else is configured. Otherwise, we'll simply lose the log output.
|
||||||
ls.LogFile = configSyslog
|
ls.LogFile = configSyslog
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,12 @@ 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" &&
|
||||||
|
action == "start" &&
|
||||||
|
!strings.HasPrefix(Context.workDir, "/Applications/") {
|
||||||
|
log.Info("warning: service must be started from within the /Applications directory")
|
||||||
|
}
|
||||||
|
|
||||||
err = service.Control(s, action)
|
err = service.Control(s, action)
|
||||||
if err != nil && service.Platform() == "unix-systemv" &&
|
if err != nil && service.Platform() == "unix-systemv" &&
|
||||||
(action == "start" || action == "stop" || action == "restart") {
|
(action == "start" || action == "stop" || action == "restart") {
|
||||||
|
|
|
@ -272,32 +272,12 @@ fix_darwin() {
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$cpu" = 'arm64' ]
|
|
||||||
then
|
|
||||||
case "$channel"
|
|
||||||
in
|
|
||||||
('beta'|'development'|'edge')
|
|
||||||
# Everything is fine, we have Apple Silicon support on
|
|
||||||
# these channels.
|
|
||||||
;;
|
|
||||||
('release')
|
|
||||||
cpu='amd64'
|
|
||||||
log "use $cpu build on Mac M1 until the native ARM support is added."
|
|
||||||
;;
|
|
||||||
(*)
|
|
||||||
# Generally shouldn't happen, since the release channel
|
|
||||||
# has already been validated.
|
|
||||||
error_exit "invalid channel '$channel'"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Set the package extension.
|
# Set the package extension.
|
||||||
pkg_ext='zip'
|
pkg_ext='zip'
|
||||||
|
|
||||||
# It is important to install AdGuard Home into the /Applications
|
# It is important to install AdGuard Home into the /Applications directory
|
||||||
# directory on macOS. Otherwise, it may not grant enough privileges to
|
# on macOS. Otherwise, it may grant not enough privileges to the AdGuard
|
||||||
# the AdGuard Home.
|
# Home.
|
||||||
out_dir='/Applications'
|
out_dir='/Applications'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue