1 !addplugindir Instdrv/NSIS/Plugins
2 !addincludedir Instdrv/NSIS/Includes
5 !include refresh-sh.nsh
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"
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"
109 File "../icon/${WIN_APP_ICON}"
111 CreateShortCut "$SMPROGRAMS\${REG_NAME}.lnk" "$SYSDIR\javaw.exe" "-jar ${FAT_NAME}" "$INSTDIR\${WIN_APP_ICON}"
114 Section "${REG_NAME} Desktop Shortcut"
115 CreateShortCut "$DESKTOP\${REG_NAME}.lnk" "$INSTDIR\${FAT_NAME}" "" "$INSTDIR\${WIN_APP_ICON}"
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"
136 Section "Documentation"
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"
149 Section "File Associations"
151 ${DisableX64FSRedirection}
155 File "../icon/${WIN_APP_EXE}"
156 File "../icon/${WIN_TELEM_EXE}"
157 File "../icon/${WIN_EEPROM_EXE}"
159 DeleteRegKey HKCR "${PROG_ID_TELEM}"
160 DeleteRegKey HKCR "${PROG_ID_EEPROM}"
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}"
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"'
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"
179 WriteRegStr HKCR ".eeprom\OpenWithProgids" "${PROG_ID_EEPROM}" ""
180 WriteRegStr HKCR ".eeprom\${PROG_ID_EEPROM}" "" "${REG_NAME}"
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"'
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"
194 WriteRegStr HKCR ".telem\OpenWithProgids" "${PROG_ID_TELEM}" ""
195 WriteRegStr HKCR ".telem\${PROG_ID_TELEM}" "" "${REG_NAME}"
197 Call RefreshShellIcons
200 Section "Uninstaller"
202 ; Deal with the uninstaller
204 ${DisableX64FSRedirection}
207 ; Write the install path to the registry
208 WriteRegStr HKLM "SOFTWARE\${REG_NAME}" "Install_Dir" "$INSTDIR"
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"
216 WriteUninstaller "uninstall-${REG_NAME}.exe"
221 ${DisableX64FSRedirection}
223 DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}"
224 DeleteRegKey HKLM "SOFTWARE\${REG_NAME}"
226 DetailPrint "Delete uninstall reg entries"
228 DeleteRegKey HKCR "${PROG_ID_EEPROM}"
229 DeleteRegKey HKCR "${PROG_ID_TELEM}"
231 DeleteRegKey HKCR ".eeprom\${PROG_ID_EEPROM}"
232 DeleteRegValue HKCR ".eeprom\OpenWithProgids" "${PROG_ID_EEPROM}"
234 DeleteRegKey HKCR ".telem\${PROG_ID_TELEM}"
235 DeleteRegValue HKCR ".telem\OpenWithProgids" "${PROG_ID_TELEM}"
237 DetailPrint "Delete file association reg entries"
239 Delete "$INSTDIR\${FAT_NAME}"
240 Delete "$INSTDIR\uninstall-${REG_NAME}.exe"
242 Delete "$INSTDIR\${WIN_APP_ICON}"
243 Delete "$INSTDIR\${WIN_APP_EXE}"
245 ; Remove shortcuts, if any
246 Delete "$SMPROGRAMS\${REG_NAME}.lnk"
247 Delete "$DESKTOP\${REG_NAME}.lnk"
249 Call un.RefreshShellIcons