diff --git a/cross/adguardhome/Makefile b/cross/adguardhome/Makefile
index e5472d307c2..120bf286a2c 100644
--- a/cross/adguardhome/Makefile
+++ b/cross/adguardhome/Makefile
@@ -11,8 +11,10 @@ HOMEPAGE = https://github.com/AdguardTeam/$(PKG_NAME)
COMMENT = Network-wide ads & trackers blocking DNS server
LICENSE = GPL-3.0 license
+PATCHES_LEVEL = 1
GO_SRC_DIR = $(WORK_DIR)/AdGuardHome-$(PKG_VERS)
GO_BIN_DIR = $(GO_SRC_DIR)/$(PKG_NAME)
+GO_BUILD_ARGS += -ldflags "-X 'github.com/AdguardTeam/AdGuardHome/internal/version.version=v$(PKG_VERS)' -X 'github.com/AdguardTeam/AdGuardHome/internal/version.channel=release'"
PATH := $(WORK_DIR)/../../../native/nodejs/work-native/node/bin:$(PATH)
PRE_COMPILE_TARGET = adguardhome_pre_compile
# avoid webpack error ERR_OSSL_EVP_UNSUPPORTED with nodejs 18
diff --git a/cross/adguardhome/patches/fix-unprivilaged-ports-check.patch b/cross/adguardhome/patches/fix-unprivilaged-ports-check.patch
new file mode 100644
index 00000000000..0498acce26d
--- /dev/null
+++ b/cross/adguardhome/patches/fix-unprivilaged-ports-check.patch
@@ -0,0 +1,11 @@
+--- a/internal/aghnet/net_linux.go
++++ b/internal/aghnet/net_linux.go
+@@ -22,6 +22,7 @@
+ const dhcpcdConf = "etc/dhcpcd.conf"
+
+ func canBindPrivilegedPorts() (can bool, err error) {
++ return true, nil
+ res, err := unix.PrctlRetInt(
+ unix.PR_CAP_AMBIENT,
+ unix.PR_CAP_AMBIENT_IS_SET,
+
diff --git a/spk/adguardhome/Makefile b/spk/adguardhome/Makefile
index e48040882f3..9bece58a955 100644
--- a/spk/adguardhome/Makefile
+++ b/spk/adguardhome/Makefile
@@ -5,6 +5,7 @@ SPK_ICON = src/adguardhome.png
DEPENDS = cross/adguardhome
UNSUPPORTED_ARCHS = $(PPC_ARCHS)
+SPK_CONFLICT = DNSServer DhcpServer
MAINTAINER = publicarray
DISPLAY_NAME = AdGuardHome
@@ -25,11 +26,4 @@ ADMIN_PORT = $(SERVICE_PORT)
WIZARDS_DIR = src/wizard
-POST_STRIP_TARGET = adguardhome_extra_install
-
-include ../../mk/spksrc.spk.mk
-
-.PHONY: adguardhome_extra_install
-adguardhome_extra_install:
- install -m 755 -d $(STAGING_DIR)/var
- install -m 644 src/AdGuardHome.yml $(STAGING_DIR)/var/AdGuardHome.yml
\ No newline at end of file
+include ../../mk/spksrc.spk.mk
\ No newline at end of file
diff --git a/spk/adguardhome/src/AdGuardHome.yml b/spk/adguardhome/src/AdGuardHome.yml
deleted file mode 100644
index d00f0e17226..00000000000
--- a/spk/adguardhome/src/AdGuardHome.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-dns:
- port: 5053
-os:
- group: "synocommunity"
- user: "sc-adguardhome"
\ No newline at end of file
diff --git a/spk/adguardhome/src/service-setup.sh b/spk/adguardhome/src/service-setup.sh
index c24524d71d1..daa95e147f4 100644
--- a/spk/adguardhome/src/service-setup.sh
+++ b/spk/adguardhome/src/service-setup.sh
@@ -2,5 +2,9 @@ ADGUARDHOME="${SYNOPKG_PKGDEST}/bin/adguardhome"
CFG_FILE="${SYNOPKG_PKGVAR}/AdGuardHome.yml"
PID_FILE="${SYNOPKG_PKGVAR}/adguardhome.pid"
WEB_UI="0.0.0.0:${SYNOPKG_PKGPORT}"
-SERVICE_COMMAND="${ADGUARDHOME} --web-addr ${WEB_UI} -c ${CFG_FILE} --pidfile ${PID_FILE} -l ${LOG_FILE} --work-dir ${SYNOPKG_PKGVAR}"
-SVC_BACKGROUND=y
\ No newline at end of file
+SERVICE_COMMAND="${ADGUARDHOME} --web-addr ${WEB_UI} --config ${CFG_FILE} --pidfile ${PID_FILE} --logfile ${LOG_FILE} --work-dir ${SYNOPKG_PKGVAR}"
+SVC_BACKGROUND=y
+
+service_postinst () {
+ mkdir -p "${SYNOPKG_PKGVAR}/data/"
+}
\ No newline at end of file
diff --git a/spk/adguardhome/src/wizard/install_uifile b/spk/adguardhome/src/wizard/install_uifile
index 4fef2e20ce1..0532f45e2ac 100644
--- a/spk/adguardhome/src/wizard/install_uifile
+++ b/spk/adguardhome/src/wizard/install_uifile
@@ -1,8 +1,8 @@
[{
"step_title": "Install Instructions",
"items": [{
- "desc": "Please unselect 'Run after installation', To run adguard you need to rirst run the following command via SSH and everytime there is an update"
+ "desc": "Please unselect 'Run after installation', To run adguard you need to first run the following command via SSH and everytime there is an update"
}, {
- "desc": "setcap 'CAP_NET_BIND_SERVICE=+eip CAP_NET_RAW=+eip' /var/packages/adguardhome/target/bin/adguardhome"
+ "desc": "setcap 'CAP_NET_BIND_SERVICE=+eip CAP_NET_RAW=+eip' /var/packages/adguardhome/target/bin/adguardhome
"
}]
}]