aboutsummaryrefslogtreecommitdiffstats
path: root/priv/templates/bin.dtl
diff options
context:
space:
mode:
authornuex <[email protected]>2014-02-21 15:16:39 -0500
committernuex <[email protected]>2014-03-08 19:30:56 -0500
commit7703e99c8ef26988242907ef3253470317330c8c (patch)
treeb2f6784ea368762e9d1fff53f7d568ea10634dd6 /priv/templates/bin.dtl
parentf2fe3631a093f5d45aeef129ead37562ded9ec9c (diff)
downloadrelx-7703e99c8ef26988242907ef3253470317330c8c.tar.gz
relx-7703e99c8ef26988242907ef3253470317330c8c.tar.bz2
relx-7703e99c8ef26988242907ef3253470317330c8c.zip
add templates
Diffstat (limited to 'priv/templates/bin.dtl')
-rw-r--r--priv/templates/bin.dtl44
1 files changed, 44 insertions, 0 deletions
diff --git a/priv/templates/bin.dtl b/priv/templates/bin.dtl
new file mode 100644
index 0000000..9e0dfb6
--- /dev/null
+++ b/priv/templates/bin.dtl
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+set -e
+
+SCRIPT_DIR=`dirname $0`
+RELEASE_ROOT_DIR=`cd $SCRIPT_DIR/.. && pwd`
+REL_NAME={{ rel_name }}
+REL_VSN={{ rel_vsn }}
+ERTS_VSN={{ erts_vsn }}
+REL_DIR=$RELEASE_ROOT_DIR/releases/$REL_VSN
+ERL_OPTS={{ erl_opts }}
+
+find_erts_dir() {
+ local erts_dir=$RELEASE_ROOT_DIR/erts-$ERTS_VSN
+ if [ -d \"$erts_dir\" ]; then
+ ERTS_DIR=$erts_dir;
+ ROOTDIR=$RELEASE_ROOT_DIR
+ else
+ local erl=`which erl`
+ local erl_root=`$erl -noshell -eval \"io:format(\\\"~s\\\", [code:root_dir()]).\" -s init stop`
+ ERTS_DIR=$erl_root/erts-$ERTS_VSN
+ ROOTDIR=$erl_root
+ fi
+
+}
+
+find_sys_config() {
+ local possible_sys=$REL_DIR/sys.config
+ if [ -f \"$possible_sys\" ]; then
+ SYS_CONFIG=\"-config $possible_sys\"
+ fi
+}
+
+find_erts_dir
+find_sys_config
+export ROOTDIR=$RELEASE_ROOT_DIR
+export BINDIR=$ERTS_DIR/bin
+export EMU=beam
+export PROGNAME=erl
+export LD_LIBRARY_PATH=$ERTS_DIR/lib
+
+cd $ROOTDIR
+
+$BINDIR/erlexec $ERL_OPTS $SYS_CONFIG -boot $REL_DIR/$REL_NAME $@