[asterisk-commits] tilghman: trunk r239231 - in /trunk: ./ contrib/init.d/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jan 11 17:00:59 CST 2010


Author: tilghman
Date: Mon Jan 11 17:00:55 2010
New Revision: 239231

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=239231
Log:
Permit more options in the Makefile as to startup options

Modified:
    trunk/Makefile
    trunk/contrib/init.d/rc.debian.asterisk
    trunk/contrib/init.d/rc.mandriva.asterisk
    trunk/contrib/init.d/rc.redhat.asterisk
    trunk/contrib/init.d/rc.suse.asterisk

Modified: trunk/Makefile
URL: http://svnview.digium.com/svn/asterisk/trunk/Makefile?view=diff&rev=239231&r1=239230&r2=239231
==============================================================================
--- trunk/Makefile (original)
+++ trunk/Makefile Mon Jan 11 17:00:55 2010
@@ -820,10 +820,12 @@
 		if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
 			cat contrib/init.d/rc.redhat.asterisk | sed 's|__ASTERISK_ETC_DIR__|$(ASTETCDIR)|;s|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > $(DESTDIR)/etc/rc.d/init.d/asterisk ;\
 			chmod 755 $(DESTDIR)/etc/rc.d/init.d/asterisk;\
+			if [ ! -f /etc/sysconfig/asterisk ]; then install -m 644 contrib/init.d/etc_default_asterisk /etc/sysconfig/asterisk ; fi ;\
 			if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \
 		elif [ -f /etc/debian_version ]; then \
 			cat contrib/init.d/rc.debian.asterisk | sed 's|__ASTERISK_ETC_DIR__|$(ASTETCDIR)|;s|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > $(DESTDIR)/etc/init.d/asterisk ;\
 			chmod 755 $(DESTDIR)/etc/init.d/asterisk;\
+			if [ ! -f /etc/default/asterisk ]; then install -m 644 contrib/init.d/etc_default_asterisk /etc/default/asterisk ; fi ;\
 			if [ -z "$(DESTDIR)" ]; then /usr/sbin/update-rc.d asterisk defaults 50 91; fi; \
 		elif [ -f /etc/gentoo-release ]; then \
 			cat contrib/init.d/rc.gentoo.asterisk | sed 's|__ASTERISK_ETC_DIR__|$(ASTETCDIR)|;s|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > $(DESTDIR)/etc/init.d/asterisk ;\
@@ -832,10 +834,12 @@
 		elif [ -f /etc/mandrake-release -o -f /etc/mandriva-release ]; then \
 			cat contrib/init.d/rc.mandriva.asterisk | sed 's|__ASTERISK_ETC_DIR__|$(ASTETCDIR)|;s|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > $(DESTDIR)/etc/rc.d/init.d/asterisk ;\
 			chmod 755 $(DESTDIR)/etc/rc.d/init.d/asterisk;\
+			if [ ! -f /etc/sysconfig/asterisk ]; then install -m 644 contrib/init.d/etc_default_asterisk /etc/sysconfig/asterisk ; fi ;\
 			if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \
 		elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
 			cat contrib/init.d/rc.suse.asterisk | sed 's|__ASTERISK_ETC_DIR__|$(ASTETCDIR)|;s|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > $(DESTDIR)/etc/init.d/asterisk ;\
 			chmod 755 $(DESTDIR)/etc/init.d/asterisk;\
+			if [ ! -f /etc/sysconfig/asterisk ]; then install -m 644 contrib/init.d/etc_default_asterisk /etc/sysconfig/asterisk ; fi ;\
 			if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \
 		elif [ -f /etc/arch-release -o -f /etc/arch-release ]; then \
 			cat contrib/init.d/rc.archlinux.asterisk | sed 's|__ASTERISK_ETC_DIR__|$(ASTETCDIR)|;s|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > $(DESTDIR)/etc/rc.d/asterisk ;\

Modified: trunk/contrib/init.d/rc.debian.asterisk
URL: http://svnview.digium.com/svn/asterisk/trunk/contrib/init.d/rc.debian.asterisk?view=diff&rev=239231&r1=239230&r2=239231
==============================================================================
--- trunk/contrib/init.d/rc.debian.asterisk (original)
+++ trunk/contrib/init.d/rc.debian.asterisk Mon Jan 11 17:00:55 2010
@@ -38,21 +38,6 @@
 # Description:		the Asterisk Open Source PBX
 ### END INIT INFO
 
