Harald Welte | 5882a9b | 2011-02-09 13:12:46 +0100 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |
| 3 | ## This script replaces the default "erl" in erts-VSN/bin. This is necessary |
| 4 | ## as escript depends on erl and in turn, erl depends on having access to a |
| 5 | ## bootscript (start.boot). Note that this script is ONLY invoked as a side-effect |
| 6 | ## of running escript -- the embedded node bypasses erl and uses erlexec directly |
| 7 | ## (as it should). |
| 8 | ## |
| 9 | ## Note that this script makes the assumption that there is a start_clean.boot |
| 10 | ## file available in $ROOTDIR/release/VSN. |
| 11 | |
| 12 | # Determine the abspath of where this script is executing from. |
| 13 | ERTS_BIN_DIR=$(cd ${0%/*} && pwd) |
| 14 | |
| 15 | # Now determine the root directory -- this script runs from erts-VSN/bin, |
| 16 | # so we simply need to strip off two dirs from the end of the ERTS_BIN_DIR |
| 17 | # path. |
| 18 | ROOTDIR=${ERTS_BIN_DIR%/*/*} |
| 19 | |
| 20 | # Parse out release and erts info |
| 21 | START_ERL=`cat $ROOTDIR/releases/start_erl.data` |
| 22 | ERTS_VSN=${START_ERL% *} |
| 23 | APP_VSN=${START_ERL#* } |
| 24 | |
| 25 | BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin |
| 26 | EMU=beam |
| 27 | PROGNAME=`echo $0 | sed 's/.*\\///'` |
| 28 | CMD="$BINDIR/erlexec" |
| 29 | export EMU |
| 30 | export ROOTDIR |
| 31 | export BINDIR |
| 32 | export PROGNAME |
| 33 | |
| 34 | exec $CMD -boot $ROOTDIR/releases/$APP_VSN/start_clean ${1+"$@"} |