Skip to content

Commit

Permalink
packaging: properly unregister Alloy when uninstalling on Windows
Browse files Browse the repository at this point in the history
grafana/agent#6550 fixed an issue where the service settings were not
being removed properly, but inadvertedly broke the process of removing
the application from the Add/Remove programs list.

Alloy is registered as a program to the 32-bit registry, and so it must
be removed from the 32-bit registry and not the 64-bit registry.

Fixes #165.

As a temporary workaround to this bug, users should delete
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Alloy from the
32-bit registry.
  • Loading branch information
rfratto committed Apr 10, 2024
1 parent 23e5170 commit d49e828
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ This document contains a historical list of changes between releases. Only
changes that impact end-user behavior are listed; changes to documentation or
internal API changes are not present.

Unreleased
----------

### Bugfixes

- Fix an issue on Windows where uninstalling Alloy did not remove it from the
Add/Remove programs list. (@rfratto)

v1.0.0 (2024-04-09)
-------------------

Expand Down
7 changes: 4 additions & 3 deletions packaging/windows/install_script.nsis
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,10 @@ Section "uninstall"
RMDir /r "$INSTDIR" # Install directory.
RMDir /r "$APPDATA\${APPNAME}" # Application data.

# Remove service and uninstaller information from the registry.
# Remove service and uninstaller information from the registry. Note that the
# service settings are stored in the 64-bit registry (so we use /reg:64),
# while the uninstaller information is stored in the 32-bit registry.
nsExec::ExecToLog 'Reg.exe delete "HKLM\SOFTWARE\GrafanaLabs\Alloy" /reg:64 /f'
Pop $0
nsExec::ExecToLog 'Reg.exe delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" /reg:64 /f'
Pop $0
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
SectionEnd

0 comments on commit d49e828

Please sign in to comment.