From 3201389252d2c011bee15ace0c9f4cdbcb978f9f Mon Sep 17 00:00:00 2001 From: Robert Fratto Date: Wed, 17 Apr 2024 17:16:23 -0400 Subject: [PATCH] packaging: properly unregister Alloy when uninstalling on Windows (#166) 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 grafana/alloy#165. As a temporary workaround to this bug, users should delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Alloy from the 32-bit registry. Co-authored-by: Paschalis Tsilias --- CHANGELOG.md | 6 +++++- packaging/windows/install_script.nsis | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13ff316031..1b7c5de0b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,11 @@ Main (unreleased) ### Bugfixes -- Fixed issue with defaults for Beyla component not being applied correctly. (marctc) +- Fixed issue with defaults for Beyla component not being applied correctly. (marctc) + +- 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) ------------------- diff --git a/packaging/windows/install_script.nsis b/packaging/windows/install_script.nsis index 9361f3c09a..b51ff8c8d3 100644 --- a/packaging/windows/install_script.nsis +++ b/packaging/windows/install_script.nsis @@ -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