Pull request: all: mv IsOpenWrt

Updates #2829.

Squashed commit of the following:

commit a284a26ba5df101c78e6f866d1bdfa540d205666
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Apr 8 20:34:20 2021 +0300

    aghos: fix darwin

commit 9dbd42d75ebb048c83dbd06a1f09d950b3d12181
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Apr 8 20:11:56 2021 +0300

    all: mv IsOpenWrt
This commit is contained in:
Ainar Garipov
2021-04-08 20:42:04 +03:00
parent 8c7f2b77d5
commit 6a8f6357e2
10 changed files with 78 additions and 62 deletions

View File

@@ -10,7 +10,6 @@ import (
"syscall"
"github.com/AdguardTeam/AdGuardHome/internal/aghos"
"github.com/AdguardTeam/AdGuardHome/internal/util"
"github.com/AdguardTeam/golibs/log"
"github.com/kardianos/service"
)
@@ -215,7 +214,7 @@ func handleServiceInstallCommand(s service.Service) {
log.Fatal(err)
}
if util.IsOpenWrt() {
if aghos.IsOpenWrt() {
// On OpenWrt it is important to run enable after the service installation
// Otherwise, the service won't start on the system startup
_, err = runInitdCommand("enable")
@@ -242,7 +241,7 @@ Click on the link below and follow the Installation Wizard steps to finish setup
// handleServiceStatusCommand handles service "uninstall" command
func handleServiceUninstallCommand(s service.Service) {
if util.IsOpenWrt() {
if aghos.IsOpenWrt() {
// On OpenWrt it is important to run disable command first
// as it will remove the symlink
_, err := runInitdCommand("disable")
@@ -290,7 +289,7 @@ func configureService(c *service.Config) {
c.Option["SysvScript"] = sysvScript
// On OpenWrt we're using a different type of sysvScript.
if util.IsOpenWrt() {
if aghos.IsOpenWrt() {
c.Option["SysvScript"] = openWrtScript
} else if runtime.GOOS == "freebsd" {
c.Option["SysvScript"] = freeBSDScript