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 FAT_NAME "micropeak-fat.jar"
10 !define ICO_ICO "micro-peak.ico"
11 !define ICO_EXE "micro-peak.exe"
13 Name "${REG_NAME} Installer"
15 ; Default install directory
16 InstallDir "$PROGRAMFILES\AltusMetrum"
18 ; Tell the installer where to re-install a new version
19 InstallDirRegKey HKLM "Software\${REG_NAME}" "Install_Dir"
21 LicenseText "GNU General Public License Version 2"
22 LicenseData "../COPYING"
24 ; Need admin privs for Vista or Win7
25 RequestExecutionLevel admin
29 ComponentText "${REG_NAME} Software and Driver Installer"
32 DetailPrint "Checking host operating system"
34 DetailPrint "Installer running on 64-bit host"
36 StrCpy $INSTDIR "$PROGRAMFILES64\AltusMetrum"
37 ${DisableX64FSRedirection}
42 DetailPrint "Checking host operating system"
44 DetailPrint "Installer running on 64-bit host"
46 StrCpy $INSTDIR "$PROGRAMFILES64\AltusMetrum"
47 ${DisableX64FSRedirection}
58 UninstPage uninstConfirm
61 ; And the stuff to install
63 Section "FTDI USB Driver"
66 File "CDM20824_Setup.exe"
68 StrCpy $2 "$INSTDIR\CDM20824_Setup.exe"
72 Section "${REG_NAME} Application"
78 File "altoslib_@ALTOSLIB_VERSION@.jar"
79 File "altosuilib_@ALTOSUILIB_VERSION@.jar"
85 File "../icon/${ICO_ICO}"
87 CreateShortCut "$SMPROGRAMS\${REG_NAME}.lnk" "$SYSDIR\javaw.exe" "-jar ${FAT_NAME}" "$INSTDIR\${ICO_ICO}"
90 Section "${REG_NAME} Desktop Shortcut"
91 CreateShortCut "$DESKTOP\${REG_NAME}.lnk" "$INSTDIR\${FAT_NAME}" "" "$INSTDIR\${ICO_ICO}"
94 Section "Documentation"
98 File "../doc/micropeak.pdf"
101 Section "File Associations"
105 File "../icon/${ICO_EXE}"
107 ; application elements
109 WriteRegStr HKCR "${PROG_ID}" "" "MicroPeak Data File"
110 WriteRegStr HKCR "${PROG_ID}" "FriendlyTypeName" "MicroPeak Data File"
111 WriteRegStr HKCR "${PROG_ID}\CurVer" "" "${PROG_ID}"
112 WriteRegStr HKCR "${PROG_ID}\DefaultIcon" "" '"$INSTDIR\${ICO_EXE}",-101'
113 WriteRegExpandStr HKCR "${PROG_ID}\shell\play\command" "" '"%SYSTEMROOT%\System32\javaw.exe" -Djava.library.path="$INSTDIR" -jar "$INSTDIR\${FAT_NAME}" "%1"'
117 WriteRegStr HKCR ".mpd" "" "${PROG_ID}"
118 WriteRegStr HKCR ".mpd" "PerceivedType" "MicroPeak Data File"
119 WriteRegStr HKCR ".mpd" "Content Type" "application/micropeak"
121 WriteRegStr HKCR ".mpd\OpenWithProgids" "${PROG_ID}" ""
122 WriteRegStr HKCR ".mpd\${PROG_ID}" "" "${REG_NAME}"
124 Call RefreshShellIcons
127 Section "Uninstaller"
129 ; Deal with the uninstaller
131 ${DisableX64FSRedirection}
134 ; Write the install path to the registry
135 WriteRegStr HKLM "SOFTWARE\${REG_NAME}" "Install_Dir" "$INSTDIR"
137 ; Write the uninstall keys for windows
138 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "DisplayName" "${REG_NAME}"
139 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "UninstallString" '"$INSTDIR\uninstall-${REG_NAME}.exe"'
140 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoModify" "1"
141 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoRepair" "1"
143 WriteUninstaller "uninstall-${REG_NAME}.exe"
148 ${DisableX64FSRedirection}
150 DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}"
151 DeleteRegKey HKLM "SOFTWARE\${REG_NAME}"
153 DetailPrint "Delete uninstall reg entries"
155 DeleteRegKey HKCR "${PROG_ID}"
157 DeleteRegKey HKCR ".mpd\${PROG_ID}"
158 DeleteRegValue HKCR ".mpd\OpenWithProgids" "${PROG_ID}"
160 Delete "$INSTDIR\${FAT_NAME}"
161 Delete "$INSTDIR\uninstall-${REG_NAME}.exe"
163 Delete "$INSTDIR\${ICO_ICO}"
164 Delete "$INSTDIR\${ICO_EXE}"
166 ; Remove shortcuts, if any
167 Delete "$SMPROGRAMS\${REG_NAME}.lnk"
168 Delete "$DESKTOP\${REG_NAME}.lnk"
170 Call un.RefreshShellIcons