nextdns: initialize nextdns from /etc/uci-defaults
authorMarc Benoit <[email protected]>
Mon, 5 Sep 2022 18:52:07 +0000 (14:52 -0400)
committerTianling Shen <[email protected]>
Sun, 20 Nov 2022 18:20:08 +0000 (02:20 +0800)
Signed-off-by: Marc Benoit <[email protected]>
(cherry picked from commit e54247a6fa9c03f286d38460c425d6dbd622b657)

net/nextdns/Makefile
net/nextdns/files/nextdns.defaults [new file with mode: 0644]

index 048a5be8564e314e2c7dc0e934d9b14e8c8ff1e8..5fb3116271c1835156fd01dbbad5c916fd1b2ad2 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=nextdns
 PKG_VERSION:=1.38.0
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=nextdns-$(PKG_VERSION).tar.gz
 PKG_SOURCE_VERSION:=v$(PKG_VERSION)
@@ -50,13 +50,9 @@ define Package/nextdns/install
 
        $(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
+       $(INSTALL_DIR) $(1)/etc/uci-defaults
+       $(INSTALL_BIN) ./files/nextdns.defaults $(1)/etc/uci-defaults/nextdns
 endef
 
 define Package/nextdns/prerm
diff --git a/net/nextdns/files/nextdns.defaults b/net/nextdns/files/nextdns.defaults
new file mode 100644 (file)
index 0000000..7ea059a
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+/usr/sbin/nextdns install
+# opkg automatically enables each service, but not image builder,
+#   so enable it here to cover both cases
+/etc/init.d/nextdns enable
+
+exit 0