diff --git a/internal/home/service.go b/internal/home/service.go index aa243634..3d817446 100644 --- a/internal/home/service.go +++ b/internal/home/service.go @@ -15,6 +15,9 @@ 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. + const ( launchdStdoutPath = "/var/log/AdGuardHome.stdout.log" launchdStderrPath = "/var/log/AdGuardHome.stderr.log" @@ -504,6 +507,10 @@ status() { } ` +// TODO(a.garipov): Don't use .WorkingDirectory here. There are currently no +// guarantees that it will actually be the required directory. +// +// See https://github.com/AdguardTeam/AdGuardHome/issues/2614. const freeBSDScript = `#!/bin/sh # PROVIDE: {{.Name}} # REQUIRE: networking @@ -514,6 +521,6 @@ name="{{.Name}}" {{.Name}}_user="root" pidfile="/var/run/${name}.pid" command="/usr/sbin/daemon" -command_args="-P ${pidfile} -r -f {{.WorkingDirectory}}/{{.Name}}" +command_args="-P ${pidfile} -f -r {{.WorkingDirectory}}/{{.Name}}" run_rc_command "$1" ` diff --git a/scripts/install.sh b/scripts/install.sh index ecc2303b..551f84fc 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -230,8 +230,8 @@ main() { unpack "${PKG_NAME}" "${OUT_DIR}" "${PKG_EXT}" || error_exit "Cannot unpack the package" - # Install AdGuard Home service and run it - ${AGH_DIR}/AdGuardHome -s install || error_exit "Cannot install AdGuardHome as a service" + # Install AdGuard Home service and run it. + ( cd "${AGH_DIR}" && ./AdGuardHome -s install || error_exit "Cannot install AdGuardHome as a service" ) rm "${PKG_NAME}"