From 1a90f8b7b37e6d5b7853f79f2a49d074b273b6e5 Mon Sep 17 00:00:00 2001 From: Lauri Nevala Date: Wed, 16 Sep 2020 14:41:56 +0300 Subject: [PATCH] Fix windows installer when app directory removed manually Signed-off-by: Lauri Nevala --- build/installer.nsh | 12 ++++++++++++ package.json | 3 +++ 2 files changed, 15 insertions(+) create mode 100644 build/installer.nsh diff --git a/build/installer.nsh b/build/installer.nsh new file mode 100644 index 0000000000..8ff35b5e4f --- /dev/null +++ b/build/installer.nsh @@ -0,0 +1,12 @@ +!macro customInit + ; Workaround for installer handing when the app directory is removed manually + ${ifNot} ${FileExists} "$INSTDIR" + DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\{${UNINSTALL_APP_KEY}}" + ${EndIf} + + ; Workaround for the old-format uninstall registry key (some people report it causes hangups, too) + ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL_APP_KEY}" "QuietUninstallString" + StrCmp $0 "" proceed 0 + DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL_APP_KEY}" + proceed: +!macroend \ No newline at end of file diff --git a/package.json b/package.json index e1b1d07a12..a03242fd77 100644 --- a/package.json +++ b/package.json @@ -128,6 +128,9 @@ "target": [ "nsis" ], + "nsis": { + "include": "build/installer.nsh" + }, "extraResources": [ { "from": "binaries/client/windows/x64/kubectl.exe",