1 #!/bin/sh /etc/rc.common
3 # shellcheck disable=SC2034 disable=SC2154
7 # starts after network starts
9 # stops before networking stops
12 PROG
=/usr
/sbin
/nextdns
15 mkdir
-p /tmp
/dnsmasq.d
16 echo "$1" >> /tmp
/dnsmasq.d
/nextdns.conf
20 # Reload dnsmasq is already running.
21 if /etc
/init.d
/dnsmasq running
; then
22 /etc
/init.d
/dnsmasq reload
28 config_get_bool enabled main enabled
"1"
29 rm -f /tmp
/dnsmasq.d
/nextdns.conf
30 if [ "$enabled" = "1" ]; then
31 config_get config main config
""
32 config_get listen main listen
"127.0.0.1:5342"
33 config_get_bool report_client_info main report_client_info
"1"
34 config_get_bool hardened_privacy main hardened_privacy
"0"
35 config_get_bool log_queries main log_queries
"0"
37 # Add a custom configuration for dnsmasq.
38 server
=$
(echo "$listen" |
sed -e 's/:/#/')
39 add_dnsmasq_opt
"server=$server"
40 add_dnsmasq_opt
"no-resolv"
41 if [ "$report_client_info" = "1" ]; then
42 add_dnsmasq_opt
"add-mac"
43 add_dnsmasq_opt
"add-subnet=32,128"
47 procd_set_param
command "$PROG" run \
50 -report-client-info="$report_client_info" \
51 -hardened-privacy="$hardened_privacy" \
52 -log-queries="$log_queries"
53 procd_set_param stdout
1
54 procd_set_param stderr
1
55 procd_set_param respawn
"${respawn_threshold:-3600}" "${respawn_timeout:-5}" "${respawn_retry:-5}"
63 rm -f /tmp
/dnsmasq.d
/nextdns.conf
68 procd_add_reload_trigger
"nextdns"