refactor(bin/emqx): remove unnecessary intermediate env variables

This commit is contained in:
Zaiming (Stone) Shi 2022-04-13 13:49:11 +02:00
parent 438be98e15
commit 72405f977c
2 changed files with 8 additions and 10 deletions

View File

@ -31,8 +31,7 @@ mkdir -p "$RUNNER_LOG_DIR"
# hocon try to read environment variables starting with "EMQX_" # hocon try to read environment variables starting with "EMQX_"
export HOCON_ENV_OVERRIDE_PREFIX='EMQX_' export HOCON_ENV_OVERRIDE_PREFIX='EMQX_'
export ROOTDIR="$RUNNER_ROOT_DIR" export ERTS_DIR="$RUNNER_ROOT_DIR/erts-$ERTS_VSN"
export ERTS_DIR="$ROOTDIR/erts-$ERTS_VSN"
export BINDIR="$ERTS_DIR/bin" export BINDIR="$ERTS_DIR/bin"
export EMU="beam" export EMU="beam"
export PROGNAME="erl" export PROGNAME="erl"
@ -113,7 +112,7 @@ usage() {
echo "This command is mostly used for troubleshooting." echo "This command is mostly used for troubleshooting."
;; ;;
ertspath) ertspath)
echo "Print path to Erlang runtime dir" echo "Print path to Erlang runtime bin dir"
;; ;;
rpc) rpc)
echo "Usge $REL_NAME rpc MODULE FUNCTION [ARGS, ...]" echo "Usge $REL_NAME rpc MODULE FUNCTION [ARGS, ...]"
@ -341,7 +340,7 @@ relx_gen_id() {
} }
call_nodetool() { call_nodetool() {
"$ERTS_DIR/bin/escript" "$ROOTDIR/bin/nodetool" "$@" "$ERTS_DIR/bin/escript" "$RUNNER_ROOT_DIR/bin/nodetool" "$@"
} }
# Control a node # Control a node
@ -388,7 +387,7 @@ check_license() {
# Run an escript in the node's environment # Run an escript in the node's environment
relx_escript() { relx_escript() {
shift; scriptpath="$1"; shift shift; scriptpath="$1"; shift
"$ERTS_DIR/bin/escript" "$ROOTDIR/$scriptpath" "$@" "$ERTS_DIR/bin/escript" "$RUNNER_ROOT_DIR/$scriptpath" "$@"
} }
# Output a start command for the last argument of run_erl # Output a start command for the last argument of run_erl
@ -598,7 +597,7 @@ case "${COMMAND}" in
IS_BOOT_COMMAND='yes' IS_BOOT_COMMAND='yes'
;; ;;
ertspath) ertspath)
echo "$ERTS_PATH" echo "$ERTS_DIR"
exit 0 exit 0
;; ;;
*) *)
@ -676,7 +675,7 @@ if [[ "${EMQX_DB__BACKEND:-}" != "mnesia"
fi fi
fi fi
cd "$ROOTDIR" cd "$RUNNER_ROOT_DIR"
case "${COMMAND}" in case "${COMMAND}" in
start) start)
@ -798,7 +797,7 @@ case "${COMMAND}" in
assert_node_alive assert_node_alive
ERL_FLAGS="${ERL_FLAGS:-} $EPMD_ARG" \ ERL_FLAGS="${ERL_FLAGS:-} $EPMD_ARG" \
exec "$BINDIR/escript" "$ROOTDIR/bin/install_upgrade.escript" \ exec "$BINDIR/escript" "$RUNNER_ROOT_DIR/bin/install_upgrade.escript" \
"$COMMAND" "{'$REL_NAME', \"$NAME_TYPE\", '$NAME', '$COOKIE'}" "$@" "$COMMAND" "{'$REL_NAME', \"$NAME_TYPE\", '$NAME', '$COOKIE'}" "$@"
;; ;;
@ -808,7 +807,7 @@ case "${COMMAND}" in
shift shift
ERL_FLAGS="${ERL_FLAGS:-} $EPMD_ARG" \ ERL_FLAGS="${ERL_FLAGS:-} $EPMD_ARG" \
exec "$BINDIR/escript" "$ROOTDIR/bin/install_upgrade.escript" \ exec "$BINDIR/escript" "$RUNNER_ROOT_DIR/bin/install_upgrade.escript" \
"versions" "{'$REL_NAME', \"$NAME_TYPE\", '$NAME', '$COOKIE'}" "$@" "versions" "{'$REL_NAME', \"$NAME_TYPE\", '$NAME', '$COOKIE'}" "$@"
;; ;;

View File

@ -19,6 +19,5 @@ export EMQX_DESCRIPTION='{{ emqx_description }}'
## computed vars ## computed vars
REL_NAME="emqx" REL_NAME="emqx"
ERTS_PATH="$RUNNER_ROOT_DIR/erts-$ERTS_VSN/bin"
## updated vars here ## updated vars here