1 !addplugindir ../altosui/Instdrv/NSIS/Plugins
2 !addincludedir ../altosui/Instdrv/NSIS/Includes
5 !include refresh-sh.nsh
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"
16 Name "${REG_NAME} Installer"
18 ; Default install directory
19 InstallDir "$PROGRAMFILES\AltusMetrum"
21 ; Tell the installer where to re-install a new version
22 InstallDirRegKey HKLM "Software\${REG_NAME}" "Install_Dir"
24 LicenseText "GNU General Public License Version 2"
25 LicenseData "../COPYING"
27 ; Need admin privs for Vista or Win7
28 RequestExecutionLevel admin
32 ComponentText "${REG_NAME} Software and Driver Installer"
35 DetailPrint "Checking host operating system"
37 DetailPrint "Installer running on 64-bit host"
39 StrCpy $INSTDIR "$PROGRAMFILES64\AltusMetrum"
40 ${DisableX64FSRedirection}
45 DetailPrint "Checking host operating system"
47 DetailPrint "Installer running on 64-bit host"
49 StrCpy $INSTDIR "$PROGRAMFILES64\AltusMetrum"
50 ${DisableX64FSRedirection}
61 UninstPage uninstConfirm
64 ; And the stuff to install
66 Section "Install Driver" InstDriver
68 InstDrv::InitDriverSetup /NOUNLOAD {4D36E96D-E325-11CE-BFC1-08002BE10318} AltusMetrumSerial
70 DetailPrint "InitDriverSetup: $0"
71 InstDrv::DeleteOemInfFiles /NOUNLOAD
72 InstDrv::CreateDevice /NOUNLOAD
75 File "../altusmetrum.inf"
76 File "../altusmetrum.cat"
78 ${DisableX64FSRedirection}
79 IfFileExists $WINDIR\System32\PnPutil.exe 0 nopnp
80 ${DisableX64FSRedirection}
81 nsExec::ExecToLog '"$WINDIR\System32\PnPutil.exe" -i -a "$INSTDIR\altusmetrum.inf"'
84 InstDrv::InstallDriver /NOUNLOAD "$INSTDIR\altusmetrum.inf"
89 Section "${REG_NAME} Application"
95 File "altoslib_@ALTOSLIB_VERSION@.jar"
96 File "altosuilib_@ALTOSUILIB_VERSION@.jar"
99 File "cmu_time_awb.jar"
100 File "cmutimelex.jar"
101 File "cmu_us_kal.jar"
104 File "jfreechart.jar"
106 File "../icon/${WIN_APP_EXE}"
110 File "../icon/${WIN_APP_ICON}"
112 CreateShortCut "$SMPROGRAMS\${REG_NAME}.lnk" "$INSTDIR\${WIN_APP_EXE}" "" "$INSTDIR\${WIN_APP_ICON}"
115 Section "${REG_NAME} Desktop Shortcut"
116 CreateShortCut "$DESKTOP\${REG_NAME}.lnk" "$INSTDIR\${WIN_APP_EXE}" "" "$INSTDIR\${WIN_APP_ICON}"
119 Section "TeleGPS, TeleDongle and TeleBT Firmware"
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"
131 Section "Documentation"
135 File "../doc/telegps.pdf"
136 File "../doc/altos.pdf"
137 File "../doc/telemetry.pdf"
140 Section "File Associations"
142 ${DisableX64FSRedirection}
146 File "../icon/${WIN_TELEM_EXE}"
147 File "../icon/${WIN_EEPROM_EXE}"
149 DeleteRegKey HKCR "${PROG_ID_TELEM}"
150 DeleteRegKey HKCR "${PROG_ID_EEPROM}"
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}"
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"'
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"
169 WriteRegStr HKCR ".eeprom\OpenWithProgids" "${PROG_ID_EEPROM}" ""
170 WriteRegStr HKCR ".eeprom\${PROG_ID_EEPROM}" "" "${REG_NAME}"
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"'
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"
184 WriteRegStr HKCR ".telem\OpenWithProgids" "${PROG_ID_TELEM}" ""
185 WriteRegStr HKCR ".telem\${PROG_ID_TELEM}" "" "${REG_NAME}"
187 Call RefreshShellIcons
190 Section "Uninstaller"
192 ; Deal with the uninstaller
194 ${DisableX64FSRedirection}
197 ; Write the install path to the registry
198 WriteRegStr HKLM "SOFTWARE\${REG_NAME}" "Install_Dir" "$INSTDIR"
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"
206 WriteUninstaller "uninstall-${REG_NAME}.exe"
211 ${DisableX64FSRedirection}
213 DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}"
214 DeleteRegKey HKLM "SOFTWARE\${REG_NAME}"
216 DetailPrint "Delete uninstall reg entries"
218 DeleteRegKey HKCR "${PROG_ID_EEPROM}"
219 DeleteRegKey HKCR "${PROG_ID_TELEM}"
221 DeleteRegKey HKCR ".eeprom\${PROG_ID_EEPROM}"
222 DeleteRegValue HKCR ".eeprom\OpenWithProgids" "${PROG_ID_EEPROM}"
224 DeleteRegKey HKCR ".telem\${PROG_ID_TELEM}"
225 DeleteRegValue HKCR ".telem\OpenWithProgids" "${PROG_ID_TELEM}"
227 DetailPrint "Delete file association reg entries"
229 Delete "$INSTDIR\${FAT_NAME}"
230 Delete "$INSTDIR\uninstall-${REG_NAME}.exe"
232 Delete "$INSTDIR\${WIN_APP_ICON}"
233 Delete "$INSTDIR\${WIN_APP_EXE}"
235 ; Remove shortcuts, if any
236 Delete "$SMPROGRAMS\${REG_NAME}.lnk"
237 Delete "$DESKTOP\${REG_NAME}.lnk"
239 Call un.RefreshShellIcons