summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2014-05-24 21:43:55 +0400
committerIgor Pashev <pashev.igor@gmail.com>2014-05-24 21:55:35 +0400
commit6d2147589206f95bafef27c701eda8a4ab50e590 (patch)
tree4e8deafece9b37aabbc79d5e862fcdc1770746c4
parent0c6f14f20b4c49906e17abb4ddf0325c9bf86782 (diff)
downloadknot-6d2147589206f95bafef27c701eda8a4ab50e590.tar.gz
Added SMF service
-rw-r--r--debian/control3
-rw-r--r--debian/knot.smf/manifest/network/dns/server-knot.xml34
-rw-r--r--debian/knot.smf/method/dns-server-knot31
3 files changed, 67 insertions, 1 deletions
diff --git a/debian/control b/debian/control
index 15f0b33..6dbea6e 100644
--- a/debian/control
+++ b/debian/control
@@ -5,7 +5,8 @@ Maintainer: Ondřej Surý <ondrej@debian.org>
Build-Depends: debhelper (>= 9),
liburcu-dev (>= 0.4),
libssl-dev,
- dh-systemd,
+ dh-systemd [linux-any],
+ dh-smf [illumos-any],
dh-autoreconf,
autotools-dev,
flex,
diff --git a/debian/knot.smf/manifest/network/dns/server-knot.xml b/debian/knot.smf/manifest/network/dns/server-knot.xml
new file mode 100644
index 0000000..479f37e
--- /dev/null
+++ b/debian/knot.smf/manifest/network/dns/server-knot.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/xml/schema/smf/service_bundle.dtd.1">
+<service_bundle type="manifest" name="knot">
+ <service name="network/dns/server" type="service" version="1">
+ <dependency name="filesystem" grouping="require_all" restart_on="error" type="service">
+ <service_fmri value="svc:/system/filesystem/local"/>
+ </dependency>
+ <dependency name="net-loopback" grouping="require_all" restart_on="none" type="service">
+ <service_fmri value="svc:/network/loopback"/>
+ </dependency>
+ <dependency name="net-physical" grouping="require_all" restart_on="restart" type="service">
+ <service_fmri value="svc:/network/physical"/>
+ </dependency>
+ <exec_method type="method" name="start" exec="/lib/svc/method/dns-server-knot start %{config_file}" timeout_seconds="30"/>
+ <exec_method type="method" name="stop" exec="/lib/svc/method/dns-server-knot stop %{config_file}" timeout_seconds="30"/>
+ <exec_method type="method" name="refresh" exec="/lib/svc/method/dns-server-knot refresh %{config_file}" timeout_seconds="30"/>
+ <instance name="knot" enabled="false">
+ <property_group name="application" type="application">
+ <propval name="config_file" type="astring" value="/etc/knot/knot.conf"/>
+ </property_group>
+ </instance>
+ <template>
+ <common_name>
+ <loctext xml:lang="C">
+ Knot DNS server
+ </loctext>
+ </common_name>
+ <documentation>
+ <manpage title="knotd" section="8" manpath="/usr/share/man"/>
+ <manpage title="knot.conf" section="5" manpath="/usr/share/man"/>
+ </documentation>
+ </template>
+ </service>
+</service_bundle>
diff --git a/debian/knot.smf/method/dns-server-knot b/debian/knot.smf/method/dns-server-knot
new file mode 100644
index 0000000..558b1ef
--- /dev/null
+++ b/debian/knot.smf/method/dns-server-knot
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+set -e
+
+CMD=$1
+DAEMON_CONFFILE=${2:-/etc/knot/knot.conf}
+DAEMON="/usr/sbin/knotd -d -c $DAEMON_CONFFILE"
+KNOTC="/usr/sbin/knotc -c $DAEMON_CONFFILE"
+
+/usr/lib/knot/prepare-environment $DAEMON_CONFFILE
+
+do_reload() {
+ exec $KNOTC reload
+}
+
+case "$CMD" in
+ start)
+ exec $DAEMON
+ ;;
+ stop)
+ exec $KNOTC stop
+ ;;
+ refresh)
+ exec $KNOTC reload
+ ;;
+ *)
+ echo "Wrong command: $CMD" >&2
+ exit 2
+ ;;
+esac
+