pyapp_msvcrt.nsi 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. [% extends "pyapp.nsi" %]
  2. [% block sections %]
  3. !addplugindir [[ pynsist_pkg_dir ]]
  4. !include windowsversion.nsh
  5. !include x64.nsh
  6. Section "-msvcrt"
  7. ${GetWindowsVersion} $R0
  8. StrCpy $0 "--"
  9. ${If} ${RunningX64}
  10. ${If} $R0 == "8.1"
  11. StrCpy $0 "https://github.com/takluyver/pynsist/raw/msvcrt-2015-msus/x64/Windows8.1-KB2999226-x64.msu"
  12. ${ElseIf} $R0 == "8"
  13. StrCpy $0 "https://github.com/takluyver/pynsist/raw/msvcrt-2015-msus/x64/Windows8-RT-KB2999226-x64.msu"
  14. ${ElseIf} $R0 == "7"
  15. StrCpy $0 "https://github.com/takluyver/pynsist/raw/msvcrt-2015-msus/x64/Windows6.1-KB2999226-x64.msu"
  16. ${ElseIf} $R0 == "Vista"
  17. StrCpy $0 "https://github.com/takluyver/pynsist/raw/msvcrt-2015-msus/x64/Windows6-KB2999226-x64.msu"
  18. ${EndIf}
  19. ${Else}
  20. ${If} $R0 == "8.1"
  21. StrCpy $0 "https://github.com/takluyver/pynsist/raw/msvcrt-2015-msus/x86/Windows8.1-KB2999226-x86.msu"
  22. ${ElseIf} $R0 == "8"
  23. StrCpy $0 "https://github.com/takluyver/pynsist/raw/msvcrt-2015-msus/x86/Windows8-RT-KB2999226-x86.msu"
  24. ${ElseIf} $R0 == "7"
  25. StrCpy $0 "https://github.com/takluyver/pynsist/raw/msvcrt-2015-msus/x86/Windows6.1-KB2999226-x86.msu"
  26. ${ElseIf} $R0 == "Vista"
  27. StrCpy $0 "https://github.com/takluyver/pynsist/raw/msvcrt-2015-msus/x86/Windows6-KB2999226-x86.msu"
  28. ${EndIf}
  29. ${EndIf}
  30. IfFileExists "$SYSDIR\ucrtbase.dll" skip_msvcrt
  31. StrCmp $0 "--" skip_msvcrt
  32. DetailPrint "Need to install MSVCRT 2015. This may take a few minutes."
  33. DetailPrint "Downloading $0"
  34. inetc::get /RESUME "" "$0" "$INSTDIR\msvcrt.msu"
  35. Pop $2
  36. DetailPrint "Download finished ($2)"
  37. ${If} $2 == "OK"
  38. DetailPrint "Running wusa to install update package"
  39. ExecWait 'wusa "$INSTDIR\msvcrt.msu" /quiet /norestart' $1
  40. Delete "$INSTDIR\msvcrt.msu"
  41. ${Else}
  42. MessageBox MB_OK "Failed to download important update! \
  43. ${PRODUCT_NAME} will not run until you install the Visual C++ \
  44. redistributable for Visual Studio 2015.\
  45. $\n$\nhttp://www.microsoft.com/en-us/download/details.aspx?id=48145"
  46. ${EndIf}
  47. # This WUSA exit code means a reboot is needed.
  48. ${If} $1 = 0x00240005
  49. SetRebootFlag true
  50. ${EndIf}
  51. skip_msvcrt:
  52. SectionEnd
  53. [[ super() ]]
  54. [% endblock sections %]