You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

installer.nsi 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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 RAMBo Drivers"
  84. ; Set output path to the driver directory.
  85. SetOutPath "$INSTDIR\drivers\"
  86. File /r "drivers\"
  87. ExecWait '"rundll32.exe" setupapi,InstallHinfSection DefaultInstall 132 $INSTDIR\drivers\rambo.inf'
  88. SectionEnd
  89. Section "Open STL files with Cura"
  90. ${registerExtension} "$INSTDIR\Cura.exe" ".stl" "STL_File"
  91. SectionEnd
  92. Section /o "Open OBJ files with Cura"
  93. WriteRegStr HKCR .obj "" "Cura OBJ model file"
  94. DeleteRegValue HKCR .obj "Content Type"
  95. WriteRegStr HKCR "Cura OBJ model file\DefaultIcon" "" "$INSTDIR\Cura.exe,0"
  96. WriteRegStr HKCR "Cura OBJ model file\shell" "" "open"
  97. WriteRegStr HKCR "Cura OBJ model file\shell\open\command" "" '"$INSTDIR\Cura.exe" "%1"'
  98. SectionEnd
  99. ;--------------------------------
  100. ; Uninstaller
  101. Section "Uninstall"
  102. ; Remove registry keys
  103. DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cura_${VERSION}"
  104. DeleteRegKey HKLM "SOFTWARE\Cura_${VERSION}"
  105. ; Write start menu entries for all users
  106. SetShellVarContext all
  107. ; Remove directories used
  108. RMDir /r "$SMPROGRAMS\Cura ${VERSION}"
  109. RMDir /r "$INSTDIR"
  110. SectionEnd