Files
NeoTachyon/tachyon/files/etc/init.d/adguard
T
hacker07 617107ef15 feat(adguard): add AdGuard Home component with DNS modes, failover and section upstream
Add AdGuard Home as an installable Tachyon component (component card with
check/update/remove/rollback/enable/disable) backed by providers/adguard
(validator + runtime) and an init.d service.

Backend:
- action.uc: install/remove/enable/backup/rollback/dispatch/releases for
  'adguard' (tar.gz from AdguardTeam/AdGuardHome, OpenWrt->AdGuard arch map)
- updater.uc: adguard asset selection; updates.uc: valid_component_name and
  automatic update checks
- runtime.uc: generates AdGuardHome.yaml from UCI (upstream=single-box DNS,
  fallback_dns for failover, web UI on LAN, filters), manages the daemon
- dns/apply.uc: dns_main_mode (dnsmasq->AdGuard->sing-box chain, or AdGuard on
  :53 with dnsmasq DHCP-only)
- settings: dns_main_mode (Main DNS) + dns_adguard_failover_enabled
- sections: routed_dns_type/dns_type 'adguard' resolve via the AdGuard provider
  upstreams; validator accepts the new type
- system-info: adguard_version/installed/enabled/backup fields

Frontend:
- component card 'AdGuard Home' with enable/disable + version actions
- LuCI DNS settings tab: Main DNS selector and failover flag
- section.js: AdGuard Home routed DNS protocol option

Tests: tests/adguard_validator.sh, tests/adguard_runtime.sh
2026-09-17 14:22:13 +03:00

38 lines
936 B
Bash

#!/bin/sh /etc/rc.common
# Tachyon-managed AdGuard Home service. The configuration file is generated
# from /etc/config/tachyon by providers/adguard/runtime.uc; do not edit the
# YAML by hand, it is overwritten on every reconfigure.
USE_PROCD=1
START=98
STOP=20
PROG=/usr/bin/AdGuardHome
WORK_DIR=/etc/adguard
CONFIG=$WORK_DIR/AdGuardHome.yaml
PID_FILE=/var/run/tachyon/adguard/adguard.pid
start_service() {
[ -x "$PROG" ] || return 0
[ -f "$CONFIG" ] || return 0
mkdir -p "$WORK_DIR" /var/run/tachyon/adguard
procd_open_instance
procd_set_param command "$PROG" -c "$CONFIG" -w "$WORK_DIR" --pidfile "$PID_FILE" --no-check-update
procd_set_param file "$CONFIG"
procd_set_param respawn
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}
stop_service() {
[ -f "$PID_FILE" ] || return 0
local pid
pid="$(cat "$PID_FILE" 2>/dev/null)"
[ -n "$pid" ] && kill "$pid" 2>/dev/null
rm -f "$PID_FILE"
}