pyapp_msvcrt.nsi 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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://cdn.rawgit.com/takluyver/pynsist/msvcrt-tag1/x64/Windows8.1-KB2999226-x64.msu"
  12. ${ElseIf} $R0 == "8"
  13. StrCpy $0 "https://cdn.rawgit.com/takluyver/pynsist/msvcrt-tag1/x64/Windows8-RT-KB2999226-x64.msu"
  14. ${ElseIf} $R0 == "7"
  15. StrCpy $0 "https://cdn.rawgit.com/takluyver/pynsist/msvcrt-tag1/x64/Windows6.1-KB2999226-x64.msu"
  16. ${ElseIf} $R0 == "Vista"
  17. StrCpy $0 "https://cdn.rawgit.com/takluyver/pynsist/msvcrt-tag1/x64/Windows6-KB2999226-x64.msu"
  18. ${EndIf}
  19. ${Else}
  20. ${If} $R0 == "8.1"
  21. StrCpy $0 "https://cdn.rawgit.com/takluyver/pynsist/msvcrt-tag1/x86/Windows8.1-KB2999226-x86.msu"
  22. ${ElseIf} $R0 == "8"
  23. StrCpy $0 "https://cdn.rawgit.com/takluyver/pynsist/msvcrt-tag1/x86/Windows8-RT-KB2999226-x86.msu"
  24. ${ElseIf} $R0 == "7"
  25. StrCpy $0 "https://cdn.rawgit.com/takluyver/pynsist/msvcrt-tag1/x86/Windows6.1-KB2999226-x86.msu"
  26. ${ElseIf} $R0 == "Vista"
  27. StrCpy $0 "https://cdn.rawgit.com/takluyver/pynsist/msvcrt-tag1/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. ${Else}
  51. IntOp $0 $1 & 0x80000000
  52. ${If} $0 <> 0
  53. MessageBox MB_OK "Failed to install important update! \
  54. ${PRODUCT_NAME} will not run until you install the Visual C++ \
  55. redistributable for Visual Studio 2015.\
  56. $\n$\nhttp://www.microsoft.com/en-us/download/details.aspx?id=48145"
  57. ${EndIf}
  58. ${EndIf}
  59. skip_msvcrt:
  60. SectionEnd
  61. [[ super() ]]
  62. [% endblock sections %]