Skip to content

Commit

Permalink
Merge pull request #194 from basho/develop
Browse files Browse the repository at this point in the history
Merge latest changes into 2.0
  • Loading branch information
gcymbalski committed Dec 7, 2015
2 parents 0301e5f + c8e4b41 commit 2fca13d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
14 changes: 13 additions & 1 deletion README.org
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ your application's =vars.config=.
**** Optional Variables
- =runner_ulimit_warn= - The runner script will warn if `ulimit -n` is less than
this value. This defaults to 4096 in all packages.
- =platform_patch_dir= - Directory to include in erlang's load path to allow for
- =package_patch_dir= - Directory to include in erlang's load path to allow for
patches to be hotloaded. By default this will be in the =platform_lib_dir=
(ex: "basho-patches")
- =runner_user= - The username to run the application as
Expand Down Expand Up @@ -124,3 +124,15 @@ So, if you want to have a variable persist all the way through to the
final reltool step, the variable needs to be set in pkg.vars.config
(or defaulted in <osname>.template) AND be present in the vars.config,
so it can be applied to the reltool templates.

*** Example App

The easiest app that uses =node_package= is [[https://github.com/basho/stanchion][stanchion]] a small application that Basho uses along side Riak CS.

In particular, see:

- [[https://github.com/basho/stanchion/blob/develop/pkg.vars.config][pkg.vars.config]]
- [[https://github.com/basho/stanchion/blob/develop/Makefile#L73][makefile]]
- [[https://github.com/basho/stanchion/blob/develop/rel/reltool.config#L46][reltool.config]]

It also has custom settings in its [[https://github.com/basho/stanchion/blob/develop/rel/vars.config#L31][vars.config]] for adjusting settings in the =bin/stanchion= that comes from node_package's =runner= script.
13 changes: 10 additions & 3 deletions priv/base/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,14 @@ fi
# Registered process to wait for to consider start a success
WAIT_FOR_PROCESS={{runner_wait_process}}

WHOAMI=`whoami`
WHOAMI=`id -un`

# erlexec requires HOME to be set. The username needs to be a
# unquoted literal because of the tilde expansion, hence the
# usage of eval.
if [ -z "$HOME" ]; then
export HOME=`eval echo "~$WHOAMI"`
fi

# Echo to stderr on errors
echoerr() { echo "$@" 1>&2; }
Expand Down Expand Up @@ -231,8 +238,8 @@ check_user() {
# riak-admin bucket-type create mytype {props: {n_val: 4}}
# after the arguments were passed into the new shell during exec su
#
# So this regex finds any '"', '{', or '}' and prepends with a '\'
ESCAPED_ARGS=`echo "$@" | sed -e 's/\([{}"]\)/\\\\\1/g'`
# So this regex finds any '(', ')', "'" , '"', '{', or '}' and prepends with a '\'
ESCAPED_ARGS=$(echo "$@" | sed -e "s/\([\\\(\\\){}\"']\)/\\\\\1/g")

# This will drop priviledges into the runner user
# It exec's in a new shell and the current shell will exit
Expand Down
9 changes: 7 additions & 2 deletions priv/base/nodetool
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,13 @@ process_args([Arg | Rest], Acc, Opts) ->


start_epmd() ->
[] = os:cmd(epmd_path() ++ " -daemon"),
ok.
case os:getenv("NO_EPMD") of
false ->
[] = os:cmd(epmd_path() ++ " -daemon"),
ok;
_ ->
ok
end.

epmd_path() ->
ErtsBinDir = filename:dirname(escript:script_name()),
Expand Down

0 comments on commit 2fca13d

Please sign in to comment.