[Pkg-voip-commits] r3334 - asterisk/branches/experimental/debian

Tzafrir Cohen tzafrir-guest at alioth.debian.org
Sun Mar 25 16:00:55 CET 2007


Author: tzafrir-guest
Date: 2007-03-25 15:00:55 +0000 (Sun, 25 Mar 2007)
New Revision: 3334

Modified:
   asterisk/branches/experimental/debian/asterisk.default
   asterisk/branches/experimental/debian/asterisk.init
   asterisk/branches/experimental/debian/changelog
   asterisk/branches/experimental/debian/rules
Log:
* Fix syntax of for dummy fetch (Closes: #416143).
* LSB init section in init.d script.
* Merge other init.d changes from trunk.


Modified: asterisk/branches/experimental/debian/asterisk.default
===================================================================
--- asterisk/branches/experimental/debian/asterisk.default	2007-03-24 22:15:40 UTC (rev 3333)
+++ asterisk/branches/experimental/debian/asterisk.default	2007-03-25 15:00:55 UTC (rev 3334)
@@ -1,25 +1,35 @@
 # This file allows you to alter the configuration of the Asterisk
-# init.d script
+# init.d script. Normally you should leave the file as-is.
 #
-# RUNASTERISK: run asterisk upon boot. Should be set to "yes" once you have
-#              setup your configuration.
-RUNASTERISK=no
+# RUNASTERISK: If set to anything other that 'yes', the asterisk init.d script
+#              will not run. The default is 'yes'.
+#RUNASTERISK=no
 #
 #
 # AST_REALTIME: if set to anything other than "no", asterisk will run in 
 #               real-time priority (pass '-p' to asterisk). un-rem the 
 #               following line to disable asterisk from running in real-time 
 #               priority
-#AST_REALTIME=yes
+#AST_REALTIME=no
 #
-# PARAMS: extra parameters to pass to asterisk
-#         The example here may help you in debugging, but is 
-#         *not**intended**for**production**use*.
-#         When you give -G *only* that group will be used,
-#         else all groups of the asterisk user.
-#PARAMS="-d -g -vvv"
+# PARAMS: extra parameters to pass to asterisk: generate cores in 
+#         case of crash, and be more verbose. -F guarantees that Asterisk 
+#         will still run daemonized.
 #
+#         Instead of adding switches here, consider editing 
+#         /etc/asterisk/asterisk.conf
+#PARAMS="-F -g -vvv"
 #
+#
 # RUNASTSAFE: run safe_asterisk rather than asterisk (will auto-restart upon
-#             crash)
+#             crash). This is generally less tested and has some known issues
+#             with properly starting and stopping Asterisk.
 #RUNASTSAFE=yes
+#
+# 
+# AST_DUMPCORE: if set to anything other than "no", asterisk will be run with
+#               the option -g (to tell it to dump core on crash) and its
+#               working directory will be set to /var/spool/asterisk, as that
+#               directory is writable and hence core files can be written there.
+#               See /etc/init.d/asterisk for some other relevant variables.
+#AST_DUMPCORE=yes

Modified: asterisk/branches/experimental/debian/asterisk.init
===================================================================
--- asterisk/branches/experimental/debian/asterisk.init	2007-03-24 22:15:40 UTC (rev 3333)
+++ asterisk/branches/experimental/debian/asterisk.init	2007-03-25 15:00:55 UTC (rev 3334)
@@ -2,7 +2,10 @@
 #
 # asterisk	start the asterisk PBX
 # (c) Mark Purcell <msp at debian.org>
-# May be distributed under the terms of this General Public License
+#    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:
 #
@@ -16,6 +19,18 @@
 # Version:	@(#)skeleton  1.9  26-Feb-2001  miquels at cistron.nl
 #
 
+### BEGIN INIT INFO
+# Provides:          asterisk
+# Required-Start:    $local_fs zaptel
+# Required-Stop:     $local_fs
+# Should-Start:      
+# Should-Stop:       
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Asterisk PBX
+# Description:       Controls the Asterisk PBX
+### END INIT INFO
+
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 NAME=asterisk
 USER=$NAME
@@ -24,11 +39,19 @@
 DESC="Asterisk PBX"
 PIDFILE="/var/run/asterisk/asterisk.pid"
 ASTSAFE_PIDFILE="/var/run/asterisk/asterisk_safe.pid"
+PIDFILE_DIR=`dirname $PIDFILE`
+UMASK=007 # by default
 
+
 # by default: use real-time priority
 PARAMS=""
+CHDIR_PARM=""
 AST_REALTIME="yes"
-RUNASTERISK="no"
+RUNASTERISK="yes"
+AST_DUMPCORE="no"
+AST_DUMPCORE_DIR="/var/spool/asterisk"
+# core_pattern. See: http://lxr.linux.no/source/Documentation/sysctl/kernel.txt
+#CORE_PATTERN=
 if [ -r /etc/default/$NAME ]; then . /etc/default/$NAME; fi
 
 if [ "$RUNASTERISK" != "yes" ];then
@@ -41,6 +64,19 @@
   PARAMS="$PARAMS -p"
 fi
 
+if [ "$AST_DUMPCORE" != "no" ]
+then
+	PARAMS="$PARAMS -g"
+	if [ "$CORE_PATTERN" != '' ]
+	then
+		echo "$CORE_PATTERN" >/proc/sys/kernel/core_pattern
+	fi
+	if [ -d "$DUMPCORE_DIR" ]
+	then
+		CHDIR_PARM="--chdir $AST_DUMPCORE_DIR"
+	fi
+fi
+
 if [ "x$USER" = "x" ]
 then
   echo "Error: empty USER name"
@@ -67,11 +103,16 @@
 
 test -x $DAEMON || exit 0
 
+if [ ! -d "$PIDFILE_DIR" ];then
+	mkdir "$PIDFILE_DIR"
+	chown $USER:$GROUP "$PIDFILE_DIR"
+fi
+
 set -e
 
-if [ ! -e `dirname $PIDFILE` ];then
-	mkdir `dirname $PIDFILE`
-	chown $USER.$GROUP `dirname $PIDFILE`
+if [ "$UMASK" != '' ]
+then
+	umask $UMASK
 fi
 
 status() {
@@ -85,6 +126,11 @@
 	fi
 }
 
+asterisk_rx() {
+	if ! status >/dev/null; then return 0; fi
+	$DAEMON -rx "$1"
+}
+
 case "$1" in
   debug)
 	# we add too many special parameters that I don't want to skip
