* migrated debian install to system V init
authorWilfried Göesgens <willi@citadel.org>
Wed, 13 Dec 2006 23:05:23 +0000 (23:05 +0000)
committerWilfried Göesgens <willi@citadel.org>
Wed, 13 Dec 2006 23:05:23 +0000 (23:05 +0000)
citadel/debian/citadel-server.postinst
citadel/debian/citadel-server.postrm.debhelper
citadel/debian/citadel.init [new file with mode: 0644]
citadel/debian/control
citadel/debian/rules

index f75e77da014894a783b3c4ac57181552ddc045c1..f06a7247fad4574cc06653edad651ba7deaa7bf9 100644 (file)
@@ -42,6 +42,8 @@ set -e
 ###: update-rc.d foo default >/dev/null
 ###
 
+
+
 case "$1" in
   configure)
     # Configure this package.  If the package must prompt the user for
@@ -164,7 +166,7 @@ case "$1" in
        export ACT_AS_MTA=no
        export SYSADMIN_NAME=$admin
        export CREATE_XINETD_ENTRY=no
-       export CREATE_INITTAB_ENTRY=yes
+       export CREATE_INITTAB_ENTRY=no
        echo "applying your settings."
 # citadel home
 # sysadmin
@@ -238,4 +240,6 @@ case "$1" in
      exit 0;;
 esac
 
+#DEBHELPER#
+
 exit 0
index bc035b98cdb5d458ae83547feb4c99b9fb7ac772..9860b4355fb482f2267034abfb5e49260d4dfb05 100644 (file)
@@ -4,3 +4,8 @@ if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
        db_purge
 fi
 # End automatically added section
+# Automatically added by dh_installinit
+if [ "$1" = "purge" ] ; then
+       update-rc.d citadel remove >/dev/null || exit $?
+fi
+# End automatically added section
diff --git a/citadel/debian/citadel.init b/citadel/debian/citadel.init
new file mode 100644 (file)
index 0000000..e38b016
--- /dev/null
@@ -0,0 +1,170 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides:          skeleton
+# Required-Start:    $local_fs $remote_fs
+# Required-Stop:     $local_fs $remote_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Example initscript
+# Description:       This file should be used to construct scripts to be
+#                    placed in /etc/init.d.
+### END INIT INFO
+
+# Author: Foo Bar <foobar@baz.org>
+#
+# Please remove the "Author" lines above and replace them
+# with your own name if you copy and modify this script.
+
+# Do NOT "set -e"
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+RUNDIR=/var/run/citadel
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="Citadel Groupware "
+NAME=citserver
+DAEMON=/usr/sbin/$NAME
+DAEMON_ARGS=" -d -x3 -lmail"
+PIDFILE=$RUNDIR/$NAME.pid
+SCRIPTNAME=/etc/init.d/citadel
+SENDCOMMAND=/usr/sbin/sendcommand
+
+
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
+. /lib/lsb/init-functions
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+        # for ubuntu: check our volatile dirs.
+        if test ! -d $RUNDIR; then
+           mkdir -p $RUNDIR
+       fi
+       # Return
+       #   0 if daemon has been started
+       #   1 if daemon was already running
+       #   2 if daemon could not be started
+       start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
+               $DAEMON_ARGS \
+               || return 2
+       # Add code here, if necessary, that waits for the process to be ready
+       # to handle requests from services started subsequently which depend
+       # on this one.  As a last resort, sleep for some time.
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+       # Return
+       #   0 if daemon has been stopped
+       #   1 if daemon was already stopped
+       #   2 if daemon could not be stopped
+       #   other if a failure occurred
+        %SENDCOMMAND "DOWN"
+
+       #while test -d /proc/`cat $PIDFILE`; do
+       #    /usr/bin/printf  '.'
+       #    /bin/sleep 1
+       #done
+        sleep 5
+       #start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
+       #RETVAL="$?"
+       #[ "$RETVAL" = 2 ] && return 2
+       # Wait for children to finish too if this is a daemon that forks
+       # and if the daemon is only ever run from this initscript.
+       # If the above conditions are not satisfied then add some other code
+       # that waits for the process to drop all resources that could be
+       # needed by services started subsequently.  A last resort is to
+       # sleep for some time.
+       #start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
+       #[ "$?" = 2 ] && return 2
+       # Many daemons don't delete their pidfiles when they exit.
+       # rm -f $PIDFILE
+       return 0
+}
+
+#
+# Function that sends a SIGHUP to the daemon/service
+#
+do_reload() {
+       #
+       # If the daemon can reload its configuration without
+       # restarting (for example, when it is sent a SIGHUP),
+       # then implement that here.
+       #
+#      start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
+        do_stop
+        do_start
+       return 0
+}
+
+case "$1" in
+  start)
+       [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+       do_start
+       case "$?" in
+               0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+               2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+       esac
+       ;;
+  stop)
+       [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+       do_stop
+       case "$?" in
+               0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+               2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+       esac
+       ;;
+  #reload|force-reload)
+       #
+       # If do_reload() is not implemented then leave this commented out
+       # and leave 'force-reload' as an alias for 'restart'.
+       #
+       #log_daemon_msg "Reloading $DESC" "$NAME"
+       #do_reload
+       #log_end_msg $?
+       #;;
+  restart|force-reload)
+       #
+       # If the "reload" option is implemented then remove the
+       # 'force-reload' alias
+       #
+       log_daemon_msg "Restarting $DESC" "$NAME"
+       do_stop
+       case "$?" in
+         0|1)
+               do_start
+               case "$?" in
+                       0) log_end_msg 0 ;;
+                       1) log_end_msg 1 ;; # Old process is still running
+                       *) log_end_msg 1 ;; # Failed to start
+               esac
+               ;;
+         *)
+               # Failed to stop
+               log_end_msg 1
+               ;;
+       esac
+       ;;
+  *)
+       #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
+       echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
+       exit 3
+       ;;
+esac
+
+:
index 0b03fd901a6ed9ed498d912d30cd83631de45968..826797f3f2fa08037dc535c1141f2b971b8b96ac 100644 (file)
@@ -2,7 +2,7 @@ Source: citadel
 Section: mail
 Priority: optional
 Maintainer: Wilfried Goesgens <w.goesgens@chaosindutries.de>
