1 !addplugindir ../altosui/Instdrv/NSIS/Plugins
2 !addincludedir ../altosui/Instdrv/NSIS/Includes
5 !include refresh-sh.nsh
7 !define REG_NAME "MicroPeak"
8 !define PROG_ID "org.altusmetrum.micropeak.1"
9 !define PROG_ID_MPD "org.altusmetrum.micropeak.mpd.1"
10 !define FAT_NAME "micropeak-fat.jar"
11 !define WIN_APP_ICON "altusmetrum-micropeak.ico"
12 !define WIN_APP_EXE "altusmetrum-micropeak.exe"
13 !define WIN_MPD_EXE "application-vnd.altusmetrum.micropeak.exe"
15 Name "${REG_NAME} Installer"
17 ; Default install directory
18 InstallDir "$PROGRAMFILES\AltusMetrum"
20 ; Tell the installer where to re-install a new version
21 InstallDirRegKey HKLM "Software\${REG_NAME}" "Install_Dir"
23 LicenseText "GNU General Public License Version 2"
24 LicenseData "../COPYING"
26 ; Need admin privs for Vista or Win7
27 RequestExecutionLevel admin
31 ComponentText "${REG_NAME} Software and Driver Installer"
34 DetailPrint "Checking host operating system"
36 DetailPrint "Installer running on 64-bit host"
38 StrCpy $INSTDIR "$PROGRAMFILES64\AltusMetrum"
39 ${DisableX64FSRedirection}
44 DetailPrint "Checking host operating system"
46 DetailPrint "Installer running on 64-bit host"
48 StrCpy $INSTDIR "$PROGRAMFILES64\AltusMetrum"
49 ${DisableX64FSRedirection}
60 UninstPage uninstConfirm
63 ; And the stuff to install
65 Section "Install Driver" InstDriver
67 InstDrv::InitDriverSetup /NOUNLOAD {4D36E96D-E325-11CE-BFC1-08002BE10318} AltusMetrumSerial
69 DetailPrint "InitDriverSetup: $0"
70 InstDrv::DeleteOemInfFiles /NOUNLOAD
71 InstDrv::CreateDevice /NOUNLOAD
74 File "../altusmetrum.inf"
75 File "../altusmetrum.cat"
77 ${DisableX64FSRedirection}
78 IfFileExists $WINDIR\System32\PnPutil.exe 0 nopnp
79 ${DisableX64FSRedirection}
80 nsExec::ExecToLog '"$WINDIR\System32\PnPutil.exe" -i -a "$INSTDIR\altusmetrum.inf"'
83 InstDrv::InstallDriver /NOUNLOAD "$INSTDIR\altusmetrum.inf"
88 Section "${REG_NAME} Application"
94 File "altoslib_@ALTOSLIB_VERSION@.jar"
95 File "altosuilib_@ALTOSUILIB_VERSION@.jar"
98 File "../icon/${WIN_APP_EXE}"
102 File "../icon/${WIN_APP_ICON}"
104 CreateShortCut "$SMPROGRAMS\${REG_NAME}.lnk" "$INSTDIR\${WIN_APP_EXE}" "" "$INSTDIR\${WIN_APP_ICON}"
107 Section "${REG_NAME} Desktop Shortcut"
108 CreateShortCut "$DESKTOP\${REG_NAME}.lnk" "$INSTDIR\${WIN_APP_EXE}" "" "$INSTDIR\${WIN_APP_ICON}"
111 Section "FTDI USB Driver"
114 File "CDM_v2.12.00_WHQL_Certified.exe"
116 StrCpy $2 "$INSTDIR\CDM_v2.12.00_WHQL_Certified.exe"
123 File "../src/micropeak/micropeak-v0.1-${VERSION}.ihx"
124 File "../src/microsplash/microsplash-v1.0-${VERSION}.ihx"
128 Section "Documentation"
132 File "../doc/micropeak.pdf"
135 Section "File Associations"
137 ${DisableX64FSRedirection}
141 File "../icon/${WIN_MPD_EXE}"
143 ; application elements
145 DeleteRegKey HKCR "${PROG_ID}"
146 DeleteRegKey HKCR "${PROG_ID_MPD}"
148 WriteRegStr HKCR "${PROG_ID_MPD}" "" "MicroPeak Data File"
149 WriteRegStr HKCR "${PROG_ID_MPD}" "FriendlyTypeName" "MicroPeak Data File"
150 WriteRegStr HKCR "${PROG_ID_MPD}\CurVer" "" "${PROG_ID_MPD}"
151 WriteRegStr HKCR "${PROG_ID_MPD}\DefaultIcon" "" '"$INSTDIR\${WIN_MPD_EXE}",-101'
152 WriteRegExpandStr HKCR "${PROG_ID_MPD}\shell\play\command" "" '"$INSTDIR\${WIN_APP_EXE}" "%1"'
156 WriteRegStr HKCR ".mpd" "" "${PROG_ID_MPD}"
157 WriteRegStr HKCR ".mpd" "PerceivedType" "MicroPeak Data File"
158 WriteRegStr HKCR ".mpd" "Content Type" "application/vnd.altusmetrum.micropeak"
160 WriteRegStr HKCR ".mpd\OpenWithProgids" "${PROG_ID_MPD}" ""
161 WriteRegStr HKCR ".mpd\${PROG_ID_MPD}" "" "${REG_NAME}"
163 Call RefreshShellIcons
166 Section "Uninstaller"
168 ; Deal with the uninstaller
170 ${DisableX64FSRedirection}
173 ; Write the install path to the registry
174 WriteRegStr HKLM "SOFTWARE\${REG_NAME}" "Install_Dir" "$INSTDIR"
176 ; Write the uninstall keys for windows
177 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "DisplayName" "${REG_NAME}"
178 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "UninstallString" '"$INSTDIR\uninstall-${REG_NAME}.exe"'
179 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoModify" "1"
180 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoRepair" "1"
182 WriteUninstaller "uninstall-${REG_NAME}.exe"
187 ${DisableX64FSRedirection}
189 DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}"
190 DeleteRegKey HKLM "SOFTWARE\${REG_NAME}"
192 DetailPrint "Delete uninstall reg entries"
194 DeleteRegKey HKCR "${PROG_ID}"
195 DeleteRegKey HKCR "${PROG_ID_MPD}"
197 DeleteRegKey HKCR ".mpd\${PROG_ID_MPD}"
198 DeleteRegValue HKCR ".mpd\OpenWithProgids" "${PROG_ID_MPD}"
200 Delete "$INSTDIR\${FAT_NAME}"
201 Delete "$INSTDIR\uninstall-${REG_NAME}.exe"
203 Delete "$INSTDIR\${WIN_APP_ICON}"
204 Delete "$INSTDIR\${WIN_APP_EXE}"
206 ; Remove shortcuts, if any
207 Delete "$SMPROGRAMS\${REG_NAME}.lnk"
208 Delete "$DESKTOP\${REG_NAME}.lnk"
210 Call un.RefreshShellIcons