From aae67652e9cdb79c019c7c405e2a97e0d8c32f90 Mon Sep 17 00:00:00 2001
From: Nico Schottelius <nico@brief.schottelius.org>
Date: Fri, 20 Jan 2012 12:57:40 +0100
Subject: [PATCH] explore state of init script on archlinux

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
---
 conf/type/__start_on_boot/explorer/state | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/conf/type/__start_on_boot/explorer/state b/conf/type/__start_on_boot/explorer/state
index 9d63b84e..1de1fe57 100755
--- a/conf/type/__start_on_boot/explorer/state
+++ b/conf/type/__start_on_boot/explorer/state
@@ -29,6 +29,23 @@ name="$__object_id"
 state="present"
 
 case "$os" in
+    archlinux)
+        # convert bash array to shell
+        daemons=$(grep ^DAEMONS /etc/rc.conf | sed -e 's/^.*=(//' -e 's/)$//')
+
+        # absent, as long as not found
+        state="absent"
+
+        # iterate, last one wins.
+        for daemon in $daemons; do
+            if [ "$daemon" = "$name" -o "$daemon" = "@${name}" ]; then
+                state="present"
+            elif [ "$daemon" = "!${name}" ]; then
+                state="absent"
+            fi
+        done
+    ;;  
+
     debian|ubuntu)
         [ -f "/etc/rc$runlevel.d/S"??"$name" ] || state="absent"
     ;;