summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES12
-rw-r--r--Makefile4
-rw-r--r--configs/safe_asterisk.conf.sample20
-rw-r--r--contrib/scripts/safe_asterisk46
4 files changed, 63 insertions, 19 deletions
diff --git a/CHANGES b/CHANGES
index c5f11a531..e482cad72 100644
--- a/CHANGES
+++ b/CHANGES
@@ -581,6 +581,18 @@ XMPP
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 --------------------
------------------------------------------------------------------------------
diff --git a/Makefile b/Makefile
index d896c3e36..6ee702b6e 100644
--- a/Makefile
+++ b/Makefile
@@ -558,8 +558,8 @@ main-bininstall:
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
diff --git a/configs/safe_asterisk.conf.sample b/configs/safe_asterisk.conf.sample
new file mode 100644
index 000000000..9e560f3a5
--- /dev/null
+++ b/configs/safe_asterisk.conf.sample
@@ -0,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
+
diff --git a/contrib/scripts/safe_asterisk b/contrib/scripts/safe_asterisk
index 2e661b476..822e1c8cd 100644
--- a/contrib/scripts/safe_asterisk
+++ b/contrib/scripts/safe_asterisk
@@ -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 @@ RUNDIR=${RUNDIR:-/tmp}
SLEEPSECS=4
ASTPIDFILE=${ASTVARRUNDIR}/asterisk.pid
-# comment this line out to have this script _not_ kill all mpg123 processes when
-# asterisk exits
-KILLALLMPG123=1
+# Obtain parameters from the safe_asterisk.conf file in the
+# ASTETCDIR directory
-# run asterisk with this priority
-PRIORITY=0
+kvalue=`grep ^KILLALLMPG123= $ASTETCDIR 2>/dev/null | cut -c 15`
+if test "x$kvalue" != "x" ; then
+ KILLALLMPG123=$kvalue
+else
+ KILLALLMPG123=0
+fi
-# set system filemax on supported OSes if this variable is set
-# SYSMAXFILES=262144
+pvalue=`grep ^PRIORITY= $ASTETCDIR 2>/dev/null | cut -c 10`
+if test "x$pvalue" != "x" ; then
+ PRIORITY=$pvalue
+else
+ PRIORITY=0
+fi
-# Asterisk allows full permissions by default, so set a umask, if you want
-# restricted permissions.
-#UMASK=022
+svalue=`grep ^SYSMAXFILES= $ASTETCDIR 2>/dev/null | cut -c 13-21`
+if test "x$svalue" != "x" ; then
+ SYSMAXFILES=$svalue
+fi
-# 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
+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 @@ else
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 @@ if test ! -d "${RUNDIR}" ; then
fi
fi
-if test ! -w "${DUMPDROP}" ; then
+if test ! -w "${DUMPDROP}" ; then
message "Cannot write to ${DUMPDROP}"
exit 1
fi
@@ -157,7 +169,7 @@ fi
run_asterisk()
{
- while :; do
+ while :; do
if test "x$TTY" != "x" ; then
cd "${RUNDIR}"