From 72ff915b4692e9862af597a51e78f58c87613945 Mon Sep 17 00:00:00 2001 From: Nikita Tokarchuk Date: Sun, 15 May 2022 19:43:33 +0200 Subject: [PATCH] Add openwrt init script and uci config section --- net/coredns/Makefile | 6 ++++++ net/coredns/files/coredns.conf | 3 +++ net/coredns/files/coredns.init | 30 ++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 net/coredns/files/coredns.conf create mode 100644 net/coredns/files/coredns.init diff --git a/net/coredns/Makefile b/net/coredns/Makefile index b798558..b65612f 100644 --- a/net/coredns/Makefile +++ b/net/coredns/Makefile @@ -38,6 +38,12 @@ define Package/coredns/install $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/coredns $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/coredns.init $(1)/etc/init.d/coredns + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/coredns.config $(1)/etc/config/coredns + $(INSTALL_DIR) $(1)/etc/coredns $(INSTALL_CONF) ./files/Corefile $(1)/etc/coredns/Corefile endef diff --git a/net/coredns/files/coredns.conf b/net/coredns/files/coredns.conf new file mode 100644 index 0000000..2e5fe12 --- /dev/null +++ b/net/coredns/files/coredns.conf @@ -0,0 +1,3 @@ +config coredns 'main' + option port '53' + option config '/etc/coredns/Corefile' \ No newline at end of file diff --git a/net/coredns/files/coredns.init b/net/coredns/files/coredns.init new file mode 100644 index 0000000..aa09263 --- /dev/null +++ b/net/coredns/files/coredns.init @@ -0,0 +1,30 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2022 Nikita Tokarchuk + +START=90 + +USE_PROCD=1 + +NAME=coredns +COMMAND=/usr/sbin/$NAME + +start_service() { + config_load $NAME + + config_get port main port '53' + config_get config main config '/etc/coredns/Corefile' + + procd_open_instance + procd_set_param command $COMMAND + procd_append_param command \ + -p $port \ + -conf $config + procd_set_param limits nofile=4096 + procd_set_param stderr 1 + procd_set_param stdout 1 + procd_close_instance +} + +reload_service() { + procd_send_signal $NAME +} \ No newline at end of file