[nanny] Support for Mandriva/CaixaMagica



commit 9f00637f4f2e9599c5706f546745f9a19636be6a
Author: Roberto Majadas <roberto majadas openshine com>
Date:   Fri Mar 5 17:33:02 2010 +0100

    Support for Mandriva/CaixaMagica
    
    This patch adds support for Mandriva and Caixa Magica Linux.
    This is 100% compatible with Mandriva.
    
    Provided by Luis medinas <lmedinas at gnome.org>

 README                                  |    2 +-
 configure.ac                            |   13 ++++-
 daemon/data/init.d/mandriva/Makefile.am |    9 +++
 daemon/data/init.d/mandriva/nanny       |   89 +++++++++++++++++++++++++++++++
 4 files changed, 110 insertions(+), 3 deletions(-)
---
diff --git a/README b/README
index 14edcb2..53b2db4 100644
--- a/README
+++ b/README
@@ -10,7 +10,7 @@ Compile in developer mode
 make
 make install or sudo make install
 
-You can change debian for redhat or suse or another one distro supported.
+You can change debian,redhat, suse, mandriva or another one distro supported.
 If you don't use the init-scripts flag, the init scripts will not be installed.
 
 Gnome-Nanny currently requires:
diff --git a/configure.ac b/configure.ac
index 73630fe..9b63ac4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,7 +19,7 @@ AM_DISABLE_STATIC
 AC_PROG_LIBTOOL
 
 AC_ARG_WITH(init-scripts,
-  [  --with-init-scripts=[redhat/debian/suse/None]  Install init.d scripts [default=None]],,
+  [  --with-init-scripts=[redhat/debian/suse/mandriva/None]  Install init.d scripts [default=None]],,
   with_init_scripts=None)
 
 GNOME_DOC_INIT
@@ -186,10 +186,18 @@ else
    AC_MSG_RESULT(not found)
 fi
 
+AC_MSG_CHECKING(Checking Mandriva/CaixaMagica)
+if test -f /etc/mandriva-release || test -f $EXPANDED_SYSCONFDIR/mandriva-release ; then
+   AC_MSG_RESULT(found)
+   operative_system=mandriva
+else
+   AC_MSG_RESULT(not found)
+fi
+
 AM_CONDITIONAL(NANNY_INIT_SCRIPTS_RED_HAT, test x$with_init_scripts = xredhat)
 AM_CONDITIONAL(NANNY_INIT_SCRIPTS_SUSE, test x$with_init_scripts = xsuse)
 AM_CONDITIONAL(NANNY_INIT_SCRIPTS_DEBIAN, test x$with_init_scripts = xdebian)
-
+AM_CONDITIONAL(NANNY_INIT_SCRIPTS_MANDRIVA, test x$with_init_scripts = xmandriva)
 
 dnl *******************************
 dnl Internationalization
@@ -239,6 +247,7 @@ daemon/data/init.d/Makefile
 daemon/data/init.d/debian/Makefile
 daemon/data/init.d/redhat/Makefile
 daemon/data/init.d/suse/Makefile
+daemon/data/init.d/mandriva/Makefile
 daemon/src/Makefile
 daemon/src/proxy/Makefile
 help/Makefile
diff --git a/daemon/data/init.d/mandriva/Makefile.am b/daemon/data/init.d/mandriva/Makefile.am
new file mode 100644
index 0000000..594c29c
--- /dev/null
+++ b/daemon/data/init.d/mandriva/Makefile.am
@@ -0,0 +1,9 @@
+if NANNY_INIT_SCRIPTS_MANDRIVA
+
+initddir=$(sysconfdir)/init.d
+
+initd_SCRIPTS= 	\
+	nanny
+endif
+
+EXTRA_DIST=nanny
diff --git a/daemon/data/init.d/mandriva/nanny b/daemon/data/init.d/mandriva/nanny
new file mode 100644
index 0000000..d260480
--- /dev/null
+++ b/daemon/data/init.d/mandriva/nanny
@@ -0,0 +1,89 @@
+#!/bin/sh
+#
+# nannydaemon:   Nanny daemon
+#
+# chkconfig: 3457 54 02
+# description:  Nanny daemon is an easy way to control what your kids \
+#               are doing in the computer. \
+#               See http://projects.gnome.org/nanny
+#
+# processname: hald
+# pidfile: /var/run/haldaemon.pid
+### BEGIN INIT INFO
+# Provides: nannydeamon
+# Required-Start: messagebus
+# Required-Stop: messagebus
+# Default-Start: 3 4 5 7
+# Short-Description: Nanny daemon
+# Description: This is a daemon for maintaining information
+#              about parental control.
+#              See http://projects.gnome.org/nanny/
+### END INIT INFO
+#
+
+# so we can rearrange this easily
+processname=NannyDaemon
+servicename=NannyDaemon
+
+NANNY_TAP="/usr/share/nanny/daemon/nanny.tap"
+
+PID_FILE="/var/run/$NAME.pid"
+LOG_FILE="/var/log/nanny.log"
+
+TWISTD=$(which twistd)
+DAEMON="$TWISTD -- --uid root --gid root --pidfile $PID_FILE -r glib2
+--logfile $LOG_FILE -y $NANNY_TAP "
+
+test -e $TWISTD
+test -e $NANNY_TAP
+
+RETVAL=0
+
+start() {
+    gprintf "Starting Nanny daemon: "
+    daemon --check $DAEMON $processname
+    RETVAL=$?
+    echo
+    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$servicename
+}
+
+stop() {
+    gprintf "Stopping Nanny daemon: "
+
+    killproc $servicename -TERM
+    RETVAL=$?
+    echo
+    if [ $RETVAL -eq 0 ]; then
+        rm -f /var/lock/subsys/$servicename
+    fi
+}
+
+# See how we were called.
+case "$1" in
+    start)
+        start
+        ;;
+    stop)
+        stop
+        ;;
+    status)
+        status $processname
+        RETVAL=$?
+        ;;
+    restart)
+        stop
+	sleep 3
+        start
+        ;;
+    condrestart)
+        if [ -f /var/lock/subsys/$servicename ]; then
+            stop
+	    sleep 3
+            start
+        fi
+        ;;
+    *)
+        gprintf "Usage: %s {start|stop|status|restart|condrestart}\n" "$0"
+        ;;
+esac
+exit $RETVAL



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]