]> git.gag.com Git - fw/altos/blob - altosui/altos-windows.nsi.in
updated ChangeLog for release
[fw/altos] / altosui / altos-windows.nsi.in
1 !addplugindir Instdrv/NSIS/Plugins
2 !addincludedir Instdrv/NSIS/Includes
3 !include x64.nsh
4 !include java.nsh
5 !include refresh-sh.nsh
6
7 !define REG_NAME        "Altus Metrum"
8 !define PROG_ID_TELEM   "altusmetrum.altosui.telem.1"
9 !define PROG_ID_EEPROM  "altusmetrum.altosui.eeprom.1"
10 !define FAT_NAME        "altosui-fat.jar"
11 !define WIN_APP_ICON    "altusmetrum-altosui.ico"
12 !define WIN_APP_EXE     "altusmetrum-altosui.exe"
13 !define WIN_TELEM_EXE   "application-vnd.altusmetrum.telemetry.exe"
14 !define WIN_EEPROM_EXE  "application-vnd.altusmetrum.eeprom.exe"
15
16 Name "${REG_NAME} Installer"
17
18 ; Default install directory
19 InstallDir "$PROGRAMFILES\AltusMetrum"
20
21 ; Tell the installer where to re-install a new version
22 InstallDirRegKey HKLM "Software\${REG_NAME}" "Install_Dir"
23
24 LicenseText "GNU General Public License Version 2"
25 LicenseData "../COPYING"
26
27 ; Need admin privs for Vista or Win7
28 RequestExecutionLevel admin
29
30 ShowInstDetails Show
31
32 ComponentText "${REG_NAME} Software and Driver Installer"
33
34 Function .onInit
35         DetailPrint "Checking host operating system"
36         ${If} ${RunningX64}
37                 DetailPrint "Installer running on 64-bit host"
38                 SetRegView 64
39                 StrCpy $INSTDIR "$PROGRAMFILES64\AltusMetrum"
40                 ${DisableX64FSRedirection}
41         ${EndIf}
42 FunctionEnd
43
44 Function un.onInit
45         DetailPrint "Checking host operating system"
46         ${If} ${RunningX64}
47                 DetailPrint "Installer running on 64-bit host"
48                 SetRegView 64
49                 StrCpy $INSTDIR "$PROGRAMFILES64\AltusMetrum"
50                 ${DisableX64FSRedirection}
51         ${EndIf}
52 FunctionEnd
53
54 ; Pages to present
55
56 Page license
57 Page components
58 Page directory
59 Page instfiles
60
61 UninstPage uninstConfirm
62 UninstPage instfiles
63
64 ; And the stuff to install
65
66 Section "Install Driver" InstDriver
67
68         InstDrv::InitDriverSetup /NOUNLOAD {4D36E96D-E325-11CE-BFC1-08002BE10318} AltusMetrumSerial
69         Pop $0
70         DetailPrint "InitDriverSetup: $0"
71         InstDrv::DeleteOemInfFiles /NOUNLOAD
72         InstDrv::CreateDevice /NOUNLOAD
73
74         SetOutPath $INSTDIR
75         File "../altusmetrum.inf"
76         File "../altusmetrum.cat"
77
78         ${DisableX64FSRedirection}
79         IfFileExists $WINDIR\System32\PnPutil.exe 0 nopnp
80                 ${DisableX64FSRedirection}
81                 nsExec::ExecToLog '"$WINDIR\System32\PnPutil.exe" -i -a "$INSTDIR\altusmetrum.inf"'
82                 Goto done
83 nopnp:
84                 InstDrv::InstallDriver /NOUNLOAD "$INSTDIR\altusmetrum.inf"
85 done:
86
87 SectionEnd
88
89 Section "${REG_NAME} Application"
90         Call DetectJRE
91
92         SetOutPath $INSTDIR
93
94         File "${FAT_NAME}"
95         File "altoslib_@ALTOSLIB_VERSION@.jar"
96         File "altosuilib_@ALTOSUILIB_VERSION@.jar"
97         File "cmudict04.jar"
98         File "cmulex.jar"
99         File "cmu_time_awb.jar"
100         File "cmutimelex.jar"
101         File "cmu_us_kal.jar"
102         File "en_us.jar"
103         File "freetts.jar"
104         File "jfreechart.jar"
105         File "jcommon.jar"
106
107         File "*.dll"
108
109         File "../icon/${WIN_APP_ICON}"
110
111         CreateShortCut "$SMPROGRAMS\${REG_NAME}.lnk" "$SYSDIR\javaw.exe" "-jar ${FAT_NAME}" "$INSTDIR\${WIN_APP_ICON}"
112 SectionEnd
113
114 Section "${REG_NAME} Desktop Shortcut"
115         CreateShortCut "$DESKTOP\${REG_NAME}.lnk" "$INSTDIR\${FAT_NAME}"  "" "$INSTDIR\${WIN_APP_ICON}"
116 SectionEnd
117
118 Section "Firmware"
119
120         SetOutPath $INSTDIR
121
122         File "../src/telemetrum-v1.0/telemetrum-v1.0-${VERSION}.ihx"
123         File "../src/telemetrum-v1.1/telemetrum-v1.1-${VERSION}.ihx"
124         File "../src/telemetrum-v1.2/telemetrum-v1.2-${VERSION}.ihx"
125         File "../src/telemetrum-v2.0/telemetrum-v2.0-${VERSION}.ihx"
126         File "../src/telemini-v1.0/telemini-v1.0-${VERSION}.ihx"
127         File "../src/telegps-v1.0/telegps-v1.0-${VERSION}.ihx"
128         File "../src/teledongle-v0.2/teledongle-v0.2-${VERSION}.ihx"
129         File "../src/telebt-v1.0/telebt-v1.0-${VERSION}.ihx"
130         File "../src/telemega-v1.0/telemega-v1.0-${VERSION}.ihx"
131         File "../src/easymini-v1.0/easymini-v1.0-${VERSION}.ihx"
132         File "../src/easymega-v1.0/easymega-v1.0-${VERSION}.ihx"
133
134 SectionEnd
135
136 Section "Documentation"
137
138         SetOutPath $INSTDIR
139
140         File "../doc/altusmetrum.pdf"
141         File "../doc/altos.pdf"
142         File "../doc/telemetry.pdf"
143         File "../doc/telemetrum-outline.pdf"
144         File "../doc/telemega-outline.pdf"
145         File "../doc/easymini-outline.pdf"
146         File "../doc/telemini.pdf"
147 SectionEnd
148
149 Section "File Associations"
150
151         ${DisableX64FSRedirection}
152
153         SetOutPath $INSTDIR
154
155         File "../icon/${WIN_APP_EXE}"
156         File "../icon/${WIN_TELEM_EXE}"
157         File "../icon/${WIN_EEPROM_EXE}"
158
159         DeleteRegKey HKCR "${PROG_ID_TELEM}"
160         DeleteRegKey HKCR "${PROG_ID_EEPROM}"
161
162         DeleteRegKey   HKCR ".eeprom\${PROG_ID_EEPROM}"
163         DeleteRegValue HKCR ".eeprom\OpenWithProgids" "${PROG_ID_EEPROM}"
164         DeleteRegKey   HKCR ".telem\${PROG_ID_EEPROM}"
165         DeleteRegValue HKCR ".telem\OpenWithProgids" "${PROG_ID_EEPROM}"
166
167         ; .eeprom elements
168
169         WriteRegStr HKCR "${PROG_ID_EEPROM}"            ""                              "Altus Metrum Log File"
170         WriteRegStr HKCR "${PROG_ID_EEPROM}"            "FriendlyTypeName"              "Altus Metrum Log File"
171         WriteRegStr HKCR "${PROG_ID_EEPROM}\CurVer"     ""                              "${PROG_ID_EEPROM}"
172         WriteRegStr HKCR "${PROG_ID_EEPROM}\DefaultIcon" ""                             '"$INSTDIR\${WIN_EEPROM_EXE}",-101'
173   WriteRegExpandStr HKCR "${PROG_ID_EEPROM}\shell\open\command" ""                      '"%SYSTEMROOT%\System32\javaw.exe" -Djava.library.path="$INSTDIR" -jar "$INSTDIR\${FAT_NAME}" "%1"'
174
175         WriteRegStr HKCR ".eeprom"                      ""                              "${PROG_ID_EEPROM}"
176         WriteRegStr HKCR ".eeprom"                      "PerceivedType"                 "Altus Metrum Log File"
177         WriteRegStr HKCR ".eeprom"                      "Content Type"                  "application/vnd.altusmetrum.eeprom"
178
179         WriteRegStr HKCR ".eeprom\OpenWithProgids"      "${PROG_ID_EEPROM}"             ""
180         WriteRegStr HKCR ".eeprom\${PROG_ID_EEPROM}"    ""                              "${REG_NAME}"
181         
182         ; .telem elements
183         
184         WriteRegStr HKCR "${PROG_ID_TELEM}"             ""                              "Altus Metrum Telemetry File"
185         WriteRegStr HKCR "${PROG_ID_TELEM}"             "FriendlyTypeName"              "Altus Metrum Telemetry File"
186         WriteRegStr HKCR "${PROG_ID_TELEM}\CurVer"      ""                              "${PROG_ID_TELEM}"
187         WriteRegStr HKCR "${PROG_ID_TELEM}\DefaultIcon" ""                              '"$INSTDIR\${WIN_TELEM_EXE}",-101'
188   WriteRegExpandStr HKCR "${PROG_ID_TELEM}\shell\open\command" ""                       '"%SYSTEMROOT%\System32\javaw.exe" -Djava.library.path="$INSTDIR" -jar "$INSTDIR\${FAT_NAME}" "%1"'
189
190         WriteRegStr HKCR ".telem"                       ""                              "${PROG_ID_TELEM}"
191         WriteRegStr HKCR ".telem"                       "PerceivedType"                 "Altus Metrum Telemetry File"
192         WriteRegStr HKCR ".telem"                       "Content Type"                  "application/vnd.altusmetrum.telemetry"
193
194         WriteRegStr HKCR ".telem\OpenWithProgids"       "${PROG_ID_TELEM}"              ""
195         WriteRegStr HKCR ".telem\${PROG_ID_TELEM}"      ""                              "${REG_NAME}"
196
197         Call RefreshShellIcons
198 SectionEnd
199         
200 Section "Uninstaller"
201
202         ; Deal with the uninstaller
203
204         ${DisableX64FSRedirection}
205         SetOutPath $INSTDIR
206
207         ; Write the install path to the registry
208         WriteRegStr HKLM "SOFTWARE\${REG_NAME}" "Install_Dir" "$INSTDIR"
209
210         ; Write the uninstall keys for windows
211         WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "DisplayName" "${REG_NAME}"
212         WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "UninstallString" '"$INSTDIR\uninstall-${REG_NAME}.exe"'
213         WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoModify" "1"
214         WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoRepair" "1"
215
216         WriteUninstaller "uninstall-${REG_NAME}.exe"
217 SectionEnd
218
219 Section "Uninstall"
220
221         ${DisableX64FSRedirection}
222
223         DeleteRegKey   HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}"
224         DeleteRegKey   HKLM "SOFTWARE\${REG_NAME}"
225
226         DetailPrint "Delete uninstall reg entries"
227
228         DeleteRegKey   HKCR "${PROG_ID_EEPROM}"
229         DeleteRegKey   HKCR "${PROG_ID_TELEM}"
230
231         DeleteRegKey   HKCR ".eeprom\${PROG_ID_EEPROM}"
232         DeleteRegValue HKCR ".eeprom\OpenWithProgids" "${PROG_ID_EEPROM}"
233
234         DeleteRegKey   HKCR ".telem\${PROG_ID_TELEM}"
235         DeleteRegValue HKCR ".telem\OpenWithProgids" "${PROG_ID_TELEM}"
236
237         DetailPrint "Delete file association reg entries"
238
239         Delete "$INSTDIR\${FAT_NAME}"
240         Delete "$INSTDIR\uninstall-${REG_NAME}.exe"
241
242         Delete "$INSTDIR\${WIN_APP_ICON}"
243         Delete "$INSTDIR\${WIN_APP_EXE}"
244
245         ; Remove shortcuts, if any
246         Delete "$SMPROGRAMS\${REG_NAME}.lnk"
247         Delete "$DESKTOP\${REG_NAME}.lnk"
248         
249         Call un.RefreshShellIcons
250 SectionEnd