]> git.gag.com Git - fw/altos/blob - telegps/telegps-windows.nsi.in
altosdroid: Update Makefile.am to run gradle-based build
[fw/altos] / telegps / telegps-windows.nsi.in
1 !addplugindir ../altosui/Instdrv/NSIS/Plugins
2 !addincludedir ../altosui/Instdrv/NSIS/Includes
3 !include x64.nsh
4 !include java.nsh
5 !include refresh-sh.nsh
6
7 !define REG_NAME        "TeleGPS"
8 !define PROG_ID_TELEM   "altusmetrum.telegps.telem.1"
9 !define PROG_ID_EEPROM  "altusmetrum.telegps.eeprom.1"
10 !define FAT_NAME        "telegps-fat.jar"
11 !define WIN_APP_ICON    "altusmetrum-telegps.ico"
12 !define WIN_APP_EXE     "altusmetrum-telegps.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         File "../icon/${WIN_APP_EXE}"
107
108         File "*.dll"
109
110         File "../icon/${WIN_APP_ICON}"
111
112         CreateShortCut "$SMPROGRAMS\${REG_NAME}.lnk" "$INSTDIR\${WIN_APP_EXE}" "" "$INSTDIR\${WIN_APP_ICON}"
113 SectionEnd
114
115 Section "${REG_NAME} Desktop Shortcut"
116         CreateShortCut "$DESKTOP\${REG_NAME}.lnk" "$INSTDIR\${WIN_APP_EXE}"  "" "$INSTDIR\${WIN_APP_ICON}"
117 SectionEnd
118
119 Section "TeleGPS, TeleDongle and TeleBT Firmware"
120
121         SetOutPath $INSTDIR
122
123         File "../src/telegps-v1.0/telegps-v1.0-${VERSION}.ihx"
124         File "../src/telegps-v2.0/telegps-v2.0-${VERSION}.ihx"
125         File "../src/teledongle-v3.0/teledongle-v3.0-${VERSION}.ihx"
126         File "../src/telebt-v3.0/telebt-v3.0-${VERSION}.ihx"
127         File "../src/telebt-v4.0/telebt-v4.0-${VERSION}.ihx"
128
129 SectionEnd
130
131 Section "Documentation"
132
133         SetOutPath $INSTDIR
134
135         File "../doc/telegps.pdf"
136         File "../doc/altos.pdf"
137         File "../doc/telemetry.pdf"
138 SectionEnd
139
140 Section "File Associations"
141
142         ${DisableX64FSRedirection}
143
144         SetOutPath $INSTDIR
145
146         File "../icon/${WIN_TELEM_EXE}"
147         File "../icon/${WIN_EEPROM_EXE}"
148
149         DeleteRegKey HKCR "${PROG_ID_TELEM}"
150         DeleteRegKey HKCR "${PROG_ID_EEPROM}"
151
152         DeleteRegKey   HKCR ".eeprom\${PROG_ID_EEPROM}"
153         DeleteRegValue HKCR ".eeprom\OpenWithProgids" "${PROG_ID_EEPROM}"
154         DeleteRegKey   HKCR ".telem\${PROG_ID_EEPROM}"
155         DeleteRegValue HKCR ".telem\OpenWithProgids" "${PROG_ID_EEPROM}"
156
157         ; .eeprom elements
158
159         WriteRegStr HKCR "${PROG_ID_EEPROM}"            ""                              "Altus Metrum Log File"
160         WriteRegStr HKCR "${PROG_ID_EEPROM}"            "FriendlyTypeName"              "Altus Metrum Log File"
161         WriteRegStr HKCR "${PROG_ID_EEPROM}\CurVer"     ""                              "${PROG_ID_EEPROM}"
162         WriteRegStr HKCR "${PROG_ID_EEPROM}\DefaultIcon" ""                             '"$INSTDIR\${WIN_EEPROM_EXE}",-101'
163   WriteRegExpandStr HKCR "${PROG_ID_EEPROM}\shell\open\command" ""                      '"$INSTDIR\${WIN_APP_EXE}" "%1"'
164
165         WriteRegStr HKCR ".eeprom"                      ""                              "${PROG_ID_EEPROM}"
166         WriteRegStr HKCR ".eeprom"                      "PerceivedType"                 "Altus Metrum Log File"
167         WriteRegStr HKCR ".eeprom"                      "Content Type"                  "application/vnd.altusmetrum.eeprom"
168
169         WriteRegStr HKCR ".eeprom\OpenWithProgids"      "${PROG_ID_EEPROM}"             ""
170         WriteRegStr HKCR ".eeprom\${PROG_ID_EEPROM}"    ""                              "${REG_NAME}"
171         
172         ; .telem elements
173         
174         WriteRegStr HKCR "${PROG_ID_TELEM}"             ""                              "Altus Metrum Telemetry File"
175         WriteRegStr HKCR "${PROG_ID_TELEM}"             "FriendlyTypeName"              "Altus Metrum Telemetry File"
176         WriteRegStr HKCR "${PROG_ID_TELEM}\CurVer"      ""                              "${PROG_ID_TELEM}"
177         WriteRegStr HKCR "${PROG_ID_TELEM}\DefaultIcon" ""                              '"$INSTDIR\${WIN_TELEM_EXE}",-101'
178   WriteRegExpandStr HKCR "${PROG_ID_TELEM}\shell\open\command" ""                       '"$INSTDIR\${WIN_APP_EXE}" "%1"'
179
180         WriteRegStr HKCR ".telem"                       ""                              "${PROG_ID_TELEM}"
181         WriteRegStr HKCR ".telem"                       "PerceivedType"                 "Altus Metrum Telemetry File"
182         WriteRegStr HKCR ".telem"                       "Content Type"                  "application/vnd.altusmetrum.telemetry"
183
184         WriteRegStr HKCR ".telem\OpenWithProgids"       "${PROG_ID_TELEM}"              ""
185         WriteRegStr HKCR ".telem\${PROG_ID_TELEM}"      ""                              "${REG_NAME}"
186
187         Call RefreshShellIcons
188 SectionEnd
189         
190 Section "Uninstaller"
191
192         ; Deal with the uninstaller
193
194         ${DisableX64FSRedirection}
195         SetOutPath $INSTDIR
196
197         ; Write the install path to the registry
198         WriteRegStr HKLM "SOFTWARE\${REG_NAME}" "Install_Dir" "$INSTDIR"
199
200         ; Write the uninstall keys for windows
201         WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "DisplayName" "${REG_NAME}"
202         WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "UninstallString" '"$INSTDIR\uninstall-${REG_NAME}.exe"'
203         WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoModify" "1"
204         WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoRepair" "1"
205
206         WriteUninstaller "uninstall-${REG_NAME}.exe"
207 SectionEnd
208
209 Section "Uninstall"
210
211         ${DisableX64FSRedirection}
212
213         DeleteRegKey   HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}"
214         DeleteRegKey   HKLM "SOFTWARE\${REG_NAME}"
215
216         DetailPrint "Delete uninstall reg entries"
217
218         DeleteRegKey   HKCR "${PROG_ID_EEPROM}"
219         DeleteRegKey   HKCR "${PROG_ID_TELEM}"
220
221         DeleteRegKey   HKCR ".eeprom\${PROG_ID_EEPROM}"
222         DeleteRegValue HKCR ".eeprom\OpenWithProgids" "${PROG_ID_EEPROM}"
223
224         DeleteRegKey   HKCR ".telem\${PROG_ID_TELEM}"
225         DeleteRegValue HKCR ".telem\OpenWithProgids" "${PROG_ID_TELEM}"
226
227         DetailPrint "Delete file association reg entries"
228
229         Delete "$INSTDIR\${FAT_NAME}"
230         Delete "$INSTDIR\uninstall-${REG_NAME}.exe"
231
232         Delete "$INSTDIR\${WIN_APP_ICON}"
233         Delete "$INSTDIR\${WIN_APP_EXE}"
234
235         ; Remove shortcuts, if any
236         Delete "$SMPROGRAMS\${REG_NAME}.lnk"
237         Delete "$DESKTOP\${REG_NAME}.lnk"
238         
239         Call un.RefreshShellIcons
240 SectionEnd