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