mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 18:55:19 +00:00 
			
		
		
		
	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)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394939 65c4cc65-6c06-0410-ace0-fbb531ad65f3
			
			
This commit is contained in:
		| @@ -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}" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user