-# Uncomment this ONLY if you know what you are doing.
-# export LD_ASSUME_KERNEL=2.4.1
-
-# Uncomment the following and set them to the user/groups that you
-# want to run Asterisk as. NOTE: this requires substantial work to
-# be sure that Asterisk's environment has permission to write the
-# files required  for  its  operation, including logs, its comm
-# socket, the asterisk database, etc.
-#AST_USER="asterisk"
-#AST_GROUP="asterisk"
-
-# If you DON'T want Asterisk to start up with terminal colors, comment
-# this out.
-COLOR=yes
-
 set -e
 
 if ! [ -x $DAEMON ] ; then
@@ -67,6 +52,15 @@
 
 # Use the LSB standar functions for services management
 . /lib/lsb/init-functions
+
+# Allow configuration overrides in /etc/default/asterisk
+CONFIG0=`readlink $0`
+if [ "$CONFIG0" = "" ]; then
+	CONFIGFILE=/etc/default/`basename $0`
+else
+	CONFIGFILE=/etc/default/`basename $CONFIG0`
+fi
+[ -r $CONFIGFILE ] && . $CONFIGFILE
 
 case "$1" in
   start)
@@ -90,6 +84,29 @@
 	if [ $AST_GROUP ] ; then
 		ASTARGS="$ASTARGS -G $AST_GROUP"
 		chgrp $AST_GROUP $ASTVARRUNDIR
+	fi
+	if [ $ALTCONF ]; then
+		ASTARGS="$ASTARGS -C \"$ALTCONF\""
+	fi
+	if [ "x$COREDUMP" = "xyes" ]; then
+		ASTARGS="$ASTARGS -g"
+	fi
+	if [ "0$MAXLOAD" -gt "0" ]; then
+		ASTARGS="$ASTARGS -L $MAXLOAD"
+	fi
+	if [ "0$MAXCALLS" -gt "0" ]; then
+		ASTARGS="$ASTARGS -M $MAXCALLS"
+	fi
+	if [ "0$VERBOSITY" -gt "0" ]; then
+		for i in `seq 1 $VERBOSITY`; do
+			ASTARGS="$ASTARGS -v"
+		done
+	fi
+	if [ "x$INTERNALTIMING" = "xyes" ]; then
+		ASTARGS="$ASTARGS -I"
+	fi
+	if [ "x$TEMPRECORDINGLOCATION" = "xyes" -o "x$TMPRECORDINGLOCATION" = "xyes" ]; then
+		ASTARGS="$ASTARGS -t"
 	fi
 	# "start-stop-daemon --oknodo" returns 0 even if Asterisk was already running (as LSB expects):
 	if test "x$COLOR" = "xyes" ; then

Modified: trunk/contrib/init.d/rc.mandriva.asterisk
URL: http://svnview.digium.com/svn/asterisk/trunk/contrib/init.d/rc.mandriva.asterisk?view=diff&rev=239231&r1=239230&r2=239231
==============================================================================
--- trunk/contrib/init.d/rc.mandriva.asterisk (original)
+++ trunk/contrib/init.d/rc.mandriva.asterisk Mon Jan 11 17:00:55 2010
@@ -37,7 +37,7 @@
 fi
 
 # Put overrides in /etc/sysconfig/asterisk
-[ -f $CONFIGFILE ] && . $CONFIGFILE
+[ -r $CONFIGFILE ] && . $CONFIGFILE
 
 LD_LIBRARY_PATH=$OPENH323DIR/lib:$PWLIBDIR/lib
 export OPENH323DIR PWLIBDIR LD_LIBRARY_PATH

Modified: trunk/contrib/init.d/rc.redhat.asterisk
URL: http://svnview.digium.com/svn/asterisk/trunk/contrib/init.d/rc.redhat.asterisk?view=diff&rev=239231&r1=239230&r2=239231
==============================================================================
--- trunk/contrib/init.d/rc.redhat.asterisk (original)
+++ trunk/contrib/init.d/rc.redhat.asterisk Mon Jan 11 17:00:55 2010
@@ -26,14 +26,6 @@
 # Installation directory
 AST_SBIN=/usr/sbin
 
-# Uncomment the following and set them to the user/groups that you
-# want to run Asterisk as. NOTE: this requires substantial work to
-# be sure that Asterisk's environment has permission to write the
-# files required  for  its  operation, including logs, its comm
-# socket, the asterisk database, etc.
-#AST_USER="asterisk"
-#AST_GROUP="asterisk"
-
 # Source function library.
 . /etc/rc.d/init.d/functions
 
@@ -46,9 +38,6 @@
 	echo "ERROR: $AST_CONFIG directory not found"
 	exit 0
 fi
-
-# Uncomment this ONLY if you know what you are doing.
-# export LD_ASSUME_KERNEL=2.4.1
 
 # Full path to asterisk binary
 DAEMON=$AST_SBIN/asterisk