@@ -110,10 +156,11 @@
 			exit 0
 		fi
 		start-stop-daemon --start --group $GROUP --pidfile "$PIDFILE" \
+			$CHDIR_PARM \
 			--exec $REALDAEMON -- $PARAMS
 	else
 		start-stop-daemon --start --group $GROUP --make-pidfile \
-			--pidfile "$ASTSAFE_PIDFILE" \
+			$CHDIR_PARM --pidfile "$ASTSAFE_PIDFILE" \
 			--exec $REALDAEMON -- $PARAMS
 	fi
 		
@@ -146,14 +193,14 @@
 	;;
   reload)
 	echo "Reloading $DESC configuration files."
-	$DAEMON -rx 'reload' || true
+	asterisk_rx 'reload'
 	;;
   logger-reload)
-	$DAEMON -rx 'logger reload' || true
+	asterisk_rx 'logger reload'
 	;;
   extensions-reload)
 	echo "Reloading $DESC configuration files."
-	$DAEMON -rx 'extensions reload' || true
+	asterisk_rx 'extensions reload'
 	;;
   restart|force-reload)
 	$0 stop

Modified: asterisk/branches/experimental/debian/changelog
===================================================================
--- asterisk/branches/experimental/debian/changelog	2007-03-24 22:15:40 UTC (rev 3333)
+++ asterisk/branches/experimental/debian/changelog	2007-03-25 15:00:55 UTC (rev 3334)
@@ -1,8 +1,10 @@
-asterisk (1:1.4.2~dfsg-3) UNRELEASED; urgency=low
+asterisk (1:1.4.2~dfsg-3) experimental; urgency=low
 
