From adbccbe852e3d9980e531ff206bebd6b2c983fba Mon Sep 17 00:00:00 2001 From: Badlop Date: Mon, 17 Jan 2022 11:49:16 +0100 Subject: New "make relive" similar to "ejabberdctl live" without installing Prepare with: ./autogen.sh && ./configure --with-rebar=./rebar3 && make Or use this if you installed Elixir: ./autogen.sh && ./configure --with-rebar=mix && make Start without installing (it recompiles when necessary): make relive It stores config, database and logs in _build/relive/ There's available the well-known script: _build/relive/ejabberdctl Please note this fails immediately: r3:do(compile). This crashes a few seconds later: rebar3:run(["compile"]). Workaround that works correctly: ejabberd_admin:update(). --- rel/relive.escript | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 rel/relive.escript (limited to 'rel/relive.escript') diff --git a/rel/relive.escript b/rel/relive.escript new file mode 100644 index 000000000..3ee2de0f3 --- /dev/null +++ b/rel/relive.escript @@ -0,0 +1,26 @@ +#!/usr/bin/env escript + +main(_) -> + Base = "_build/relive", + prepare(Base, "", none), + prepare(Base, "conf", {os, cmd, "rel/setup-relive.sh"}), + prepare(Base, "database", none), + prepare(Base, "logs", none), + c:erlangrc([os:cmd("echo -n $HOME")]), + ok. + +prepare(BaseDir, SuffixDir, MFA) -> + Dir = filename:join(BaseDir, SuffixDir), + case file:make_dir(Dir) of + ok -> + io:format("Preparing relive dir ~s...~n", [Dir]), + case MFA of + none -> ok; + {M, F, A} -> M:F(A) + end; + {error, eexist} -> + ok; + {error, LogsError} -> + io:format("Error creating dir ~s: ~p~n", [Dir, LogsError]), + halt(1) + end. -- cgit v1.2.3