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 "org.altusmetrum.telegps.1"
9 !define PROG_ALTOSUI "org.altusmetrum.altosui.1"
10 !define FAT_NAME "telegps-fat.jar"
11 !define ICO_ICO "telegps.ico"
12 !define ICO_EXE "telegps.exe"
14 Name "${REG_NAME} Installer"
16 ; Default install directory
17 InstallDir "$PROGRAMFILES\AltusMetrum"
19 ; Tell the installer where to re-install a new version
20 InstallDirRegKey HKLM "Software\${REG_NAME}" "Install_Dir"
22 LicenseText "GNU General Public License Version 2"
23 LicenseData "../COPYING"
25 ; Need admin privs for Vista or Win7
26 RequestExecutionLevel admin
30 ComponentText "${REG_NAME} Software and Driver Installer"
33 DetailPrint "Checking host operating system"
35 DetailPrint "Installer running on 64-bit host"
37 StrCpy $INSTDIR "$PROGRAMFILES64\AltusMetrum"
38 ${DisableX64FSRedirection}
43 DetailPrint "Checking host operating system"
45 DetailPrint "Installer running on 64-bit host"
47 StrCpy $INSTDIR "$PROGRAMFILES64\AltusMetrum"
48 ${DisableX64FSRedirection}
59 UninstPage uninstConfirm
62 ; And the stuff to install
64 Section "Install Driver" InstDriver
66 InstDrv::InitDriverSetup /NOUNLOAD {4D36E96D-E325-11CE-BFC1-08002BE10318} AltusMetrumSerial
68 DetailPrint "InitDriverSetup: $0"
69 InstDrv::DeleteOemInfFiles /NOUNLOAD
70 InstDrv::CreateDevice /NOUNLOAD
73 File "../altusmetrum.inf"
74 File "../altusmetrum.cat"
76 ${DisableX64FSRedirection}
77 IfFileExists $WINDIR\System32\PnPutil.exe 0 nopnp
78 ${DisableX64FSRedirection}
79 nsExec::ExecToLog '"$WINDIR\System32\PnPutil.exe" -i -a "$INSTDIR\altusmetrum.inf"'
82 InstDrv::InstallDriver /NOUNLOAD "$INSTDIR\altusmetrum.inf"
87 Section "${REG_NAME} Application"
93 File "altoslib_@ALTOSLIB_VERSION@.jar"
94 File "altosuilib_@ALTOSUILIB_VERSION@.jar"
97 File "cmu_time_awb.jar"
102 File "jfreechart.jar"
107 File "../icon/${ICO_ICO}"
109 CreateShortCut "$SMPROGRAMS\${REG_NAME}.lnk" "$SYSDIR\javaw.exe" "-jar ${FAT_NAME}" "$INSTDIR\${ICO_ICO}"
112 Section "${REG_NAME} Desktop Shortcut"
113 CreateShortCut "$DESKTOP\${REG_NAME}.lnk" "$INSTDIR\${FAT_NAME}" "" "$INSTDIR\${ICO_ICO}"
116 Section "TeleGPS, TeleDongle and TeleBT Firmware"
120 File "../src/telegps-v1.0/telegps-v1.0-${VERSION}.ihx"
121 File "../src/teledongle-v0.2/teledongle-v0.2-${VERSION}.ihx"
122 File "../src/telebt-v1.0/telebt-v1.0-${VERSION}.ihx"
126 Section "Documentation"
130 File "../doc/telegps.pdf"
131 File "../doc/altos.pdf"
132 File "../doc/telemetry.pdf"
135 Section "File Associations"
139 File "../icon/${ICO_EXE}"
141 ; application elements
143 WriteRegStr HKCR "${PROG_ID}" "" "Altus Metrum Data File"
144 WriteRegStr HKCR "${PROG_ID}" "FriendlyTypeName" "Altus Metrum Data File"
145 WriteRegStr HKCR "${PROG_ID}\CurVer" "" "${PROG_ID}"
146 WriteRegStr HKCR "${PROG_ID}\DefaultIcon" "" '"$INSTDIR\${ICO_EXE}",-101'
147 WriteRegExpandStr HKCR "${PROG_ID}\shell\play\command" "" '"%SYSTEMROOT%\System32\javaw.exe" -Djava.library.path="$INSTDIR" -jar "$INSTDIR\${FAT_NAME}" "%1"'
151 WriteRegStr HKCR ".eeprom" "" "${PROG_ALTOSUI}"
152 WriteRegStr HKCR ".eeprom" "PerceivedType" "Altus Metrum Log File"
153 WriteRegStr HKCR ".eeprom" "Content Type" "application/altosui"
155 WriteRegStr HKCR ".eeprom\OpenWithProgids" "${PROG_ID}" ""
156 WriteRegStr HKCR ".eeprom\${PROG_ID}" "" "${REG_NAME}"
160 WriteRegStr HKCR ".telem" "" "${PROG_ALTOSUI}"
161 WriteRegStr HKCR ".telem" "PerceivedType" "Altus Metrum Telemetry File"
162 WriteRegStr HKCR ".telem" "Content Type" "application/altosui"
164 WriteRegStr HKCR ".telem\OpenWithProgids" "${PROG_ID}" ""
165 WriteRegStr HKCR ".telem\${PROG_ID}" "" "${REG_NAME}"
167 Call RefreshShellIcons
170 Section "Uninstaller"
172 ; Deal with the uninstaller
174 ${DisableX64FSRedirection}
177 ; Write the install path to the registry
178 WriteRegStr HKLM "SOFTWARE\${REG_NAME}" "Install_Dir" "$INSTDIR"
180 ; Write the uninstall keys for windows
181 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "DisplayName" "${REG_NAME}"
182 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "UninstallString" '"$INSTDIR\uninstall-${REG_NAME}.exe"'
183 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoModify" "1"
184 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoRepair" "1"
186 WriteUninstaller "uninstall-${REG_NAME}.exe"
191 ${DisableX64FSRedirection}
193 DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}"
194 DeleteRegKey HKLM "SOFTWARE\${REG_NAME}"
196 DetailPrint "Delete uninstall reg entries"
198 DeleteRegKey HKCR "${PROG_ID}"
200 DeleteRegKey HKCR ".eeprom\${PROG_ID}"
201 DeleteRegValue HKCR ".eeprom\OpenWithProgids" "${PROG_ID}"
203 DeleteRegKey HKCR ".telem\${PROG_ID}"
204 DeleteRegValue HKCR ".telem\OpenWithProgids" "${PROG_ID}"
206 DetailPrint "Delete file association reg entries"
208 Delete "$INSTDIR\${FAT_NAME}"
209 Delete "$INSTDIR\uninstall-${REG_NAME}.exe"
211 Delete "$INSTDIR\${ICO_ICO}"
212 Delete "$INSTDIR\${ICO_EXE}"
214 ; Remove shortcuts, if any
215 Delete "$SMPROGRAMS\${REG_NAME}.lnk"
216 Delete "$DESKTOP\${REG_NAME}.lnk"
218 Call un.RefreshShellIcons