mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
Add support to build release with back to old Elixir 1.10.3
However, to build a release with OTP 24 requires Elixir 1.11.4 or higher
This commit is contained in:
parent
fcbd72f2d7
commit
e31919914b
1
.gitignore
vendored
1
.gitignore
vendored
@ -9,6 +9,7 @@
|
|||||||
/Makefile
|
/Makefile
|
||||||
/config.log
|
/config.log
|
||||||
/config.status
|
/config.status
|
||||||
|
/config/releases.exs
|
||||||
/configure
|
/configure
|
||||||
/aclocal.m4
|
/aclocal.m4
|
||||||
/*.cache
|
/*.cache
|
||||||
|
28
mix.exs
28
mix.exs
@ -215,11 +215,29 @@ defmodule Ejabberd.MixProject do
|
|||||||
ro = "rel/overlays"
|
ro = "rel/overlays"
|
||||||
File.rm_rf(ro)
|
File.rm_rf(ro)
|
||||||
|
|
||||||
System.shell("sed -e 's|{{\\(\[_a-z\]*\\)}}|<%= @\\1 %>|g' ejabberdctl.template > ejabberdctl.example1")
|
# Elixir lower than 1.12.0 don't have System.shell
|
||||||
|
execute = fn(command) ->
|
||||||
|
case function_exported?(System, :shell, 1) do
|
||||||
|
true ->
|
||||||
|
System.shell(command)
|
||||||
|
false ->
|
||||||
|
:os.cmd(to_charlist(command))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Mix/Elixir lower than 1.11.0 use config/releases.exs instead of runtime.exs
|
||||||
|
case Version.match?(System.version, ">= 1.11.0") do
|
||||||
|
true ->
|
||||||
|
:ok
|
||||||
|
false ->
|
||||||
|
execute.("cp config/runtime.exs config/releases.exs")
|
||||||
|
end
|
||||||
|
|
||||||
|
execute.("sed -e 's|{{\\(\[_a-z\]*\\)}}|<%= @\\1 %>|g' ejabberdctl.template > ejabberdctl.example1")
|
||||||
Mix.Generator.copy_template("ejabberdctl.example1", "ejabberdctl.example2", assigns)
|
Mix.Generator.copy_template("ejabberdctl.example1", "ejabberdctl.example2", assigns)
|
||||||
System.shell("sed -e 's|{{\\(\[_a-z\]*\\)}}|<%= @\\1 %>|g' ejabberdctl.example2 > ejabberdctl.example3")
|
execute.("sed -e 's|{{\\(\[_a-z\]*\\)}}|<%= @\\1 %>|g' ejabberdctl.example2 > ejabberdctl.example3")
|
||||||
System.shell("sed -e 's|ERLANG_NODE=ejabberd@localhost|ERLANG_NODE=ejabberd|g' ejabberdctl.example3 > ejabberdctl.example4")
|
execute.("sed -e 's|ERLANG_NODE=ejabberd@localhost|ERLANG_NODE=ejabberd|g' ejabberdctl.example3 > ejabberdctl.example4")
|
||||||
System.shell("sed -e 's|INSTALLUSER=|ERL_OPTIONS=\"-setcookie \\$\\(cat \"\\${SCRIPT_DIR%/*}/releases/COOKIE\")\"\\nINSTALLUSER=|g' ejabberdctl.example4 > ejabberdctl.example5")
|
execute.("sed -e 's|INSTALLUSER=|ERL_OPTIONS=\"-setcookie \\$\\(cat \"\\${SCRIPT_DIR%/*}/releases/COOKIE\")\"\\nINSTALLUSER=|g' ejabberdctl.example4 > ejabberdctl.example5")
|
||||||
Mix.Generator.copy_template("ejabberdctl.example5", "#{ro}/bin/ejabberdctl", assigns)
|
Mix.Generator.copy_template("ejabberdctl.example5", "#{ro}/bin/ejabberdctl", assigns)
|
||||||
File.chmod("#{ro}/bin/ejabberdctl", 0o755)
|
File.chmod("#{ro}/bin/ejabberdctl", 0o755)
|
||||||
|
|
||||||
@ -250,7 +268,7 @@ defmodule Ejabberd.MixProject do
|
|||||||
Mix.Generator.create_directory("#{ro}/var/lib/ejabberd")
|
Mix.Generator.create_directory("#{ro}/var/lib/ejabberd")
|
||||||
|
|
||||||
case Mix.env() do
|
case Mix.env() do
|
||||||
:dev -> System.shell("REL_DIR_TEMP=$PWD/rel/overlays/ rel/setup-dev.sh")
|
:dev -> execute.("REL_DIR_TEMP=$PWD/rel/overlays/ rel/setup-dev.sh")
|
||||||
_ -> :ok
|
_ -> :ok
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user