[svn-commits] mjordan: trunk r394939 - in /trunk: ./ configs/ contrib/scripts/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun Jul 21 13:12:04 CDT 2013


Author: mjordan
Date: Sun Jul 21 13:12:00 2013
New Revision: 394939

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=394939
Log:
Always install safe_asterisk; add configuration file support

This patch modifies the behavior of safe_asterisk in two ways:
(1) It modifies the Asterisk Makefile such that safe_asterisk is always
    installed on a 'make install'. This was done as bugfixes in the
    safe_asterisk script were not applied in previous version of Asterisk
    without first removing the old version of the script.
(2) In order to keep a newly installed version of safe_asterisk from impacting
    local modifications, a new config file - safe_asterisk.conf.sample - has
    been provided. Settings that were previously modified in safe_asterisk can
    be set there instead.

(closes issue ASTERISK-21965)
Reported by: Jeremy Kister
patches:
  safe_asterisk.patch uploaded by jkister (License 6232)

Added:
    trunk/configs/safe_asterisk.conf.sample   (with props)
Modified:
    trunk/CHANGES
    trunk/Makefile
    trunk/contrib/scripts/safe_asterisk

Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=394939&r1=394938&r2=394939
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Sun Jul 21 13:12:00 2013
@@ -580,6 +580,18 @@
    If no resources exist or all are unavailable the device state is considered
    to be unavailable.
 
+
+Scripts
+------------------
+
+safe_asterisk
+------------------
+ * The safe_asterisk script will now install over previously installations.
+   In previous versions of Asterisk, once installed a 'make install' would
+   skip over safe_asterisk if it was already installed.
+ * Certain options in safe_asterisk can now be configured from the
+   safe_asterisk.conf file. A sample version of this is located in the
+   configs/ folder.
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 10 to Asterisk 11 --------------------

Modified: trunk/Makefile
URL: http://svnview.digium.com/svn/asterisk/trunk/Makefile?view=diff&rev=394939&r1=394938&r2=394939
==============================================================================
--- trunk/Makefile (original)
+++ trunk/Makefile Sun Jul 21 13:12:00 2013
@@ -558,8 +558,8 @@
 bininstall: _all installdirs $(SUBDIRS_INSTALL) main-bininstall
 	$(INSTALL) -m 755 contrib/scripts/astgenkey "$(DESTDIR)$(ASTSBINDIR)/"
 	$(INSTALL) -m 755 contrib/scripts/autosupport "$(DESTDIR)$(ASTSBINDIR)/"
-	if [ ! -f "$(DESTDIR)$(ASTSBINDIR)/safe_asterisk" -a ! -f /sbin/launchd ]; then \
-		cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;s|__ASTERISK_LOG_DIR__|$(ASTLOGDIR)|;' > contrib/scripts/safe.tmp ; \
+	if [ ! -f /sbin/launchd ]; then \
+		cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;s|__ASTERISK_LOG_DIR__|$(ASTLOGDIR)|;s|__ASTERISK_ETC_DIR__|$(ASTETCDIR)|;' > contrib/scripts/safe.tmp ; \
 		$(INSTALL) -m 755 contrib/scripts/safe.tmp "$(DESTDIR)$(ASTSBINDIR)/safe_asterisk" ; \
 		rm -f contrib/scripts/safe.tmp ; \
 	fi

Added: trunk/configs/safe_asterisk.conf.sample
URL: http://svnview.digium.com/svn/asterisk/trunk/configs/safe_asterisk.conf.sample?view=auto&rev=394939
==============================================================================
--- trunk/configs/safe_asterisk.conf.sample (added)
+++ trunk/configs/safe_asterisk.conf.sample Sun Jul 21 13:12:00 2013
@@ -1,0 +1,20 @@
+Used by safe_asterisk startup script
+
+# comment this line out to have this script _not_ kill all mpg123 processes when
+# asterisk exits
+KILLALLMPG123=1
+
+# run asterisk with this priority
+PRIORITY=0
+
+# set system filemax on supported OSes if this variable is set
+# SYSMAXFILES=262144
+
+# Asterisk allows full permissions by default, so set a umask, if you want
+# restricted permissions.
+# UMASK=022
+
+# set max files open with ulimit. On linux systems, this will be automatically
+# set to the system's maximum files open devided by two, if not set here.
+# MAXFILES=32768
+

