signal-desktop/build/installer.nsh

48 lines
1.3 KiB
Text
Raw Normal View History

2023-03-20 21:22:32 +00:00
# Copyright 2023 Signal Messenger, LLC
# SPDX-License-Identifier: AGPL-3.0-only
!include WinVer.nsh
2023-03-20 21:22:32 +00:00
!include SignalStrings.nsh
2023-03-20 21:22:32 +00:00
ManifestDPIAware true
!macro preInit
2023-03-20 21:22:32 +00:00
Var /Global OLD_SIGNAL_VERSION
# Check minimum OS version
2023-05-10 19:58:35 +00:00
${IfNot} ${AtLeastWin10}
MessageBox MB_OK|MB_ICONEXCLAMATION "$(signalMinWinVersionErr)"
DetailPrint `Windows version check failed`
Abort
${EndIf}
2023-03-20 21:22:32 +00:00
# If previously installed
ReadRegStr $OLD_SIGNAL_VERSION SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}" \
"DisplayVersion"
StrCmp $OLD_SIGNAL_VERSION "" end_semver_check
# Check that we are not overwriting newer version of the app.
${StdUtils.ScanStr3} $R0 $R1 $R2 "%d.%d.%d" $OLD_SIGNAL_VERSION 0 0 0
${StdUtils.ScanStr3} $R3 $R4 $R5 "%d.%d.%d" ${VERSION} 0 0 0
# Compare major number
IntCmp $R0 $R3 same_major end_semver_check downgrade
# Compare minor number
same_major:
IntCmp $R1 $R4 same_minor end_semver_check downgrade
# Compare patch number
same_minor:
IntCmp $R2 $R5 end_semver_check end_semver_check downgrade
# Detected downgrade - show message box
downgrade:
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"$(signalMinAppVersionErr)" /SD IDCANCEL IDOK end_semver_check
DetailPrint `SemVer check failed`
Abort
end_semver_check:
!macroend