Skip to content

Commit

Permalink
Uninstaller now removes winfsp (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfantinhardesty authored Aug 27, 2024
1 parent 6163966 commit 52e05a3
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 5 deletions.
25 changes: 24 additions & 1 deletion build/windows_installer_build.iss
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ begin
if CurStep = ssPostInstall then
begin
// Install WinFSP if it is not already installed
if not RegKeyExists(HKLM, 'SOFTWARE\WOW6432Node\WinFsp\Services') then
if not RegValueExists(HKLM, 'SOFTWARE\WOW6432Node\WinFsp\Services', 'InstallDir') then
begin
if SuppressibleMsgBox('WinFSP is required for Cloudfuse. Do you want to install it now?', mbConfirmation, MB_YESNO, IDYES) = IDYES then
begin
Expand All @@ -123,3 +123,26 @@ begin
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
ResultCode: Integer;
begin
if CurUninstallStep = usUninstall then
begin
// Install the Cloudfuse Startup Tool
if not Exec(ExpandConstant('{app}\{#MyAppExeCLIName}'), 'service uninstall', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
begin
SuppressibleMsgBox('Failed to remove cloudfuse as a service.', mbError, MB_OK, IDOK);
end;
// Ask the user if they would like to also uninstall WinFSP
if SuppressibleMsgBox('Do you want to uninstall WinFSP?', mbConfirmation, MB_YESNO, IDYES) = IDYES then
begin
if not Exec('msiexec.exe', '/qn /x "' + ExpandConstant('{app}\{#WinFSPInstaller}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
begin
SuppressibleMsgBox('Failed to run the WinFSP uninstaller. You might need to uninstall it manually.', mbError, MB_OK, IDOK);
end;
end;
end;
end;
31 changes: 27 additions & 4 deletions build/windows_installer_build_no_gui.iss
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ begin
if CurStep = ssPostInstall then
begin
// Install WinFSP if it is not already installed
if not RegKeyExists(HKLM, 'SOFTWARE\WOW6432Node\WinFsp\Services') then
if not RegValueExists(HKLM, 'SOFTWARE\WOW6432Node\WinFsp\Services', 'InstallDir') then
begin
if SuppressibleMsgBox('WinFSP is required for Cloudfuse. Do you want to install it now?', mbConfirmation, MB_YESNO, IDYES) = IDYES then
begin
Expand All @@ -101,10 +101,33 @@ begin
end;
end;
// Install the Cloudfuse Startup Tool
if not Exec(ExpandConstant('{app}\{#MyAppExeCLIName}'), 'service install', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
// Add Cloudfuse registry
if not Exec(ExpandConstant('{app}\{#MyAppExeCLIName}'), 'service add-registry', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
begin
SuppressibleMsgBox('Failed to install cloudfuse as a service. You may need to do this manually from the command line.', mbError, MB_OK, IDOK);
SuppressibleMsgBox('Failed to add cloudfuse registry. This will prevent cloudfuse from starting.', mbError, MB_OK, IDOK);
end;
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
ResultCode: Integer;
begin
if CurUninstallStep = usUninstall then
begin
// Remove Cloudfuse registry
if not Exec(ExpandConstant('{app}\{#MyAppExeCLIName}'), 'service remove-registry', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
begin
SuppressibleMsgBox('Failed to remove cloudfuse registry.', mbError, MB_OK, IDOK);
end;
// Ask the user if they would like to also uninstall WinFSP
if SuppressibleMsgBox('Do you want to uninstall WinFSP?', mbConfirmation, MB_YESNO, IDYES) = IDYES then
begin
if not Exec('msiexec.exe', '/qn /x "' + ExpandConstant('{app}\{#WinFSPInstaller}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
begin
SuppressibleMsgBox('Failed to run the WinFSP uninstaller. You might need to uninstall it manually.', mbError, MB_OK, IDOK);
end;
end;
end;
end;
Expand Down

0 comments on commit 52e05a3

Please sign in to comment.