[Lunar-commits] r14734 - in moonbase/trunk: security/xinetd security/xinetd/plugin.d shells/bash shells/bash/plugin.d
Auke Kok
sofar at lunar-linux.org
Sun May 15 18:15:05 UTC 2005
Author: sofar
Date: 2005-05-15 18:15:04 +0000 (Sun, 15 May 2005)
New Revision: 14734
Added:
moonbase/trunk/security/xinetd/plugin.d/
moonbase/trunk/security/xinetd/plugin.d/xinetd.plugin
moonbase/trunk/shells/bash/plugin.d/
moonbase/trunk/shells/bash/plugin.d/postbuild-bash.plugin
Log:
Creating plugins out of these!
Added: moonbase/trunk/security/xinetd/plugin.d/xinetd.plugin
===================================================================
--- moonbase/trunk/security/xinetd/plugin.d/xinetd.plugin 2005-05-15 18:05:36 UTC (rev 14733)
+++ moonbase/trunk/security/xinetd/plugin.d/xinetd.plugin 2005-05-15 18:15:04 UTC (rev 14734)
@@ -0,0 +1,80 @@
+#!/bin/bash
+#############################################################
+# #
+# xinetd.plugin - handling of xinetd.d files #
+# #
+#############################################################
+# #
+# Copyright 2005 by Auke Kok under GPLv2 #
+# #
+#############################################################
+
+plugin_xinetd_configure()
+{(
+ local ALL_SERVICES SERVICES SERVICE FILE RETURN
+ debug_msg "plugin_xinetd_configure ($@)"
+ if [ -d $SCRIPT_DIRECTORY/xinetd.d ] && ! grep -q "SERVICES=" $MODULE_CONFIG
+ then
+ ALL_SERVICES=$(grep "service" $SCRIPT_DIRECTORY/xinetd.d/* | sed "s/service //")
+
+ for SERVICE in $ALL_SERVICES ; do
+ if query "Invoke $SERVICE via xinetd?" y ; then
+ SERVICES="$SERVICE $SERVICES"
+ fi
+ done
+
+ cd "$SCRIPT_DIRECTORY/xinetd.d"
+ # does someone remember why stunnel is such a special case?
+ for SERVICE in $SERVICES; do
+ for FILE in $(ls -1) ; do
+ if grep -q "service $SERVICE" $FILE && grep -q "stunnel" $FILE ; then
+ add_depends "$MODULE" "stunnel" "on" "optional"
+ fi
+ done
+ done
+
+ if [ -n "$SERVICES" ] ; then
+ add_depends "$MODULE" "xinetd" "on" "optional"
+ else
+ add_depends "$MODULE" "xinetd" "off" "optional"
+ fi
+
+ set_module_config "SERVICES" "$SERVICES"
+ fi
+ return 2
+)}
+
+
+plugin_xinetd_post_build()
+{(
+ unset IFS
+ debug_msg "plugin__xinetd_post_builds ($@)"
+ if [ -d "$SCRIPT_DIRECTORY/xinetd.d" ]; then
+ cd "$SCRIPT_DIRECTORY/xinetd.d"
+ verbose_msg "handling xinetd config files"
+
+ [ -d /etc/xinetd.d ] || mkdir -p /etc/xinetd.d
+
+ invoke_installwatch
+ for SERVICE in $SERVICES; do
+ for FILE in $(ls -1) ; do
+ if grep -q "service $SERVICE" $FILE ; then
+ if [ ! -f /etc/xinetd.d/$FILE ] ; then
+ /usr/bin/install --backup=numbered -g 0 -o 0 -m 600 $FILE /etc/xinetd.d
+ fi
+ fi
+ done
+ done
+ devoke_installwatch
+
+ if [ -n "$SERVICES" ]; then
+ [ ! -x /etc/init.d/xinetd ] || /etc/init.d/xinetd restart
+ fi
+ fi
+ return 2
+)}
+
+
+plugin_register BUILD_CONFIGURE plugin_xinetd_configure
+plugin_register BUILD_POST_BUILD plugin_xinetd_post_build
+
Added: moonbase/trunk/shells/bash/plugin.d/postbuild-bash.plugin
===================================================================
--- moonbase/trunk/shells/bash/plugin.d/postbuild-bash.plugin 2005-05-15 18:05:36 UTC (rev 14733)
+++ moonbase/trunk/shells/bash/plugin.d/postbuild-bash.plugin 2005-05-15 18:15:04 UTC (rev 14734)
@@ -0,0 +1,35 @@
+#!/bin/bash
+#############################################################
+# #
+# bash.plugin - handling of bash shell profile files #
+# #
+#############################################################
+# #
+# Copyright 2005 by Auke Kok under GPLv2 #
+# #
+#############################################################
+
+
+
+plugin_bash_post_build()
+{
+ debug_msg "plugin_bash_post_build ($@)"
+ if [ -d $SCRIPT_DIRECTORY/profile.d ] ; then
+ invoke_installwatch
+ [ -d /etc/profile.d ] || mkdir -p /etc/profile.d
+ install -g 0 -o 0 -m 644 $SCRIPT_DIRECTORY/profile.d/*.rc /etc/profile.d
+ message "\n${MESSAGE_COLOR}Please log out and log in again to make changes in your shell\nenvironment take effect.${DEFAULT_COLOR}\n"
+ devoke_installwatch
+ fi
+ if [ -d $SCRIPT_DIRECTORY/skel ]; then
+ invoke_installwatch
+ [ -d /etc/skel ] || mkdir -p /etc/skel
+ cp $SCRIPT_DIRECTORY/skel/* /etc/skel &> /dev/null
+ cp $SCRIPT_DIRECTORY/skel/.* /etc/skel &> /dev/null
+ devoke_installwatch
+ fi
+ return 2
+}
+
+
+plugin_register BUILD_POST_BUILD plugin_bash_post_build
More information about the Lunar-commits
mailing list