X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=micropeak%2Fmicropeak-windows.nsi.in;h=848523b03d79fc34d6b9f5e58a0c202be43235c5;hp=bb5da1bb64e4e33846344a57bb5e3c5c9058e43b;hb=1b0f56ddb2b85b68232c22a7a8b8744cb9ad76f9;hpb=3f4e765c05ddbae83ca0c0176572cd698f285d08 diff --git a/micropeak/micropeak-windows.nsi.in b/micropeak/micropeak-windows.nsi.in index bb5da1bb..848523b0 100644 --- a/micropeak/micropeak-windows.nsi.in +++ b/micropeak/micropeak-windows.nsi.in @@ -1,15 +1,24 @@ -!addplugindir Instdrv/NSIS/Plugins +!addplugindir ../altosui/Instdrv/NSIS/Plugins !addincludedir ../altosui/Instdrv/NSIS/Includes !include x64.nsh !include java.nsh +!include refresh-sh.nsh -Name "Altus Metrum MicroPeak Installer" +!define REG_NAME "MicroPeak" +!define PROG_ID "org.altusmetrum.micropeak.1" +!define PROG_ID_MPD "org.altusmetrum.micropeak.mpd.1" +!define FAT_NAME "micropeak-fat.jar" +!define WIN_APP_ICON "altusmetrum-micropeak.ico" +!define WIN_APP_EXE "altusmetrum-micropeak.exe" +!define WIN_MPD_EXE "application-vnd.altusmetrum.micropeak.exe" + +Name "${REG_NAME} Installer" ; Default install directory InstallDir "$PROGRAMFILES\AltusMetrum" ; Tell the installer where to re-install a new version -InstallDirRegKey HKLM "Software\AltusMetrum" "Install_Dir" +InstallDirRegKey HKLM "Software\${REG_NAME}" "Install_Dir" LicenseText "GNU General Public License Version 2" LicenseData "../COPYING" @@ -19,7 +28,7 @@ RequestExecutionLevel admin ShowInstDetails Show -ComponentText "Altus Metrum MicroPeak Software Installer" +ComponentText "${REG_NAME} Software and Driver Installer" Function .onInit DetailPrint "Checking host operating system" @@ -31,6 +40,16 @@ Function .onInit ${EndIf} FunctionEnd +Function un.onInit + DetailPrint "Checking host operating system" + ${If} ${RunningX64} + DetailPrint "Installer running on 64-bit host" + SetRegView 64 + StrCpy $INSTDIR "$PROGRAMFILES64\AltusMetrum" + ${DisableX64FSRedirection} + ${EndIf} +FunctionEnd + ; Pages to present Page license @@ -43,12 +62,21 @@ UninstPage instfiles ; And the stuff to install -Section "MicroPeak Application" +Section "FTDI USB Driver" + SetOutPath $INSTDIR + + File "CDM20824_Setup.exe" + + StrCpy $2 "$INSTDIR\CDM20824_Setup.exe" + ExecWait $2 +SectionEnd + +Section "${REG_NAME} Application" Call DetectJRE SetOutPath $INSTDIR - File "micropeak-fat.jar" + File "${FAT_NAME}" File "altoslib_@ALTOSLIB_VERSION@.jar" File "altosuilib_@ALTOSUILIB_VERSION@.jar" File "jfreechart.jar" @@ -56,22 +84,13 @@ Section "MicroPeak Application" File "*.dll" - File "../icon/*.ico" - - CreateShortCut "$SMPROGRAMS\MicroPeak.lnk" "$SYSDIR\javaw.exe" "-jar micropeak-fat.jar" "$INSTDIR\micro-peak.ico" -SectionEnd - -Section "FTDI USB Driver" - SetOutPath $INSTDIR - - File "CDM20824_Setup.exe" + File "../icon/${WIN_APP_ICON}" - StrCpy $2 "$INSTDIR\CDM20824_Setup.exe" - ExecWait $2 + CreateShortCut "$SMPROGRAMS\${REG_NAME}.lnk" "$SYSDIR\javaw.exe" "-jar ${FAT_NAME}" "$INSTDIR\${WIN_APP_ICON}" SectionEnd -Section "MicroPeak Desktop Shortcut" - CreateShortCut "$DESKTOP\MicroPeak.lnk" "$INSTDIR\micropeak-fat.jar" "" "$INSTDIR\micro-peak.ico" +Section "${REG_NAME} Desktop Shortcut" + CreateShortCut "$DESKTOP\${REG_NAME}.lnk" "$INSTDIR\${FAT_NAME}" "" "$INSTDIR\${WIN_APP_ICON}" SectionEnd Section "Documentation" @@ -81,33 +100,79 @@ Section "Documentation" File "../doc/micropeak.pdf" SectionEnd +Section "File Associations" + + SetOutPath $INSTDIR + + File "../icon/${WIN_APP_EXE}" + File "../icon/${WIN_MPD_EXE}" + + ; application elements + + DeleteRegKey HKCR "${PROG_ID}" + DeleteRegKey HKCR "${PROG_ID_MPD}" + + WriteRegStr HKCR "${PROG_ID_MPD}" "" "MicroPeak Data File" + WriteRegStr HKCR "${PROG_ID_MPD}" "FriendlyTypeName" "MicroPeak Data File" + WriteRegStr HKCR "${PROG_ID_MPD}\CurVer" "" "${PROG_ID_MPD}" + WriteRegStr HKCR "${PROG_ID_MPD}\DefaultIcon" "" '"$INSTDIR\${WIN_MPD_EXE}",-101' + WriteRegExpandStr HKCR "${PROG_ID_MPD}\shell\play\command" "" '"%SYSTEMROOT%\System32\javaw.exe" -Djava.library.path="$INSTDIR" -jar "$INSTDIR\${FAT_NAME}" "%1"' + + ; .mpd elements + + WriteRegStr HKCR ".mpd" "" "${PROG_ID_MPD}" + WriteRegStr HKCR ".mpd" "PerceivedType" "MicroPeak Data File" + WriteRegStr HKCR ".mpd" "Content Type" "application/vnd.altusmetrum.micropeak" + + WriteRegStr HKCR ".mpd\OpenWithProgids" "${PROG_ID_MPD}" "" + WriteRegStr HKCR ".mpd\${PROG_ID_MPD}" "" "${REG_NAME}" + + Call RefreshShellIcons +SectionEnd + Section "Uninstaller" ; Deal with the uninstaller + ${DisableX64FSRedirection} SetOutPath $INSTDIR ; Write the install path to the registry - WriteRegStr HKLM SOFTWARE\AltusMetrum "Install_Dir" "$INSTDIR" + WriteRegStr HKLM "SOFTWARE\${REG_NAME}" "Install_Dir" "$INSTDIR" ; Write the uninstall keys for windows - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "DisplayName" "Altus Metrum" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "UninstallString" '"$INSTDIR\uninstall.exe"' - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "NoModify" "1" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "NoRepair" "1" + WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "DisplayName" "${REG_NAME}" + WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "UninstallString" '"$INSTDIR\uninstall-${REG_NAME}.exe"' + WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoModify" "1" + WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoRepair" "1" - WriteUninstaller "uninstall.exe" + WriteUninstaller "uninstall-${REG_NAME}.exe" SectionEnd Section "Uninstall" - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" - DeleteRegKey HKLM "Software\AltusMetrum" - Delete "$INSTDIR\*.*" - RMDir "$INSTDIR" + ${DisableX64FSRedirection} + + DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" + DeleteRegKey HKLM "SOFTWARE\${REG_NAME}" + + DetailPrint "Delete uninstall reg entries" + + DeleteRegKey HKCR "${PROG_ID}" + DeleteRegKey HKCR "${PROG_ID_MPD}" + + DeleteRegKey HKCR ".mpd\${PROG_ID_MPD}" + DeleteRegValue HKCR ".mpd\OpenWithProgids" "${PROG_ID_MPD}" + + Delete "$INSTDIR\${FAT_NAME}" + Delete "$INSTDIR\uninstall-${REG_NAME}.exe" + + Delete "$INSTDIR\${WIN_APP_ICON}" + Delete "$INSTDIR\${WIN_APP_EXE}" ; Remove shortcuts, if any - Delete "$SMPROGRAMS\MicroPeak.lnk" - Delete "$DESKTOP\MicroPeak.lnk" + Delete "$SMPROGRAMS\${REG_NAME}.lnk" + Delete "$DESKTOP\${REG_NAME}.lnk" + Call un.RefreshShellIcons SectionEnd