cli: nsis: Hook up to "Add/remove programs".
authorUwe Hermann <uwe@hermann-uwe.de>
Wed, 22 Feb 2012 17:57:34 +0000 (18:57 +0100)
committerUwe Hermann <uwe@hermann-uwe.de>
Wed, 22 Feb 2012 23:27:12 +0000 (00:27 +0100)
contrib/sigrok-cli.nsi.in

index 55868a2c6298791932a79cb794bad6415ef16cf9..8eb4510ffe57257cd9ed48c1ad9c11d99a061d3c 100644 (file)
@@ -45,6 +45,9 @@ InstallDir "$PROGRAMFILES\sigrok\@PACKAGE_NAME@"
 # http://nsis.sourceforge.net/Docs/Chapter4.html
 RequestExecutionLevel admin
 
+# Local helper definitions.
+!define REGSTR "Software\Microsoft\Windows\CurrentVersion\Uninstall\@PACKAGE_NAME@"
+
 
 # --- MUI interface configuration ---------------------------------------------
 
@@ -125,6 +128,9 @@ Section "@PACKAGE_NAME@ (required)" Section1
        # sigrok-cli
        File "c:\MinGW\msys\1.0\local\bin\@PACKAGE_NAME@.exe"
 
+       # Icon
+       File "sigrok-logo-notext.ico"
+
        # MinGW libs
        File "c:\MinGW\bin\mingwm10.dll"
        File "c:\MinGW\bin\libgcc_s_dw2-1.dll"
@@ -165,7 +171,7 @@ Section "@PACKAGE_NAME@ (required)" Section1
        SetOutPath "$DESKTOP"
        CreateShortCut "$SMPROGRAMS\sigrok\@PACKAGE_NAME@\sigrok command-line tool.lnk" \
                "$SYSDIR\cmd.exe" \
-               "/K echo For instructions run sigrok-cli --help." \
+               "/K echo For instructions run @PACKAGE_NAME@ --help." \
                "$SYSDIR\cmd.exe" 0 \
                SW_SHOWNORMAL "" "Run @PACKAGE_NAME@"
 
@@ -174,6 +180,29 @@ Section "@PACKAGE_NAME@ (required)" Section1
                "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0 \
                SW_SHOWNORMAL "" "Uninstall @PACKAGE_NAME@"
 
+       # Create registry keys for "Add/remove programs" in the control panel.
+       WriteRegStr HKLM "${REGSTR}" "DisplayName" "@PACKAGE_STRING@"
+       WriteRegStr HKLM "${REGSTR}" "UninstallString" \
+               "$\"$INSTDIR\Uninstall.exe$\""
+       WriteRegStr HKLM "${REGSTR}" "InstallLocation" "$\"$INSTDIR$\""
+       WriteRegStr HKLM "${REGSTR}" "DisplayIcon" \
+               "$\"$INSTDIR\sigrok-logo-notext.ico$\""
+       WriteRegStr HKLM "${REGSTR}" "Publisher" "sigrok"
+       WriteRegStr HKLM "${REGSTR}" "HelpLink" \
+               "http://sigrok.org/wiki/Sigrok-cli"
+       WriteRegStr HKLM "${REGSTR}" "URLUpdateInfo" \
+               "http://sigrok.org/wiki/Downloads"
+       WriteRegStr HKLM "${REGSTR}" "URLInfoAbout" "http://sigrok.org"
+       WriteRegStr HKLM "${REGSTR}" "DisplayVersion" "@PACKAGE_VERSION@"
+       WriteRegStr HKLM "${REGSTR}" "Contact" \
+               "sigrok-devel@lists.sourceforge.org"
+       WriteRegStr HKLM "${REGSTR}" "Comments" \
+               "This is the sigrok command-line application."
+
+       # Display "Remove" instead of "Modify/Remove" in the control panel.
+       WriteRegDWORD HKLM "${REGSTR}" "NoModify" 1
+       WriteRegDWORD HKLM "${REGSTR}" "NoRepair" 1
+
        # TODO: Add sigrok-cli directory to the PATH env. variable.
 
 SectionEnd
@@ -208,6 +237,7 @@ Section "Uninstall"
        Delete "$INSTDIR\libsigrok.a"
        Delete "$INSTDIR\libsigrokdecode.a"
        Delete "$INSTDIR\@PACKAGE_NAME@.exe"
+       Delete "$INSTDIR\sigrok-logo-notext.ico"
        Delete "$INSTDIR\mingwm10.dll"
        Delete "$INSTDIR\libgcc_s_dw2-1.dll"
        Delete "$INSTDIR\intl.dll"
@@ -239,6 +269,9 @@ Section "Uninstall"
        RMDir "$SMPROGRAMS\sigrok\@PACKAGE_NAME@"
        RMDir "$SMPROGRAMS\sigrok"
 
+       # Delete the registry key(s).
+       DeleteRegKey HKLM "${REGSTR}"
+
 SectionEnd