-Build-Depends: debhelper (>= 4.0.0), libical-dev, autotools-dev, zlib1g-dev , libssl-dev, libncurses5-dev, libdb4.3-dev, libldap2-dev, libsasl2-dev, libgnutls-dev | libgnutls11-dev, libgcrypt11-dev, bison, libpam0g-dev, gettext, libdb3-util
+Build-Depends: debhelper (>= 4.0.0), libical-dev, autotools-dev, zlib1g-dev , libssl-dev, libncurses5-dev, libdb4.4-dev, libldap2-dev, libsasl2-dev, libgnutls-dev | libgnutls11-dev, libgcrypt11-dev, bison, libpam0g-dev, gettext, libdb3-util
 Standards-Version: 3.6.1
 
 Package: citadel-server
@@ -10,7 +10,7 @@ Architecture: any
 Pre-Depends: debconf
 Provides: pop3-server, imap-server
 Conflicts: pop3-server, imap-server
-Depends: ${shlibs:Depends}, ${misc:Depends}, debconf, libical, libssl0.9.7, libncurses5, libdb4.3, libldap2, libsasl2, libgnutls | libgnutls11, libgcrypt11, libc6, libgpg-error0, ucf, libdb3-util
+Depends: ${shlibs:Depends}, ${misc:Depends}, debconf, libical, libssl0.9.7, libncurses5, libdb4.4, libldap2, libsasl2, libgnutls | libgnutls11, libgcrypt11, libc6, libgpg-error0, ucf, libdb3-util
 Suggests: citadel-mta
 Description: Citadel is the good old BBS system grown up to a Groupware.
  Citadel is a different kind of messaging and collaboration platform. While 
index 69bb060b07ec5f78e4b24f775ca60ec1aa8b5c1a..9015d45790565372f89acce26216e7c0b7b46877 100755 (executable)
@@ -120,7 +120,7 @@ binary-common:
 #      dh_installemacsen
 #      dh_installpam
 #      dh_installmime
-#      dh_installinit
+       dh_installinit  --name=citadel
 #      dh_installcron
 #      dh_installinfo
        dh_installman