[svn-commits] tzafrir: trunk r370048 - /trunk/contrib/scripts/live_ast

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jul 12 19:05:51 CDT 2012


Author: tzafrir
Date: Thu Jul 12 19:05:46 2012
New Revision: 370048

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=370048
Log:
live_ast: don't set working directory

contrib/scripts/live_ast currently assumes that it is being run from the
top-level directory of the source tree. It creates a script that will
also set the working directory.

This fix avoids the need to set the working directory if the caller sets
LIVE_AST_BASE_DIR instead.

It relies on realpath for that. If realpath is not available, it will
fall back to the original behaviour.

Review: https://reviewboard.asterisk.org/r/2027/

Modified:
    trunk/contrib/scripts/live_ast

Modified: trunk/contrib/scripts/live_ast
URL: http://svnview.digium.com/svn/asterisk/trunk/contrib/scripts/live_ast?view=diff&rev=370048&r1=370047&r2=370048
==============================================================================
--- trunk/contrib/scripts/live_ast (original)
+++ trunk/contrib/scripts/live_ast Thu Jul 12 19:05:46 2012
@@ -110,7 +110,7 @@
 #LIVE_AST_FOR_SYSTEM=yes
 ####################### End Samples
 
-BASE_DIR="$PWD/live"
+BASE_DIR="${AST_LIVE_BASE_DIR:-$PWD/live}"
 AST_CONF_DIR="$BASE_DIR/etc/asterisk"
 AST_CONF="$AST_CONF_DIR/asterisk.conf"
 AST_BIN="$BASE_DIR/usr/sbin/asterisk"
@@ -180,9 +180,19 @@
   cat <<EOF >"$BASE_DIR/asterisk"
 #!/bin/sh
 # a wrapper to run asterisk from the "live" copy:
+EOF
+  if realpath $0 >/dev/null 2>&1; then
+    cat <<EOF >>"$BASE_DIR/asterisk"
+export AST_LIVE_BASE_DIR="$PWD/live"
+real_me='`realpath $0`'
+exec "\$real_me" run "\$@"
+EOF
+  else # No realpath. Fall back to change working directory:
+    cat <<EOF >>"$BASE_DIR/asterisk"
 cd "$PWD"
 exec "$0" run "\$@"
 EOF
+  fi
 }
 
 command="$1"




More information about the svn-commits mailing list