aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis Rascao <[email protected]>2016-11-05 22:11:44 +0000
committerLuis Rascao <[email protected]>2016-11-11 16:48:28 +0000
commitad6193884f09d29c7402de45214817dc195f5c6d (patch)
tree1a0df26cfd50d04b5be6b5fcb3e894a7e0ce65b0
parentc305c89713abf48570e2db152b367f00ac641893 (diff)
downloadrelx-ad6193884f09d29c7402de45214817dc195f5c6d.tar.gz
relx-ad6193884f09d29c7402de45214817dc195f5c6d.tar.bz2
relx-ad6193884f09d29c7402de45214817dc195f5c6d.zip
Refactor foreground command
Move it next to console since it's mostly the same thing but with extra parameters.
-rwxr-xr-xpriv/templates/extended_bin48
1 files changed, 14 insertions, 34 deletions
diff --git a/priv/templates/extended_bin b/priv/templates/extended_bin
index acf77b9..bd7342d 100755
--- a/priv/templates/extended_bin
+++ b/priv/templates/extended_bin
@@ -435,8 +435,9 @@ case "$1" in
"versions" "{'$REL_NAME', \"$NAME_TYPE\", '$NAME', '$COOKIE'}" "$@"
;;
- console|console_clean|console_boot)
+ console|console_clean|console_boot|foreground)
__code_paths=""
+ FOREGROUNDOPTIONS=""
# .boot file typically just $REL_NAME (ie, the app name)
# however, for debugging, sometimes start_clean.boot is useful.
# For e.g. 'setup', one may even want to name another boot script.
@@ -448,6 +449,16 @@ case "$1" in
BOOTFILE="$REL_DIR/start"
fi
;;
+ foreground)
+ # start up the release in the foreground for use by runit
+ # or other supervision services
+ if [ -f "$REL_DIR/$REL_NAME.boot" ]; then
+ BOOTFILE="$REL_DIR/$REL_NAME"
+ else
+ BOOTFILE="$REL_DIR/start"
+ fi
+ FOREGROUNDOPTIONS="-noshell -noinput +Bd"
+ ;;
console_clean)
__code_paths=$(relx_get_code_paths)
BOOTFILE="$ROOTDIR/bin/start_clean"
@@ -470,7 +481,8 @@ case "$1" in
# Build an array of arguments to pass to exec later on
# Build it here because this command will be used for logging.
- set -- "$BINDIR/erlexec" -boot "$BOOTFILE" -mode "$CODE_LOADING_MODE" \
+ set -- "$BINDIR/erlexec" $FOREGROUNDOPTIONS \
+ -boot "$BOOTFILE" -mode "$CODE_LOADING_MODE" \
-boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \
-config "$RELX_CONFIG_PATH" \
-args_file "$VMARGS_PATH" \
@@ -487,38 +499,6 @@ case "$1" in
# Start the VM
exec "$@" -- ${1+$ARGS}
;;
-
- foreground)
- # start up the release in the foreground for use by runit
- # or other supervision services
-
- [ -f "$REL_DIR/$REL_NAME.boot" ] && BOOTFILE="$REL_NAME" || BOOTFILE=start
- FOREGROUNDOPTIONS="-noshell -noinput +Bd"
-
- # Setup beam-required vars
- EMU=beam
- PROGNAME="${0#*/}"
-
- export EMU
- export PROGNAME
-
- # Store passed arguments since they will be erased by `set`
- ARGS="$@"
-
- # Build an array of arguments to pass to exec later on
- # Build it here because this command will be used for logging.
- set -- "$BINDIR/erlexec" $FOREGROUNDOPTIONS \
- -boot "$REL_DIR/$BOOTFILE" -mode "$CODE_LOADING_MODE" -config "$RELX_CONFIG_PATH" \
- -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \
- -args_file "$VMARGS_PATH"
-
- # Dump environment info for logging purposes
- echo "Exec: $@" -- ${1+$ARGS}
- echo "Root: $ROOTDIR"
-
- # Start the VM
- exec "$@" -- ${1+$ARGS}
- ;;
rpc)
# Make sure a node IS running
if ! relx_nodetool "ping" > /dev/null; then