aboutsummaryrefslogtreecommitdiff
path: root/net/adguardhome
diff options
context:
space:
mode:
authorHiếu Lê <leorize+oss@disroot.org>2023-09-29 19:45:14 +0000
committerHiếu Lê <leorize+oss@disroot.org>2023-09-29 19:49:43 +0000
commitd00131e2a0c8e846b42df22eda6c8356d4fce4a9 (patch)
treeb06f5fa0e3840d4844b443f0a2a045d8e2aa0c5f /net/adguardhome
parent002ff0dd11ffaab73bcd3034e2f82a2c5f396e09 (diff)
adguardhome: wait for interfaces to be up at boot
This should allow the service to be activated even earlier during the boot process and also avoids race condition against network. Signed-off-by: Hiếu Lê <leorize+oss@disroot.org>
Diffstat (limited to 'net/adguardhome')
-rw-r--r--net/adguardhome/files/adguardhome.init22
1 files changed, 20 insertions, 2 deletions
diff --git a/net/adguardhome/files/adguardhome.init b/net/adguardhome/files/adguardhome.init
index 802dcdae3..6a29c4e4a 100644
--- a/net/adguardhome/files/adguardhome.init
+++ b/net/adguardhome/files/adguardhome.init
@@ -4,12 +4,22 @@ PROG=/usr/bin/AdGuardHome
USE_PROCD=1
-# starts just after network starts to avoid some network race conditions
-START=25
+# matches dnsmasq
+START=19
# stops before networking stops
STOP=89
+boot() {
+ adguardhome_boot=1
+ start "$@"
+}
+
start_service() {
+ if [ -n "$adguardhome_boot" ]; then
+ # Do not start yet, wait for triggers
+ return 0
+ fi
+
config_load adguardhome
config_get WORK_DIR config workdir
@@ -21,3 +31,11 @@ start_service() {
procd_set_param stderr 1
procd_close_instance
}
+
+service_triggers() {
+ if [ -n "$adguardhome_boot" ]; then
+ # Wait for interfaces to be up before starting AdGuard Home for real.
+ # Prevents issues like https://github.com/openwrt/packages/issues/21868.
+ procd_add_raw_trigger "interface.*.up" 5000 /etc/init.d/adguardhome restart
+ fi
+}