| 1 | #!/bin/sh |
| 2 | |
| 3 | # /bin/sh on Solaris is not a POSIX compatible shell, but /usr/bin/ksh is. |
| 4 | if [ `uname -s` = 'SunOS' -a "${POSIX_SHELL}" != "true" ]; then |
| 5 | POSIX_SHELL="true" |
| 6 | export POSIX_SHELL |
| 7 | exec /usr/bin/ksh $0 "$@" |
| 8 | fi |
| 9 | |
| 10 | # clear it so if we invoke other scripts, they run as ksh as well |
| 11 | unset POSIX_SHELL |
| 12 | |
| 13 | ## This script replaces the default "erl" in erts-VSN/bin. This is |
| 14 | ## necessary as escript depends on erl and in turn, erl depends on |
| 15 | ## having access to a bootscript (start.boot). Note that this script |
| 16 | ## is ONLY invoked as a side-effect of running escript -- the embedded |
| 17 | ## node bypasses erl and uses erlexec directly (as it should). |
| 18 | ## |
| 19 | ## Note that this script makes the assumption that there is a |
| 20 | ## start_clean.boot file available in $ROOTDIR/release/VSN. |
| 21 | |
| 22 | # Determine the abspath of where this script is executing from. |
| 23 | ERTS_BIN_DIR=$(cd ${0%/*} && pwd -P) |
| 24 | |
| 25 | # Now determine the root directory -- this script runs from erts-VSN/bin, |
| 26 | # so we simply need to strip off two dirs from the end of the ERTS_BIN_DIR |
| 27 | # path. |
| 28 | ROOTDIR=${ERTS_BIN_DIR%/*/*} |
| 29 | |
| 30 | # Parse out release and erts info |
| 31 | START_ERL=`cat $ROOTDIR/releases/start_erl.data` |
| 32 | ERTS_VSN=${START_ERL% *} |
| 33 | APP_VSN=${START_ERL#* } |
| 34 | |
| 35 | BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin |
| 36 | EMU=beam |
| 37 | PROGNAME=`echo $0 | sed 's/.*\\///'` |
| 38 | CMD="$BINDIR/erlexec" |
| 39 | export EMU |
| 40 | export ROOTDIR |
| 41 | export BINDIR |
| 42 | export PROGNAME |
| 43 | |
| 44 | exec $CMD -boot $ROOTDIR/releases/$APP_VSN/start_clean ${1+"$@"} |