Propchange: trunk/configs/safe_asterisk.conf.sample
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: trunk/configs/safe_asterisk.conf.sample
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: trunk/configs/safe_asterisk.conf.sample
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: trunk/contrib/scripts/safe_asterisk
URL: http://svnview.digium.com/svn/asterisk/trunk/contrib/scripts/safe_asterisk?view=diff&rev=394939&r1=394938&r2=394939
==============================================================================
--- trunk/contrib/scripts/safe_asterisk (original)
+++ trunk/contrib/scripts/safe_asterisk Sun Jul 21 13:12:00 2013
@@ -1,6 +1,7 @@
 #!/bin/sh
 # vim:textwidth=80:tabstop=4:shiftwidth=4:smartindent:autoindent
 
+ASTETCDIR=__ASTERISK_ETC_DIR__
 ASTSBINDIR=__ASTERISK_SBIN_DIR__
 ASTVARRUNDIR=__ASTERISK_VARRUN_DIR__
 ASTVARLOGDIR=__ASTERISK_LOG_DIR__
@@ -19,23 +20,32 @@
 SLEEPSECS=4
 ASTPIDFILE=${ASTVARRUNDIR}/asterisk.pid
 
-# comment this line out to have this script _not_ kill all mpg123 processes when
-# asterisk exits
-KILLALLMPG123=1
-
-# run asterisk with this priority
-PRIORITY=0
-
-# set system filemax on supported OSes if this variable is set
-# SYSMAXFILES=262144
-
-# Asterisk allows full permissions by default, so set a umask, if you want
-# restricted permissions.
-#UMASK=022
-
-# set max files open with ulimit. On linux systems, this will be automatically
-# set to the system's maximum files open devided by two, if not set here.
-# MAXFILES=32768
+# Obtain parameters from the safe_asterisk.conf file in the
+# ASTETCDIR directory
+
+kvalue=`grep ^KILLALLMPG123= $ASTETCDIR 2>/dev/null | cut -c 15`
+if test "x$kvalue" != "x" ; then
+    KILLALLMPG123=$kvalue
+else
+    KILLALLMPG123=0
+fi
+
+pvalue=`grep ^PRIORITY= $ASTETCDIR 2>/dev/null | cut -c 10`
+if test "x$pvalue" != "x" ; then
+    PRIORITY=$pvalue
+else
+    PRIORITY=0
+fi
+
+svalue=`grep ^SYSMAXFILES= $ASTETCDIR 2>/dev/null | cut -c 13-21`
+if test "x$svalue" != "x" ; then
+    SYSMAXFILES=$svalue
+fi
+
+mvalue=`grep ^MAXFILES= $ASTETCDIR 2>/dev/null | cut -c 10-15`
+if test "x$mvalue" != "x" ; then
+    MAXFILES=$mvalue
+fi
 
 message() {
 	echo "$1" >&2
@@ -96,8 +106,10 @@
 
 fi
 
-if test "x$UMASK" != "x"; then
-	umask $UMASK
+
+uvalue=`grep ^UMASK= $ASTETCDIR 2>/dev/null | cut -c 7-10`
+if test "x$uvalue" != "x" ; then
+    umask $uvalue
 fi
 
 #
@@ -133,7 +145,7 @@
 	fi
 fi
 
-if test ! -w "${DUMPDROP}" ; then	
+if test ! -w "${DUMPDROP}" ; then
 	message "Cannot write to ${DUMPDROP}"
 	exit 1
 fi
@@ -157,7 +169,7 @@
 
 run_asterisk()
 {
-	while :; do 
+	while :; do
 
 		if test "x$TTY" != "x" ; then
 			cd "${RUNDIR}"




More information about the svn-commits mailing list