Merge: -(global): fixing the installation flow on windows
* commit 'abbf8fb87b747700ecced07c9ca0b8e1f997ece1': -(global): fixing the installation flow on windows
This commit is contained in:
commit
87a82f5e60
|
@ -7,6 +7,7 @@ import (
|
|||
"net"
|
||||
"net/http"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strconv"
|
||||
|
||||
"github.com/AdguardTeam/golibs/log"
|
||||
|
@ -117,6 +118,10 @@ func handleInstallCheckConfig(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
// Check if DNSStubListener is active
|
||||
func checkDNSStubListener() bool {
|
||||
if runtime.GOOS != "linux" {
|
||||
return false
|
||||
}
|
||||
|
||||
cmd := exec.Command("systemctl", "is-enabled", "systemd-resolved")
|
||||
log.Tracef("executing %s %v", cmd.Path, cmd.Args)
|
||||
_, err := cmd.Output()
|
||||
|
|
|
@ -242,6 +242,10 @@ func checkPortAvailable(host string, port int) error {
|
|||
return err
|
||||
}
|
||||
ln.Close()
|
||||
|
||||
// It seems that net.Listener.Close() doesn't close file descriptors right away.
|
||||
// We wait for some time and hope that this fd will be closed.
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -251,6 +255,10 @@ func checkPacketPortAvailable(host string, port int) error {
|
|||
return err
|
||||
}
|
||||
ln.Close()
|
||||
|
||||
// It seems that net.Listener.Close() doesn't close file descriptors right away.
|
||||
// We wait for some time and hope that this fd will be closed.
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ import (
|
|||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/AdguardTeam/AdGuardHome/isdelve"
|
||||
|
||||
"github.com/AdguardTeam/AdGuardHome/dhcpd"
|
||||
"github.com/AdguardTeam/AdGuardHome/dnsfilter"
|
||||
"github.com/AdguardTeam/AdGuardHome/dnsforward"
|
||||
|
@ -284,7 +286,8 @@ func httpServerLoop() {
|
|||
// and if not, ask and try to run as root
|
||||
func requireAdminRights() {
|
||||
admin, _ := haveAdminRights()
|
||||
if admin {
|
||||
if //noinspection ALL
|
||||
admin || isdelve.Enabled {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
// +build delve
|
||||
|
||||
package isdelve
|
||||
|
||||
const Enabled = true
|
|
@ -0,0 +1,3 @@
|
|||
// Package isdelve is for checking if we're debugging:
|
||||
// https://stackoverflow.com/questions/47879070/how-can-i-see-if-the-goland-debugger-is-running-in-the-program
|
||||
package isdelve
|
|
@ -0,0 +1,5 @@
|
|||
// +build !delve
|
||||
|
||||
package isdelve
|
||||
|
||||
const Enabled = false
|
Loading…
Reference in New Issue