From 54ca7b40c7b546e6460850ba1606d3858800e39c Mon Sep 17 00:00:00 2001
From: Nico Schottelius <nico@nico-notebook.schottelius.org>
Date: Tue, 6 Mar 2018 22:33:10 +0100
Subject: [PATCH] Update consul agent init script so that it works again on
 Devuan

Error before:

---- BEGIN code-remote:stderr ----
insserv: warning: script 'consul' missing LSB tags and overrides
insserv: There is a loop between service monit and consul if stopped
insserv:  loop involving service consul at depth 2
insserv:  loop involving service monit at depth 1
insserv: Stopping consul depends on monit and therefore on system facility `$all' which can not be true!
insserv: exiting now without changing boot order!
update-rc.d: error: insserv rejected the script header
---
 .../type/__consul_agent/files/consul.sysv-debian    | 13 ++++++++++++-
 docs/changelog                                      |  1 +
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/cdist/conf/type/__consul_agent/files/consul.sysv-debian b/cdist/conf/type/__consul_agent/files/consul.sysv-debian
index a75c555d..a699e64a 100644
--- a/cdist/conf/type/__consul_agent/files/consul.sysv-debian
+++ b/cdist/conf/type/__consul_agent/files/consul.sysv-debian
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# 2015 Nico Schottelius (nico-cdist at schottelius.org)
+# 2015-2018 Nico Schottelius (nico-cdist at schottelius.org)
 # 2015 Steven Armstrong (steven-cdist at armstrong.cc)
 #
 # This file is part of cdist.
@@ -18,6 +18,17 @@
 # You should have received a copy of the GNU General Public License
 # along with cdist. If not, see <http://www.gnu.org/licenses/>.
 #
+### BEGIN INIT INFO
+# Provides:          consul
+# Required-Start:    $remote_fs
+# Required-Stop:     $remote_fs
+# Should-Start:      $all
+# Should-Stop:       $all
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: consul
+# Description:       consul agent
+### END INIT INFO
 
 if [ -f "/etc/default/consul" ]; then
     . /etc/default/consul
diff --git a/docs/changelog b/docs/changelog
index 0b5c5f17..22249b92 100644
--- a/docs/changelog
+++ b/docs/changelog
@@ -16,6 +16,7 @@ next:
 	* New type: __apt_default_release (Matthijs Kooijman)
 	* Type __file: Add pre-exists state (Matthijs Kooijman)
 	* Type __grafana_dashboard: Add support for stretch + ascii (Nico Schottelius)
+	* Type __consul_agent: Update Debian Sys-V-Init script (Nico Schottelius)
 
 4.8.0: 2018-02-14
 	* Core: Skip empty lines in parameter files (Darko Poljak)