[Pkg-voip-commits] r6865 - in /lcr/trunk/debian: changelog lcr.default lcr.init patches/pid.patch patches/series rules
dorchain-guest at alioth.debian.org
dorchain-guest at alioth.debian.org
Mon Mar 9 14:51:10 UTC 2009
Author: dorchain-guest
Date: Mon Mar 9 14:51:09 2009
New Revision: 6865
URL: http://svn.debian.org/wsvn/pkg-voip/?sc=1&rev=6865
Log:
Added initscript
Added:
lcr/trunk/debian/lcr.default
lcr/trunk/debian/lcr.init
lcr/trunk/debian/patches/pid.patch
Modified:
lcr/trunk/debian/changelog
lcr/trunk/debian/patches/series
lcr/trunk/debian/rules
Modified: lcr/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-voip/lcr/trunk/debian/changelog?rev=6865&op=diff
==============================================================================
--- lcr/trunk/debian/changelog (original)
+++ lcr/trunk/debian/changelog Mon Mar 9 14:51:09 2009
@@ -3,6 +3,7 @@
[ Joerg Dorchain ]
* Initial release (Closes: #510476) ITP
* New upstream version
+ * Added initscripts
* debian/control:
- Added Vcs-Svn, Vcs-Browser fields
- Changed Maintainer, Added Uploaders field
Added: lcr/trunk/debian/lcr.default
URL: http://svn.debian.org/wsvn/pkg-voip/lcr/trunk/debian/lcr.default?rev=6865&op=file
==============================================================================
--- lcr/trunk/debian/lcr.default (added)
+++ lcr/trunk/debian/lcr.default Mon Mar 9 14:51:09 2009
@@ -1,0 +1,7 @@
+# This file allows you to alter the configuration of the lcr
+# init.d script. Normally you should leave the file as-is.
+#
+# RUNLCR: If set to anything other that 'yes', the lcr init.d script
+# will not run. The default is 'yes'.
+#RUNLCR=no
+
Added: lcr/trunk/debian/lcr.init
URL: http://svn.debian.org/wsvn/pkg-voip/lcr/trunk/debian/lcr.init?rev=6865&op=file
==============================================================================
--- lcr/trunk/debian/lcr.init (added)
+++ lcr/trunk/debian/lcr.init Mon Mar 9 14:51:09 2009
@@ -1,0 +1,200 @@
+#! /bin/sh
+#
+# lcr start the lcr isdn PBX
+# (c) Joerg Dorchain <joerg at dorchain.net>
+#
+# This package is free software; you can redistribute it and/or
+# modify
+# it under the terms of the GNU General Public License as
+# published by
+# the Free Software Foundation; either version 2 of the
+# License, or
+# (at your option) any later version.
+#
+# Based on:
+#
+# skeleton example file to build /etc/init.d/ scripts.
+# This file should be used to construct scripts for
+# /etc/init.d.
+#
+# Written by Miquel van Smoorenburg
+# <miquels at cistron.nl>.
+# Modified for Debian GNU/Linux
+# by Ian Murdock <imurdock at gnu.ai.mit.edu>.
+#
+# Version: @(#)skeleton 1.9 26-Feb-2001
+# miquels at cistron.nl
+#
+
+### BEGIN INIT INFO
+# Provides: lcr
+# Required-Start: $remote_fs
+# Required-Stop: $remote_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: lcr PBX
+# Description: Controls the Linux Call Router ISDN PBX
+### END INIT INFO
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="lcr PBX"
+NAME=lcr
+DAEMON=/usr/sbin/$NAME
+DAEMON_ARGS="fork"
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+RUNLCR=yes
+
+# 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
+
+if [ "$RUNLCR" != "yes" ];then
+ echo "lcr not yet configured. Edit /etc/default/lcr first."
+ exit 0
+fi
+
+# 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
+
+status() {
+ plist=`ps ax | awk "{ if (\\$5 == \"$DAEMON\") print \\$1
+}"`
+ if [ "$plist" = "" ]; then
+ echo "$DESC is stopped"
+ return 1
+ else
+ echo "$DESC is running: $plist"
+ return 0
+ fi
+}
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+ # Return
+ # 0 if daemon has been started
+ # 1 if daemon was already running
+ # 2 if daemon could not be started
+ if status > /dev/null; then
+ echo "$DESC is already running. Use restart."
+ exit 1
+ fi
+
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
+ || return 1
+ 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
+ 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 "$RETVAL"
+}
+
+#
+# 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
+ lcradmin route
+ lcradmin interface
+ 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)
+ #
+ # 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
+
+:
Added: lcr/trunk/debian/patches/pid.patch
URL: http://svn.debian.org/wsvn/pkg-voip/lcr/trunk/debian/patches/pid.patch?rev=6865&op=file
==============================================================================
--- lcr/trunk/debian/patches/pid.patch (added)
+++ lcr/trunk/debian/patches/pid.patch Mon Mar 9 14:51:09 2009
@@ -1,0 +1,22 @@
+--- main.c.orig 2009-03-08 15:21:03.472860024 +0100
++++ main.c 2009-03-08 15:24:56.797047971 +0100
+@@ -314,6 +314,7 @@
+ if (!(strcasecmp(argv[1],"fork")))
+ {
+ pid_t pid;
++ FILE *pidfile;
+
+ /* do daemon fork */
+ pid = fork();
+@@ -344,6 +345,11 @@
+ exit(0);
+ }
+ nooutput = 1;
++
++ /* write pid file */
++ pidfile = fopen("/var/run/lcr.pid","w");
++ fprintf(pidfile, "%d\n", getpid() );
++ fclose(pidfile);
+ } else
+ /* if not start */
+ if (!!strcasecmp(argv[1],"start"))
Modified: lcr/trunk/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-voip/lcr/trunk/debian/patches/series?rev=6865&op=diff
==============================================================================
--- lcr/trunk/debian/patches/series (original)
+++ lcr/trunk/debian/patches/series Mon Mar 9 14:51:09 2009
@@ -1,3 +1,4 @@
+pid.patch -p0
chan_lcr_dtmf.patch
lcr_as_vbox.patch
replace_local.patch
Modified: lcr/trunk/debian/rules
URL: http://svn.debian.org/wsvn/pkg-voip/lcr/trunk/debian/rules?rev=6865&op=diff
==============================================================================
--- lcr/trunk/debian/rules (original)
+++ lcr/trunk/debian/rules Mon Mar 9 14:51:09 2009
@@ -89,6 +89,7 @@
dh_installchangelogs ChangeLog
dh_installdocs
dh_installexamples
+ dh_installinit -- defaults 21
dh_installman
dh_link
dh_strip
More information about the Pkg-voip-commits
mailing list