blob: e500626e39fa29cf96dfb78bf7a97adbbe1fe4f7 [file] [log] [blame]
Harald Welte5882a9b2011-02-09 13:12:46 +01001#!/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.
13ERTS_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.
18ROOTDIR=${ERTS_BIN_DIR%/*/*}
19
20# Parse out release and erts info
21START_ERL=`cat $ROOTDIR/releases/start_erl.data`
22ERTS_VSN=${START_ERL% *}
23APP_VSN=${START_ERL#* }
24
25BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin
26EMU=beam
27PROGNAME=`echo $0 | sed 's/.*\\///'`
28CMD="$BINDIR/erlexec"
29export EMU
30export ROOTDIR
31export BINDIR
32export PROGNAME
33
34exec $CMD -boot $ROOTDIR/releases/$APP_VSN/start_clean ${1+"$@"}