bind: Add systemd unit file and install it to run at startup.
authorNathaniel Roach <nroach44@gmail.com>
Sun, 11 Jan 2015 05:31:36 +0000 (13:31 +0800)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Mon, 12 Jan 2015 21:22:20 +0000 (22:22 +0100)
The unit file is taken from debian, but tested working.
We'll call it named.service to match the sysV initscript.

Signed-off-by: Nathaniel Roach <nroach44@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/bind/bind.mk
package/bind/named.service [new file with mode: 0644]

index 983fa20f5bbba6d60c69b69fe7bd489ad69a915c..a98a4c4e574c43ad10ac3aa393a337315a16796c 100644 (file)
@@ -82,6 +82,15 @@ define BIND_INSTALL_INIT_SYSV
        $(INSTALL) -m 0755 -D package/bind/S81named \
                $(TARGET_DIR)/etc/init.d/S81named
 endef
+define BIND_INSTALL_INIT_SYSTEMD
+       $(INSTALL) -D -m 644 package/bind/named.service \
+               $(TARGET_DIR)/usr/lib/systemd/system/named.service
+
+       mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+
+       ln -sf /usr/lib/systemd/system/named.service \
+               $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/named.service
+endef
 else
 BIND_POST_INSTALL_TARGET_HOOKS += BIND_TARGET_REMOVE_SERVER
 endif
diff --git a/package/bind/named.service b/package/bind/named.service
new file mode 100644 (file)
index 0000000..be0158b
--- /dev/null
@@ -0,0 +1,12 @@
+[Unit]
+Description=BIND Domain Name Server
+Documentation=man:named(8)
+After=network.target
+
+[Service]
+ExecStart=/usr/sbin/named -f -u named
+ExecReload=/usr/sbin/rndc reload
+ExecStop=/usr/sbin/rndc stop
+
+[Install]
+WantedBy=multi-user.target