Skip to content

Commit 8ceb823

Browse files
authored
Update install.sh and install.bat (#1801)
* Allow OTP 28 for Elixir 1.19 * Fix `> install.bat elixir@main` * Fix `> install.bat otp@latest`
1 parent 51eabdf commit 8ceb823

File tree

2 files changed

+30
-7
lines changed

2 files changed

+30
-7
lines changed

install.bat

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ if "%otp_version%" == "" (
6666
)
6767

6868
if "!otp_version!" == "latest" (
69-
set "url=https://github.com/erlef/otp_builds/releases/latest"
69+
set "url=https://github.com/erlang/otp/releases/latest"
7070
for /f "tokens=2 delims= " %%a in ('curl -fsS --head "!url!" ^| findstr /I "^location:"') do set url=%%a
7171
set "otp_version=!url:*releases/tag/OTP-=!"
7272
)
@@ -79,12 +79,21 @@ if "!elixir_version!" == "latest" (
7979

8080
for /f "tokens=1 delims=." %%A in ("!otp_version!") do set "elixir_otp_release=%%A"
8181
for /f "tokens=1,2 delims=." %%A in ("!elixir_version!") do set "elixir_major_minor=%%A.%%B"
82-
if "%elixir_major_minor%" == "1.15" (
82+
83+
if "%elixir_major_minor%" == "1.14" (
84+
if %elixir_otp_release% GEQ 25 set "elixir_otp_release=25"
85+
) else if "%elixir_major_minor%" == "1.15" (
8386
if %elixir_otp_release% GEQ 26 set "elixir_otp_release=26"
8487
) else if "%elixir_major_minor%" == "1.16" (
8588
if %elixir_otp_release% GEQ 26 set "elixir_otp_release=26"
86-
) else if "%elixir_major_minor%" == "1.14" (
87-
if %elixir_otp_release% GEQ 25 set "elixir_otp_release=25"
89+
) else if "%elixir_major_minor%" == "1.17" (
90+
if %elixir_otp_release% GEQ 27 set "elixir_otp_release=27"
91+
) else if "%elixir_major_minor%" == "1.18" (
92+
if %elixir_otp_release% GEQ 27 set "elixir_otp_release=27"
93+
) else if "%elixir_major_minor%" == "1.19" (
94+
if %elixir_otp_release% GEQ 28 set "elixir_otp_release=28"
95+
) else (
96+
if %elixir_otp_release% GEQ 28 set "elixir_otp_release=28"
8897
)
8998

9099
set "root_dir=%USERPROFILE%\.elixir-install"
@@ -161,7 +170,15 @@ exit /b 0
161170
goto :eof
162171

163172
:install_elixir
164-
set "elixir_zip=elixir-!elixir_version!-otp-!elixir_otp_release!.zip"
173+
set "elixir_zip=elixir-otp-!elixir_otp_release!.zip"
174+
175+
if "%elixir_version%" == "main" (
176+
rem Do not remove this comment
177+
set "ref=main-latest"
178+
) else (
179+
rem Do not remove this comment
180+
set "ref=v%elixir_version%"
181+
)
165182

166183
if "%force%" == "true" (
167184
if exist "%elixir_dir%" (
@@ -170,7 +187,7 @@ if "%force%" == "true" (
170187
)
171188

172189
if not exist "%elixir_dir%\bin" (
173-
set "elixir_url=https://github.com/elixir-lang/elixir/releases/download/v!elixir_version!/elixir-otp-%elixir_otp_release%.zip"
190+
set "elixir_url=https://github.com/elixir-lang/elixir/releases/download/%ref%/elixir-otp-%elixir_otp_release%.zip"
174191
echo downloading !elixir_url!...
175192
curl.exe -fsSLo "%tmp_dir%\%elixir_zip%" "!elixir_url!" || exit /b 1
176193

install.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,15 @@ main() {
9797
1.15.*|1.16.*)
9898
[ "${elixir_otp_release}" -ge 26 ] && elixir_otp_release=26
9999
;;
100-
*)
100+
1.17.*|1.18.*)
101101
[ "${elixir_otp_release}" -ge 27 ] && elixir_otp_release=27
102102
;;
103+
1.19.*)
104+
[ "${elixir_otp_release}" -ge 28 ] && elixir_otp_release=28
105+
;;
106+
*)
107+
[ "${elixir_otp_release}" -ge 28 ] && elixir_otp_release=28
108+
;;
103109
esac
104110

105111
otp_dir="$root_dir/installs/otp/$otp_version"

0 commit comments

Comments
 (0)