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" "$INSTDIR\${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"
105 ${DisableX64FSRedirection}
109 File "../icon/${WIN_APP_EXE}"
110 File "../icon/${WIN_MPD_EXE}"
112 SearchPath $1 "javaw.exe"
114 ; application elements
116 DeleteRegKey HKCR "${PROG_ID}"
117 DeleteRegKey HKCR "${PROG_ID_MPD}"
119 WriteRegStr HKCR "${PROG_ID_MPD}" "" "MicroPeak Data File"
120 WriteRegStr HKCR "${PROG_ID_MPD}" "FriendlyTypeName" "MicroPeak Data File"
121 WriteRegStr HKCR "${PROG_ID_MPD}\CurVer" "" "${PROG_ID_MPD}"
122 WriteRegStr HKCR "${PROG_ID_MPD}\DefaultIcon" "" '"$INSTDIR\${WIN_MPD_EXE}",-101'
123 WriteRegExpandStr HKCR "${PROG_ID_MPD}\shell\play\command" "" '"$1" -Djava.library.path="$INSTDIR" -jar "$INSTDIR\${FAT_NAME}" "%1"'
127 WriteRegStr HKCR ".mpd" "" "${PROG_ID_MPD}"
128 WriteRegStr HKCR ".mpd" "PerceivedType" "MicroPeak Data File"
129 WriteRegStr HKCR ".mpd" "Content Type" "application/vnd.altusmetrum.micropeak"
131 WriteRegStr HKCR ".mpd\OpenWithProgids" "${PROG_ID_MPD}" ""
132 WriteRegStr HKCR ".mpd\${PROG_ID_MPD}" "" "${REG_NAME}"
134 Call RefreshShellIcons
137 Section "Uninstaller"
139 ; Deal with the uninstaller
141 ${DisableX64FSRedirection}
144 ; Write the install path to the registry
145 WriteRegStr HKLM "SOFTWARE\${REG_NAME}" "Install_Dir" "$INSTDIR"
147 ; Write the uninstall keys for windows
148 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "DisplayName" "${REG_NAME}"
149 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "UninstallString" '"$INSTDIR\uninstall-${REG_NAME}.exe"'
150 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoModify" "1"
151 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoRepair" "1"
153 WriteUninstaller "uninstall-${REG_NAME}.exe"
158 ${DisableX64FSRedirection}
160 DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}"
161 DeleteRegKey HKLM "SOFTWARE\${REG_NAME}"
163 DetailPrint "Delete uninstall reg entries"
165 DeleteRegKey HKCR "${PROG_ID}"
166 DeleteRegKey HKCR "${PROG_ID_MPD}"
168 DeleteRegKey HKCR ".mpd\${PROG_ID_MPD}"
169 DeleteRegValue HKCR ".mpd\OpenWithProgids" "${PROG_ID_MPD}"
171 Delete "$INSTDIR\${FAT_NAME}"
172 Delete "$INSTDIR\uninstall-${REG_NAME}.exe"
174 Delete "$INSTDIR\${WIN_APP_ICON}"
175 Delete "$INSTDIR\${WIN_APP_EXE}"
177 ; Remove shortcuts, if any
178 Delete "$SMPROGRAMS\${REG_NAME}.lnk"
179 Delete "$DESKTOP\${REG_NAME}.lnk"
181 Call un.RefreshShellIcons