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 "FTDI USB Driver"
68 File "CDM_v2.12.00_WHQL_Certified.exe"
70 StrCpy $2 "$INSTDIR\CDM_v2.12.00_WHQL_Certified.exe"
74 Section "Install Driver" InstDriver
76 InstDrv::InitDriverSetup /NOUNLOAD {4D36E96D-E325-11CE-BFC1-08002BE10318} AltusMetrumSerial
78 DetailPrint "InitDriverSetup: $0"
79 InstDrv::DeleteOemInfFiles /NOUNLOAD
80 InstDrv::CreateDevice /NOUNLOAD
83 File "../altusmetrum.inf"
84 File "../altusmetrum.cat"
86 ${DisableX64FSRedirection}
87 IfFileExists $WINDIR\System32\PnPutil.exe 0 nopnp
88 ${DisableX64FSRedirection}
89 nsExec::ExecToLog '"$WINDIR\System32\PnPutil.exe" -i -a "$INSTDIR\altusmetrum.inf"'
92 InstDrv::InstallDriver /NOUNLOAD "$INSTDIR\altusmetrum.inf"
97 Section "${REG_NAME} Application"
103 File "altoslib_@ALTOSLIB_VERSION@.jar"
104 File "altosuilib_@ALTOSUILIB_VERSION@.jar"
105 File "jfreechart.jar"
107 File "../icon/${WIN_APP_EXE}"
111 File "../icon/${WIN_APP_ICON}"
113 CreateShortCut "$SMPROGRAMS\${REG_NAME}.lnk" "$INSTDIR\${WIN_APP_EXE}" "" "$INSTDIR\${WIN_APP_ICON}"
116 Section "${REG_NAME} Desktop Shortcut"
117 CreateShortCut "$DESKTOP\${REG_NAME}.lnk" "$INSTDIR\${WIN_APP_EXE}" "" "$INSTDIR\${WIN_APP_ICON}"
120 Section "Documentation"
124 File "../doc/micropeak.pdf"
127 Section "File Associations"
129 ${DisableX64FSRedirection}
133 File "../icon/${WIN_MPD_EXE}"
135 ; application elements
137 DeleteRegKey HKCR "${PROG_ID}"
138 DeleteRegKey HKCR "${PROG_ID_MPD}"
140 WriteRegStr HKCR "${PROG_ID_MPD}" "" "MicroPeak Data File"
141 WriteRegStr HKCR "${PROG_ID_MPD}" "FriendlyTypeName" "MicroPeak Data File"
142 WriteRegStr HKCR "${PROG_ID_MPD}\CurVer" "" "${PROG_ID_MPD}"
143 WriteRegStr HKCR "${PROG_ID_MPD}\DefaultIcon" "" '"$INSTDIR\${WIN_MPD_EXE}",-101'
144 WriteRegExpandStr HKCR "${PROG_ID_MPD}\shell\play\command" "" '"$INSTDIR\${WIN_APP_EXE}" "%1"'
148 WriteRegStr HKCR ".mpd" "" "${PROG_ID_MPD}"
149 WriteRegStr HKCR ".mpd" "PerceivedType" "MicroPeak Data File"
150 WriteRegStr HKCR ".mpd" "Content Type" "application/vnd.altusmetrum.micropeak"
152 WriteRegStr HKCR ".mpd\OpenWithProgids" "${PROG_ID_MPD}" ""
153 WriteRegStr HKCR ".mpd\${PROG_ID_MPD}" "" "${REG_NAME}"
155 Call RefreshShellIcons
158 Section "Uninstaller"
160 ; Deal with the uninstaller
162 ${DisableX64FSRedirection}
165 ; Write the install path to the registry
166 WriteRegStr HKLM "SOFTWARE\${REG_NAME}" "Install_Dir" "$INSTDIR"
168 ; Write the uninstall keys for windows
169 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "DisplayName" "${REG_NAME}"
170 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "UninstallString" '"$INSTDIR\uninstall-${REG_NAME}.exe"'
171 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoModify" "1"
172 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoRepair" "1"
174 WriteUninstaller "uninstall-${REG_NAME}.exe"
179 ${DisableX64FSRedirection}
181 DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}"
182 DeleteRegKey HKLM "SOFTWARE\${REG_NAME}"
184 DetailPrint "Delete uninstall reg entries"
186 DeleteRegKey HKCR "${PROG_ID}"
187 DeleteRegKey HKCR "${PROG_ID_MPD}"
189 DeleteRegKey HKCR ".mpd\${PROG_ID_MPD}"
190 DeleteRegValue HKCR ".mpd\OpenWithProgids" "${PROG_ID_MPD}"
192 Delete "$INSTDIR\${FAT_NAME}"
193 Delete "$INSTDIR\uninstall-${REG_NAME}.exe"
195 Delete "$INSTDIR\${WIN_APP_ICON}"
196 Delete "$INSTDIR\${WIN_APP_EXE}"
198 ; Remove shortcuts, if any
199 Delete "$SMPROGRAMS\${REG_NAME}.lnk"
200 Delete "$DESKTOP\${REG_NAME}.lnk"
202 Call un.RefreshShellIcons