installer.nsi 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. !ifndef VERSION
  2. !define VERSION '15.09.80'
  3. !endif
  4. ; The name of the installer
  5. Name "Cura ${VERSION}"
  6. ; The file to write
  7. OutFile "Cura_${VERSION}.exe"
  8. ; The default installation directory
  9. InstallDir $PROGRAMFILES\Cura_${VERSION}
  10. ; Registry key to check for directory (so if you install again, it will
  11. ; overwrite the old one automatically)
  12. InstallDirRegKey HKLM "Software\Cura_${VERSION}" "Install_Dir"
  13. ; Request application privileges for Windows Vista
  14. RequestExecutionLevel admin
  15. ; Set the LZMA compressor to reduce size.
  16. SetCompressor /SOLID lzma
  17. ;--------------------------------
  18. !include "MUI2.nsh"
  19. !include "Library.nsh"
  20. ; !define MUI_ICON "dist/resources/cura.ico"
  21. !define MUI_BGCOLOR FFFFFF
  22. ; Directory page defines
  23. !define MUI_DIRECTORYPAGE_VERIFYONLEAVE
  24. ; Header
  25. ; Don't show the component description box
  26. !define MUI_COMPONENTSPAGE_NODESC
  27. ;Do not leave (Un)Installer page automaticly
  28. !define MUI_FINISHPAGE_NOAUTOCLOSE
  29. !define MUI_UNFINISHPAGE_NOAUTOCLOSE
  30. ;Run Cura after installing
  31. !define MUI_FINISHPAGE_RUN
  32. !define MUI_FINISHPAGE_RUN_TEXT "Start Cura ${VERSION}"
  33. !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
  34. ;Add an option to show release notes
  35. !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\plugins\ChangeLogPlugin\changelog.txt"
  36. ; Pages
  37. ;!insertmacro MUI_PAGE_WELCOME
  38. !insertmacro MUI_PAGE_DIRECTORY
  39. !insertmacro MUI_PAGE_COMPONENTS
  40. !insertmacro MUI_PAGE_INSTFILES
  41. !insertmacro MUI_PAGE_FINISH
  42. !insertmacro MUI_UNPAGE_CONFIRM
  43. !insertmacro MUI_UNPAGE_INSTFILES
  44. !insertmacro MUI_UNPAGE_FINISH
  45. ; Languages
  46. !insertmacro MUI_LANGUAGE "English"
  47. ; Reserve Files
  48. !insertmacro MUI_RESERVEFILE_LANGDLL
  49. ReserveFile '${NSISDIR}\Plugins\InstallOptions.dll'
  50. ;--------------------------------
  51. ; The stuff to install
  52. Section "Cura ${VERSION}"
  53. SectionIn RO
  54. ; Set output path to the installation directory.
  55. SetOutPath $INSTDIR
  56. ; Put file there
  57. File /r "dist\"
  58. ; Write the installation path into the registry
  59. WriteRegStr HKLM "SOFTWARE\Cura_${VERSION}" "Install_Dir" "$INSTDIR"
  60. ; Write the uninstall keys for Windows
  61. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cura_${VERSION}" "DisplayName" "Cura ${VERSION}"
  62. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cura_${VERSION}" "UninstallString" '"$INSTDIR\uninstall.exe"'
  63. WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cura_${VERSION}" "NoModify" 1
  64. WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cura_${VERSION}" "NoRepair" 1
  65. WriteUninstaller "uninstall.exe"
  66. ; Write start menu entries for all users
  67. SetShellVarContext all
  68. CreateDirectory "$SMPROGRAMS\Cura ${VERSION}"
  69. CreateShortCut "$SMPROGRAMS\Cura ${VERSION}\Uninstall Cura ${VERSION}.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
  70. CreateShortCut "$SMPROGRAMS\Cura ${VERSION}\Cura ${VERSION}.lnk" "$INSTDIR\Cura.exe" '' "$INSTDIR\Cura.exe" 0
  71. SectionEnd
  72. Function LaunchLink
  73. ; Write start menu entries for all users
  74. SetShellVarContext all
  75. Exec '"$WINDIR\explorer.exe" "$SMPROGRAMS\Cura ${VERSION}\Cura ${VERSION}.lnk"'
  76. FunctionEnd
  77. Section "Install Visual Studio 2010 Redistributable"
  78. SetOutPath "$INSTDIR"
  79. File "vcredist_2010_20110908_x86.exe"
  80. IfSilent +2
  81. ExecWait '"$INSTDIR\vcredist_2010_20110908_x86.exe" /q /norestart'
  82. SectionEnd
  83. Section "Install Arduino Drivers"
  84. ; Set output path to the driver directory.
  85. SetOutPath "$INSTDIR\drivers\"
  86. File /r "drivers\"
  87. ${If} ${RunningX64}
  88. IfSilent +2
  89. ExecWait '"$INSTDIR\drivers\dpinst64.exe" /lm'
  90. ${Else}
  91. IfSilent +2
  92. ExecWait '"$INSTDIR\drivers\dpinst32.exe" /lm'
  93. ${EndIf}
  94. SectionEnd
  95. Section "Open STL files with Cura"
  96. WriteRegStr HKCR .stl "" "Cura STL model file"
  97. DeleteRegValue HKCR .stl "Content Type"
  98. WriteRegStr HKCR "Cura STL model file\DefaultIcon" "" "$INSTDIR\Cura.exe,0"
  99. WriteRegStr HKCR "Cura STL model file\shell" "" "open"
  100. WriteRegStr HKCR "Cura STL model file\shell\open\command" "" '"$INSTDIR\Cura.exe" "%1"'
  101. SectionEnd
  102. Section /o "Open OBJ files with Cura"
  103. WriteRegStr HKCR .obj "" "Cura OBJ model file"
  104. DeleteRegValue HKCR .obj "Content Type"
  105. WriteRegStr HKCR "Cura OBJ model file\DefaultIcon" "" "$INSTDIR\Cura.exe,0"
  106. WriteRegStr HKCR "Cura OBJ model file\shell" "" "open"
  107. WriteRegStr HKCR "Cura OBJ model file\shell\open\command" "" '"$INSTDIR\Cura.exe" "%1"'
  108. SectionEnd
  109. ;--------------------------------
  110. ; Uninstaller
  111. Section "Uninstall"
  112. ; Remove registry keys
  113. DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cura_${VERSION}"
  114. DeleteRegKey HKLM "SOFTWARE\Cura_${VERSION}"
  115. ; Write start menu entries for all users
  116. SetShellVarContext all
  117. ; Remove directories used
  118. RMDir /r "$SMPROGRAMS\Cura ${VERSION}"
  119. RMDir /r "$INSTDIR"
  120. SectionEnd