From ac93725f74a2f3079135fb74fa9dfb43e47a4c02 Mon Sep 17 00:00:00 2001 From: turtleDeng Date: Sat, 21 Sep 2019 11:04:13 +0800 Subject: [PATCH] Add emqx.app.src.script file (#2923) --- src/emqx.app.src.script | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/emqx.app.src.script diff --git a/src/emqx.app.src.script b/src/emqx.app.src.script new file mode 100644 index 000000000..c2205ceda --- /dev/null +++ b/src/emqx.app.src.script @@ -0,0 +1,34 @@ +%%-*- mode: erlang -*- + %% .app.src.script + +Config = case os:getenv("EMQX_DESC") of + false -> CONFIG; % env var not defined + [] -> CONFIG; % env var set to empty string + Desc -> + [begin + AppConf0 = lists:keystore(description, 1, AppConf, {description, Desc}), + {application, App, AppConf0} + end || Conf = {application, App, AppConf} <- CONFIG] +end, + +RemoveLeadingV = + fun(Tag) -> + case re:run(Tag, "v\[0-9\]+\.\[0-9\]+\.*") of + nomatch -> + Tag; + {match, _} -> + %% if it is a version number prefixed by 'v' then remove the 'v' + "v" ++ Vsn = Tag, + Vsn + end + end, + +case os:getenv("EMQX_DEPS_DEFAULT_VSN") of + false -> Config; % env var not defined + [] -> Config; % env var set to empty string + Tag -> + [begin + AppConf0 = lists:keystore(vsn, 1, AppConf, {vsn, RemoveLeadingV(Tag)}), + {application, App, AppConf0} + end || Conf = {application, App, AppConf} <- Config] +end. \ No newline at end of file