Skip to content

Commit e1db6d8

Browse files
wojtekmachjosevalim
authored andcommitted
Update Windows installer to register in Add/Remove Programs (#13156)
1 parent db8a1cd commit e1db6d8

File tree

3 files changed

+22
-28
lines changed

3 files changed

+22
-28
lines changed

lib/elixir/scripts/windows_installer/build.sh

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,27 @@
44
# With Elixir archive:
55
#
66
# ELIXIR_ZIP=Precompiled.zip OTP_VERSION=25.3.2.2 ./build.sh
7-
#
8-
# With Elixir version:
9-
#
10-
# ELIXIR_VERSION=1.14.5 OTP_VERSION=25.3.2.2 ./build.sh
117
set -euo pipefail
128

13-
OTP_VERSION="${OTP_VERSION:-26.0}"
14-
otp_release=`echo "${OTP_VERSION}" | cut -d. -f1`
15-
169
mkdir -p tmp
10+
rm -rf tmp/elixir
11+
unzip -d "tmp/elixir" "${ELIXIR_ZIP}"
1712

18-
ELIXIR_VERSION="${ELIXIR_VERSION:-}"
19-
if [ -n "${ELIXIR_VERSION}" ]; then
20-
ELIXIR_ZIP="tmp/elixir-${ELIXIR_VERSION}-otp-${otp_release}.zip"
21-
if [ ! -f "${ELIXIR_ZIP}" ]; then
22-
url="https://github.com/elixir-lang/elixir/releases/download/v${ELIXIR_VERSION}/elixir-otp-${otp_release}.zip"
23-
echo "downloading ${url}"
24-
curl --fail -L -o "${ELIXIR_ZIP}" "${url}"
25-
fi
26-
basename=elixir-${ELIXIR_VERSION}-otp-${otp_release}
27-
else
28-
basename=elixir-otp-${otp_release}
29-
fi
30-
31-
if [ ! -d "tmp/${basename}" ]; then
32-
unzip -d "tmp/${basename}" "${ELIXIR_ZIP}"
33-
fi
13+
elixir_version=`cat tmp/elixir/VERSION`
14+
otp_release=`erl -noshell -eval 'io:put_chars(erlang:system_info(otp_release)), halt().'`
15+
otp_version=`erl -noshell -eval '{ok, Vsn} = file:read_file(code:root_dir() ++ "/releases/" ++ erlang:system_info(otp_release) ++ "/OTP_VERSION"), io:put_chars(Vsn), halt().'`
16+
elixir_exe=elixir-otp-${otp_release}.exe
3417

3518
# brew install makensis
3619
# apt install -y nsis
3720
# choco install -y nsis
3821
export PATH="/c/Program Files (x86)/NSIS:${PATH}"
3922
makensis \
40-
-X"OutFile tmp\\${basename}.exe" \
41-
-DOTP_VERSION=${OTP_VERSION} \
23+
-X"OutFile tmp\\${elixir_exe}" \
4224
-DOTP_RELEASE="${otp_release}" \
43-
-DELIXIR_DIR=tmp\\${basename} \
25+
-DOTP_VERSION=${otp_version} \
26+
-DELIXIR_DIR=tmp\\elixir \
27+
-DELIXIR_VERSION=${elixir_version} \
4428
installer.nsi
4529

46-
echo "Installer path: tmp/${basename}.exe"
30+
echo "Installer path: tmp/${elixir_exe}"

lib/elixir/scripts/windows_installer/installer.nsi

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ Name "Elixir"
66
ManifestDPIAware true
77
Unicode True
88
InstallDir "$PROGRAMFILES64\Elixir"
9-
!define MUI_ICON "assets\drop.ico"
9+
!define MUI_ICON "assets\Elixir.ico"
10+
!define MUI_UNICON "assets\Elixir.ico"
1011

1112
; Install Page: Install Erlang/OTP
1213

@@ -191,7 +192,15 @@ FunctionEnd
191192
Section "Install Elixir" SectionElixir
192193
SetOutPath "$INSTDIR"
193194
File /r "${ELIXIR_DIR}\"
195+
File "assets\Elixir.ico"
194196
File "update_system_path.erl"
197+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Elixir" "DisplayName" "Elixir"
198+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Elixir" "DisplayVersion" "${ELIXIR_VERSION}"
199+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Elixir" "DisplayIcon" "$INSTDIR\Elixir.ico"
200+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Elixir" "Publisher" "The Elixir Team"
201+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Elixir" "UninstallString" '"$INSTDIR\Uninstall.exe"'
202+
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Elixir" "NoModify" 1
203+
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Elixir" "NoRepair" 1
195204

196205
WriteUninstaller "Uninstall.exe"
197206
SectionEnd
@@ -270,6 +279,7 @@ UninstPage custom un.FinishPageShow un.FinishPageLeave
270279

271280
Section "Uninstall"
272281
RMDir /r "$INSTDIR"
282+
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Elixir"
273283
SectionEnd
274284

275285
!insertmacro MUI_LANGUAGE "English"

0 commit comments

Comments
 (0)