-  * NOT RELEASED YET
+  * Fix syntax of for dummy fetch (Closes: #416143).
+  * LSB init section in init.d script.
+  * Merge other init.d changes from trunk.
 
- -- Mark Purcell <msp at debian.org>  Sat, 24 Mar 2007 19:30:06 +0000
+ -- Tzafrir Cohen <tzafrir.cohen at xorcom.com>  Sun, 25 Mar 2007 16:19:37 +0200
 
 asterisk (1:1.4.2~dfsg-2) experimental; urgency=low
 

Modified: asterisk/branches/experimental/debian/rules
===================================================================
--- asterisk/branches/experimental/debian/rules	2007-03-24 22:15:40 UTC (rev 3333)
+++ asterisk/branches/experimental/debian/rules	2007-03-25 15:00:55 UTC (rev 3334)
@@ -44,7 +44,14 @@
 UPFILENAME := asterisk_$(UPVERSION).orig.tar.gz
 URL := http://ftp2.digium.com/pub/asterisk/releases/asterisk-$(UPVERSION).tar.gz
 
+# make sure we have 'fetch' . We need to have either wget or fetch
+# on the system. However it is generally not a good idea to actually
+# get remote tarballs at build time. So if nither wget nor fetch 
+# happen to be installed, the configure script will find a dummy
+# fetch script that always returns an error.
+FETCH_ENV = PATH=$$PATH:$(CURDIR)/debian/dummyprogs
 
+
 check-sounds:
 	( [ ! -f sounds/asterisk-moh-freeplay-wav.tar.gz ] && \
 	  [ ! -f sounds/fpm-calm-river.mp3 ] && \
@@ -75,19 +82,11 @@
 
 	#cd editline;./configure $(confflags)
 
-	# make sure we have 'fetch' . We need to have either wget or fetch
-	# on the system. However it is generally not a good idea to actually
-	# get remote tarballs at build time. So if nither wget nor fetch 
-	# happen to be installed, the configure script will find a dummy
-	# fetch script that always returns an error.
-	PATH=$$PATH:$(CURDIR)/debian/dummyprogs
-	export PATH
-
 	if [ ! -r configure.debian_sav ]; then cp -a configure configure.debian_sav; fi
 	#./bootstrap.sh # also runs autoonf. TODO: currently not needed.
 	
 	# Without --with-gsm the internal gsm will be used
-	./configure --with-gsm \
+	$(FETCH_ENV) ./configure --with-gsm \
 		--with-pwlib=/usr/share/pwlib/include/ --with-h323=/usr/share/openh323/ \
 		--host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
                 --prefix=/usr \
@@ -96,7 +95,7 @@
 
 
 menuselect.makeopts: config.status
-	$(MAKE) menuselect.makeopts
+	$(FETCH_ENV) $(MAKE) menuselect.makeopts
 	sed -i -e '/^MENUSELECT_MOH=/d' menuselect.makeopts
 
 	# some voodoo in order to get chan_h323 built, and make it in one
@@ -111,7 +110,7 @@
 	dh_testdir
 
 	# Add here command to compile/build the package.
-	$(MAKE) $(MAKEFLAGS)
+	$(FETCH_ENV) $(MAKE) $(MAKEFLAGS)
 	#$(MAKE) $(MAKEFLAGS) -C channels/h323 opt
 
 	touch $@
@@ -125,7 +124,7 @@
 	#  anything for this package.
 	#/usr/bin/docbook-to-man debian/asterisk.sgml > asterisk.1
 ifndef ASTERISK_NO_DOCS
-	$(MAKE) progdocs
+	$(FETCH_ENV) $(MAKE) progdocs
 endif
 
 	touch $@
@@ -164,7 +163,7 @@
 	dh_installdirs var/run/asterisk
 	
 	# Add here commands to install the package into debian/<packagename>
-	$(MAKE) DESTDIR=$(CURDIR)/debian/tmp install samples
+	$(FETCH_ENV) $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install samples
 	mkdir -p $(CURDIR)/debian/tmp/etc/default/
 	cp debian/asterisk.default $(CURDIR)/debian/tmp/etc/default/asterisk
 	mkdir -p $(CURDIR)/debian/tmp/usr/lib/cgi-bin/asterisk/




More information about the Pkg-voip-commits mailing list