chore(mix): copy more files required by relup

This commit is contained in:
Thales Macedo Garitezi 2021-12-27 16:07:38 -03:00
parent 432faf7bd2
commit 360a00622b
No known key found for this signature in database
GPG Key ID: DD279F8152A9B6DD
2 changed files with 37 additions and 23 deletions

View File

@ -308,8 +308,9 @@ permafy(TargetNode, RelName, Vsn) ->
make_permanent, [Vsn], ?TIMEOUT),
?INFO("Made release permanent: ~p", [Vsn]),
%% upgrade/downgrade the scripts by replacing them
Scripts = [RelNameStr, RelNameStr++"_ctl", "cuttlefish", "nodetool",
"install_upgrade.escript"],
Scripts = [RelNameStr, RelNameStr ++ "_ctl",
"common_defs.sh", "common_defs2.sh", "common_functions.sh",
"nodetool", "install_upgrade.escript"],
[{ok, _} = file:copy(filename:join(["bin", File++"-"++Vsn]),
filename:join(["bin", File]))
|| File <- Scripts],

55
mix.exs
View File

@ -286,28 +286,33 @@ defmodule EMQXUmbrella.MixProject do
vm_args_rendered
)
Enum.each(
[
"emqx",
"emqx_ctl",
"common_defs.sh",
"common_defs2.sh",
"common_functions.sh"
],
&Mix.Generator.copy_file(
"bin/#{&1}",
Path.join(bin, &1),
for name <- [
"emqx",
"emqx_ctl",
"common_defs.sh",
"common_defs2.sh",
"common_functions.sh"
] do
Mix.Generator.copy_file(
"bin/#{name}",
Path.join(bin, name),
force: overwrite?
)
)
Enum.each(
[
"emqx",
"emqx_ctl"
],
&File.chmod!(Path.join(bin, &1), 0o755)
)
# Files with the version appended are expected by the release
# upgrade script `install_upgrade.escript`
Mix.Generator.copy_file(
Path.join(bin, name),
Path.join(bin, name <> "-#{release.version}"),
force: overwrite?
)
end
for base_name <- ["emqx", "emqx_ctl"],
suffix <- ["", "-#{release.version}"] do
name = base_name <> suffix
File.chmod!(Path.join(bin, name), 0o755)
end
release
end
@ -354,11 +359,19 @@ defmodule EMQXUmbrella.MixProject do
|> File.read!()
|> String.split("\n", parts: 2)
path = Path.join([release.path, "bin", escript_name])
# the elixir version of escript + start.boot required the boot_var
# RELEASE_LIB to be defined.
boot_var = "%%!-boot_var RELEASE_LIB $RUNNER_ROOT_DIR/lib"
File.write!(path, [shebang, "\n", boot_var, "\n", rest])
# Files with the version appended are expected by the release
# upgrade script `install_upgrade.escript`
Enum.each(
[escript_name, escript_name <> "-" <> release.version],
fn name ->
path = Path.join([release.path, "bin", name])
File.write!(path, [shebang, "\n", boot_var, "\n", rest])
end
)
release
end