[Lunar-commits] <lunar> Adding new config.d plugin to install files in /etc/config.d

Stefan Wold ratler at lunar-linux.org
Sun Dec 5 16:45:11 CET 2010


commit 21cd5cdd3033c1822a364dec53d44b7233ff7d20
Author: Stefan Wold <ratler at lunar-linux.org>
Date:   Sun Dec 5 16:45:11 2010 +0100

    Adding new config.d plugin to install files in /etc/config.d
---
 var/lib/lunar/plugins/configd.plugin |   37 ++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/var/lib/lunar/plugins/configd.plugin b/var/lib/lunar/plugins/configd.plugin
new file mode 100644
index 0000000..f7f84c0
--- /dev/null
+++ b/var/lib/lunar/plugins/configd.plugin
@@ -0,0 +1,37 @@
+#!/bin/bash
+######################################################
+#                                                    #
+# configd.plugin - handling of /etc/config.d files   #
+#                                                    #
+######################################################
+#                                                    #
+# Copyright 2010 by Stefan Wold under GPLv2          #
+#                                                    #
+######################################################
+
+
+plugin_configd_post_build()
+{
+  local FILE
+
+  debug_msg "plugin_configd_post_build ($@)"
+
+  if [ -d $SCRIPT_DIRECTORY/config.d ]; then
+    verbose_msg "Handling 'config.d' files"
+    invoke_installwatch
+
+    [ -d /etc/config.d ] || mkdir -p /etc/config.d
+
+    for FILE in $SCRIPT_DIRECTORY/config.d/*; do
+      if [ ! -f /etc/config.d/${FILE##*/} ]; then
+        verbose_msg "Installing ${FILE##*/} into /etc/config.d"
+        /usr/bin/install -g 0 -o 0 -m 0644 $FILE /etc/config.d/
+      fi
+    done
+    devoke_installwatch
+  fi
+
+  return 2
+}
+
+plugin_register BUILD_POST_BUILD plugin_configd_post_build


More information about the Lunar-commits mailing list