fix: ensure install_upgrace.escript always restore cwd
This commit is contained in:
parent
d49c8b61e6
commit
8798a5160c
|
@ -262,6 +262,7 @@ make_symlink_or_copy(Filename, ReleaseLink) ->
|
||||||
|
|
||||||
unpack_zipballs(RelNameStr, Version) ->
|
unpack_zipballs(RelNameStr, Version) ->
|
||||||
{ok, Cwd} = file:get_cwd(),
|
{ok, Cwd} = file:get_cwd(),
|
||||||
|
try
|
||||||
GzFile = filename:absname(filename:join(["releases", RelNameStr ++ "-" ++ Version ++ ".tar.gz"])),
|
GzFile = filename:absname(filename:join(["releases", RelNameStr ++ "-" ++ Version ++ ".tar.gz"])),
|
||||||
ZipFiles = filelib:wildcard(filename:join(["releases", RelNameStr ++ "-*" ++ Version ++ "*.zip"])),
|
ZipFiles = filelib:wildcard(filename:join(["releases", RelNameStr ++ "-*" ++ Version ++ "*.zip"])),
|
||||||
?INFO("unzip ~p", [ZipFiles]),
|
?INFO("unzip ~p", [ZipFiles]),
|
||||||
|
@ -273,8 +274,11 @@ unpack_zipballs(RelNameStr, Version) ->
|
||||||
{ok, _FileList} = zip:unzip("emqx.zip"),
|
{ok, _FileList} = zip:unzip("emqx.zip"),
|
||||||
ok = file:set_cwd(filename:join([TmdTarD, "emqx"])),
|
ok = file:set_cwd(filename:join([TmdTarD, "emqx"])),
|
||||||
ok = erl_tar:create(GzFile, filelib:wildcard("*"), [compressed])
|
ok = erl_tar:create(GzFile, filelib:wildcard("*"), [compressed])
|
||||||
end || Zip <- ZipFiles],
|
end || Zip <- ZipFiles]
|
||||||
file:set_cwd(Cwd).
|
after
|
||||||
|
% restore cwd
|
||||||
|
file:set_cwd(Cwd)
|
||||||
|
end.
|
||||||
|
|
||||||
first_value(_Fun, []) -> no_value;
|
first_value(_Fun, []) -> no_value;
|
||||||
first_value(Fun, [Value | Rest]) ->
|
first_value(Fun, [Value | Rest]) ->
|
||||||
|
|
Loading…
Reference in New Issue