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 "CDM20824_Setup.exe"
70 StrCpy $2 "$INSTDIR\CDM20824_Setup.exe"
74 Section "${REG_NAME} Application"
80 File "altoslib_@ALTOSLIB_VERSION@.jar"
81 File "altosuilib_@ALTOSUILIB_VERSION@.jar"
87 File "../icon/${WIN_APP_ICON}"
89 CreateShortCut "$SMPROGRAMS\${REG_NAME}.lnk" "$SYSDIR\javaw.exe" "-jar ${FAT_NAME}" "$INSTDIR\${WIN_APP_ICON}"
92 Section "${REG_NAME} Desktop Shortcut"
93 CreateShortCut "$DESKTOP\${REG_NAME}.lnk" "$INSTDIR\${FAT_NAME}" "" "$INSTDIR\${WIN_APP_ICON}"
96 Section "Documentation"
100 File "../doc/micropeak.pdf"
103 Section "File Associations"
107 File "../icon/${WIN_APP_EXE}"
108 File "../icon/${WIN_MPD_EXE}"
110 ; application elements
112 DeleteRegKey HKCR "${PROG_ID}"
113 DeleteRegKey HKCR "${PROG_ID_MPD}"
115 WriteRegStr HKCR "${PROG_ID_MPD}" "" "MicroPeak Data File"
116 WriteRegStr HKCR "${PROG_ID_MPD}" "FriendlyTypeName" "MicroPeak Data File"
117 WriteRegStr HKCR "${PROG_ID_MPD}\CurVer" "" "${PROG_ID_MPD}"
118 WriteRegStr HKCR "${PROG_ID_MPD}\DefaultIcon" "" '"$INSTDIR\${WIN_MPD_EXE}",-101'
119 WriteRegExpandStr HKCR "${PROG_ID_MPD}\shell\play\command" "" '"%SYSTEMROOT%\System32\javaw.exe" -Djava.library.path="$INSTDIR" -jar "$INSTDIR\${FAT_NAME}" "%1"'
123 WriteRegStr HKCR ".mpd" "" "${PROG_ID_MPD}"
124 WriteRegStr HKCR ".mpd" "PerceivedType" "MicroPeak Data File"
125 WriteRegStr HKCR ".mpd" "Content Type" "application/vnd.altusmetrum.micropeak"
127 WriteRegStr HKCR ".mpd\OpenWithProgids" "${PROG_ID_MPD}" ""
128 WriteRegStr HKCR ".mpd\${PROG_ID_MPD}" "" "${REG_NAME}"
130 Call RefreshShellIcons
133 Section "Uninstaller"
135 ; Deal with the uninstaller
137 ${DisableX64FSRedirection}
140 ; Write the install path to the registry
141 WriteRegStr HKLM "SOFTWARE\${REG_NAME}" "Install_Dir" "$INSTDIR"
143 ; Write the uninstall keys for windows
144 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "DisplayName" "${REG_NAME}"
145 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "UninstallString" '"$INSTDIR\uninstall-${REG_NAME}.exe"'
146 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoModify" "1"
147 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoRepair" "1"
149 WriteUninstaller "uninstall-${REG_NAME}.exe"
154 ${DisableX64FSRedirection}
156 DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}"
157 DeleteRegKey HKLM "SOFTWARE\${REG_NAME}"
159 DetailPrint "Delete uninstall reg entries"
161 DeleteRegKey HKCR "${PROG_ID}"
162 DeleteRegKey HKCR "${PROG_ID_MPD}"
164 DeleteRegKey HKCR ".mpd\${PROG_ID_MPD}"
165 DeleteRegValue HKCR ".mpd\OpenWithProgids" "${PROG_ID_MPD}"
167 Delete "$INSTDIR\${FAT_NAME}"
168 Delete "$INSTDIR\uninstall-${REG_NAME}.exe"
170 Delete "$INSTDIR\${WIN_APP_ICON}"
171 Delete "$INSTDIR\${WIN_APP_EXE}"
173 ; Remove shortcuts, if any
174 Delete "$SMPROGRAMS\${REG_NAME}.lnk"
175 Delete "$DESKTOP\${REG_NAME}.lnk"
177 Call un.RefreshShellIcons