@@ -63,7 +52,7 @@
 else
 	CONFIGFILE=/etc/sysconfig/`basename $CONFIG0`
 fi
-[ -x $CONFIGFILE ] && . $CONFIGFILE
+[ -r $CONFIGFILE ] && . $CONFIGFILE
 
 RETVAL=0
 
@@ -89,8 +78,35 @@
 	fi
 	if [ $AST_CONFIG ]; then
 		ASTARGS="$ASTARGS -C $AST_CONFIG/asterisk.conf"
+	elif [ $ALTCONF ]; then
+		ASTARGS="$ASTARGS -C $ALTCONF"
 	fi
-	daemon $DAEMON $ASTARGS
+	if [ "x$COREDUMP" = "xyes" ]; then
+		ASTARGS="$ASTARGS -g"
+	fi
+	if [ "0$MAXLOAD" -gt "0" ]; then
+		ASTARGS="$ASTARGS -L $MAXLOAD"
+	fi
+	if [ "0$MAXCALLS" -gt "0" ]; then
+		ASTARGS="$ASTARGS -M $MAXCALLS"
+	fi
+	if [ "0$VERBOSITY" -gt "0" ]; then
+		for i in `seq 1 $VERBOSITY`; do
+			ASTARGS="$ASTARGS -v"
+		done
+	fi
+	if [ "x$INTERNALTIMING" = "xyes" ]; then
+		ASTARGS="$ASTARGS -I"
+	fi
+	if [ "x$TEMPRECORDINGLOCATION" = "xyes" -o "x$TMPRECORDINGLOCATION" = "xyes" ]; then
+		ASTARGS="$ASTARGS -t"
+	fi
+	if [ "x$COLOR" = "xyes" ]; then
+		export TERM=linux
+		daemon sh -c "$DAEMON $ASTARGS -c" >/dev/null </dev/null 2>&1 &
+	else
+		daemon $DAEMON $ASTARGS
+	fi
 	RETVAL=$?
 	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/asterisk
 	echo

Modified: trunk/contrib/init.d/rc.suse.asterisk
URL: http://svnview.digium.com/svn/asterisk/trunk/contrib/init.d/rc.suse.asterisk?view=diff&rev=239231&r1=239230&r2=239231
==============================================================================
--- trunk/contrib/init.d/rc.suse.asterisk (original)
+++ trunk/contrib/init.d/rc.suse.asterisk Mon Jan 11 17:00:55 2010
@@ -59,6 +59,15 @@
 #AST_USER="asterisk"
 #AST_GROUP="asterisk"
 
+# Allow configuration overrides in /etc/sysconfig/asterisk
+CONFIG0=`readlink $0`
+if [ "$CONFIG0" = "" ]; then
+	CONFIGFILE=/etc/sysconfig/`basename $0`
+else
+	CONFIGFILE=/etc/sysconfig/`basename $CONFIG0`
+fi
+[ -r $CONFIGFILE ] && . $CONFIGFILE
+
 RETVAL=0
 
 start() {
@@ -82,7 +91,35 @@
 	if [ $AST_GROUP ] ; then
 		ASTARGS="`echo $ASTARGS` -G $AST_GROUP"
 	fi
-	$DAEMON $ASTARGS
+	if [ $ALTCONF ]; then
+		ASTARGS="$ASTARGS -C $ALTCONF"
+	fi
+	if [ "x$COREDUMP" = "xyes" ]; then
+		ASTARGS="$ASTARGS -g"
+	fi
+	if [ "0$MAXLOAD" -gt "0" ]; then
+		ASTARGS="$ASTARGS -L $MAXLOAD"
+	fi
+	if [ "0$MAXCALLS" -gt "0" ]; then
+		ASTARGS="$ASTARGS -M $MAXCALLS"
+	fi
+	if [ "$VERBOSITY" -gt "0" ]; then
+		for i in `seq 1 $VERBOSITY`; do
+			ASTARGS="$ASTARGS -v"
+		done
+	fi
+	if [ "x$INTERNALTIMING" = "xyes" ]; then
+		ASTARGS="$ASTARGS -I"
+	fi
+	if [ "x$TEMPRECORDINGLOCATION" = "xyes" -o "x$TMPRECORDINGLOCATION" = "xyes" ]; then
+		ASTARGS="$ASTARGS -t"
+	fi
+	if [ "x$COLOR" = "xyes" ]; then
+		export TERM=linux
+		sh -c "$DAEMON $ASTARGS -c" >/dev/null </dev/null 2>&1 &
+	else
+		$DAEMON $ASTARGS
+	fi
 	RETVAL=$?
 	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/asterisk
 	echo




More information about the asterisk-commits mailing list