nextdns: Update to version 1.6.4

Refactor the package so init script is installed from the binary instead
of an init script embedded in the package.

Signed-off-by: Olivier Poitrey <rs@nextdns.io>
This commit is contained in:
Olivier Poitrey 2020-05-30 00:28:43 +00:00
parent 093db9d076
commit 7e762d18f2
3 changed files with 19 additions and 85 deletions

View File

@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=nextdns
PKG_VERSION:=1.6.3
PKG_RELEASE:=2
PKG_VERSION:=1.6.4
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
PKG_SOURCE_URL:=https://github.com/nextdns/nextdns.git
PKG_MIRROR_HASH:=104ec2ffe21f1f1770bce7686e4f117019dfc64f3f6bfd8f8f06cfc1ff44da6d
PKG_MIRROR_HASH:=6248ceebe2c5df02e545e3193065e87355d8dee910b270b2019e104758e69c2f
PKG_MAINTAINER:=Olivier Poitrey <rs@nextdns.io>
PKG_LICENSE:=MIT
@ -49,13 +49,24 @@ define Package/nextdns/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nextdns $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/nextdns.init $(1)/etc/init.d/nextdns
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/nextdns.config $(1)/etc/config/nextdns
endef
define Package/nextdns/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
nextdns install
fi
endef
define Package/nextdns/prerm
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
nextdns uninstall
fi
endef
define Package/nextdns/description
Official NextDNS DNS over HTTPS Proxy.
endef

View File

@ -16,9 +16,8 @@ config nextdns main
#list host_config '10.0.1.2/32=abc123'
#list host_config '10.0.3.0/24=def321'
# Listen on a custom local port so a DNS front (like dnsmasq) can use us as
# a forwarder.
option listen '127.0.0.1:5342'
# Configure NextDNS cli client to serve DNS to other clients on the network.
option setup_router '1'
# Expose LAN clients information in NextDNS analytics.
option report_client_info '1'

View File

@ -1,76 +0,0 @@
#!/bin/sh /etc/rc.common
# shellcheck disable=SC2034 disable=SC2154
USE_PROCD=1
# starts after network starts
START=21
# stops before networking stops
STOP=89
PROG=/usr/sbin/nextdns
add_dnsmasq_opt() {
mkdir -p /tmp/dnsmasq.d
echo "$1" >> /tmp/dnsmasq.d/nextdns.conf
}
dnsmasq_reload() {
# Reload dnsmasq is already running.
if /etc/init.d/dnsmasq running; then
/etc/init.d/dnsmasq reload
fi
}
handle_host_config() {
host_config_args="$host_config_args -config=$1"
}
start_service() {
config_load nextdns
config_get_bool enabled main enabled "1"
rm -f /tmp/dnsmasq.d/nextdns.conf
if [ "$enabled" = "1" ]; then
config_get config main config ""
config_list_foreach main host_config handle_host_config
config_get listen main listen "127.0.0.1:5342"
config_get_bool report_client_info main report_client_info "1"
config_get_bool hardened_privacy main hardened_privacy "0"
config_get_bool log_queries main log_queries "0"
# Add a custom configuration for dnsmasq.
server=$(echo "$listen" | sed -e 's/:/#/')
add_dnsmasq_opt "server=$server"
add_dnsmasq_opt "no-resolv"
if [ "$report_client_info" = "1" ]; then
add_dnsmasq_opt "add-mac"
add_dnsmasq_opt "add-subnet=32,128"
fi
procd_open_instance
# shellcheck disable=SC2086
procd_set_param command "$PROG" run \
-listen="$listen" \
$host_config_args \
-config="$config" \
-report-client-info="$report_client_info" \
-hardened-privacy="$hardened_privacy" \
-log-queries="$log_queries"
procd_set_param stdout 1
procd_set_param stderr 1
procd_set_param respawn "${respawn_threshold:-3600}" "${respawn_timeout:-5}" "${respawn_retry:-5}"
procd_close_instance
fi
dnsmasq_reload
}
stop_service() {
rm -f /tmp/dnsmasq.d/nextdns.conf
dnsmasq_reload
}
service_triggers() {
procd_add_reload_trigger "nextdns"
}