25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01:00

New "make dev" and "./ejabberdctl" (requires using rebar3)

This commit is contained in:
Badlop 2021-06-25 12:40:26 +02:00
parent 21b021d912
commit 0fe2aea709
5 changed files with 52 additions and 1 deletions

1
.gitignore vendored
View File

@ -17,6 +17,7 @@
/ebin/
/ejabberd.init
/ejabberd.service
/ejabberdctl
/ejabberdctl.example
/rel/ejabberd/
/src/eldap_filter_yecc.erl

View File

@ -362,6 +362,11 @@ distclean: clean clean-rel
rel:
$(REBAR) $(REBARREL)
DEV_CONFIG = _build/dev/rel/ejabberd/etc/ejabberd/ejabberd.yml
dev $(DEV_CONFIG):
REBAR_PROFILE=dev rebar3 release
TAGS:
etags *.erl

View File

@ -192,7 +192,17 @@
{overlay, [{copy, "sql/*", "lib/ejabberd-\{\{release_version\}\}/priv/sql/"},
{copy, "ejabberdctl.cfg.example", "etc/ejabberd/ejabberdctl.cfg"},
{copy, "ejabberd.yml.example", "etc/ejabberd/ejabberd.yml"}]}]}]},
{dev, [{post_hooks, [{release, "rel/setup-dev.sh"}]},
{relx, [{dev_mode, true},
{debug_info, keep},
{include_erts, true},
{include_src, false},
{overlay, [{copy, "ejabberdctl.cfg.example", "etc/ejabberd/ejabberdctl.cfg.example"},
{copy, "ejabberd.yml.example", "etc/ejabberd/ejabberd.yml.example"},
{copy, "test/ejabberd_SUITE_data/ca.pem", "etc/ejabberd/"},
{copy, "test/ejabberd_SUITE_data/cert.pem", "etc/ejabberd/"}]}]}]},
{test, [{erl_opts, [nowarn_export_all]}]}]}.
%% Local Variables:
%% mode: erlang
%% End:

View File

@ -341,10 +341,14 @@ end,
ProcessRelx = fun(Relx, Deps) ->
{value, {release, NameVersion, DefaultApps}, RelxTail} = lists:keytake(release, 1, Relx),
ProfileApps = case os:getenv("REBAR_PROFILE") of
"dev" -> [observer, runtime_tools, wx, debugger];
_ -> []
end,
DepApps = lists:map(fun({DepName, _, _}) -> DepName;
({DepName, _}) -> DepName
end, Deps),
[{release, NameVersion, DefaultApps ++ DepApps} | RelxTail]
[{release, NameVersion, DefaultApps ++ ProfileApps ++ DepApps} | RelxTail]
end,
GithubConfig = case {os:getenv("GITHUB_ACTIONS"), os:getenv("GITHUB_TOKEN")} of

31
rel/setup-dev.sh Executable file
View File

@ -0,0 +1,31 @@
echo -n "===> Preparing dev configuration files: "
PWD=`pwd`
REL_DIR=$PWD/_build/dev/rel/
CON_DIR=$REL_DIR/ejabberd/etc/ejabberd/
BIN_DIR=$REL_DIR/ejabberd/bin/
CTLPATH=$BIN_DIR/ejabberdctl
[ ! -f "ejabberdctl" ] \
&& echo -n "ejabberdctl " \
&& ln -s $CTLPATH ejabberdctl \
&& (cd $BIN_DIR && sed -i "s|^SCRIPT_DIR=.*|SCRIPT_DIR=`pwd`|g" ejabberdctl)
cd $CON_DIR
[ ! -f "ejabberd.yml" ] \
&& echo -n "ejabberd.yml " \
&& mv ejabberd.yml.example ejabberd.yml \
&& sed -i "s|# certfiles:|certfiles:\n - $CON_DIR/cert.pem|g" ejabberd.yml \
&& sed -i "s|certfiles:|ca_file: $CON_DIR/ca.pem\ncertfiles:|g" ejabberd.yml \
&& sed -i 's|^acl:$|acl:\n admin: [user: admin]|g' ejabberd.yml \
|| rm ejabberd.yml.example
[ ! -f "ejabberdctl.cfg" ] \
&& echo -n "ejabberdctl.cfg " \
&& mv ejabberdctl.cfg.example ejabberdctl.cfg \
&& sed -i "s|#' POLL|EJABBERD_BYPASS_WARNINGS=true\n\n#' POLL|g" ejabberdctl.cfg \
|| rm ejabberdctl.cfg.example
echo ""
echo "===> Now you can start this ejabberd dev with: ./ejabberdctl live"