Skip to content

Commit

Permalink
Installer: Allow upgrade with gsudo.exe in use. Uninstall with file i…
Browse files Browse the repository at this point in the history
…n use will also work, and remove from path, but will fail to delete the file in use.
  • Loading branch information
gerardog committed Nov 11, 2022
1 parent c3144b1 commit bce6013
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/gsudo.Installer/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,11 @@
<Product Id="*" Name="gsudo v$(env.version)" Language="1033" Version="$(env.version_MajorMinorPatch)"
UpgradeCode="567b5616-d362-484e-b6ff-7c1875cf0aee" Manufacturer="gerardog">



<Package InstallerVersion="200"
Compressed="yes"
InstallScope="perMachine"
Manufacturer="Gerardo Grignoli"
Description="gsudo is a sudo-equivalent for windows" />

<Property Id="REBOOT" Value="ReallySuppress" />
<Property Id="MSIRESTARTMANAGERCONTROL" Value="Disable" />

<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
Expand Down Expand Up @@ -43,10 +38,13 @@
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />

<InstallExecuteSequence>
<!-- https://stackoverflow.com/a/17608049/97471 -->
<Custom Action="CreateSudoExeLink" Before="InstallFinalize">NOT Installed</Custom>
<Custom Action="RemoveSudoExeLink" After="InstallInitialize">Installed AND NOT REINSTALL</Custom>
<Custom Action="CreateSudoCurrentFolderLink" Before="InstallFinalize">NOT Installed</Custom>
<Custom Action="RemoveSudoCurrentFolderLink" After="InstallInitialize">Installed AND NOT REINSTALL</Custom>

<Custom Action="RemoveInstallFolder" After="InstallInitialize">REMOVE AND NOT UPGRADINGPRODUCTCODE</Custom>
</InstallExecuteSequence>

</Product>
Expand All @@ -73,14 +71,14 @@
Value="[INSTALLFOLDER]Current" />
</Component>

<Component Id="GSudoExe" Guid="bec137e1-06e2-4efb-aea9-30306cc01c87">
<Component Id="GSudoExe" Guid="">
<Condition>
<![CDATA[VersionNT64]]>
</Condition>
<File Id="GSudoExe" KeyPath="yes" Name="gsudo.exe" Source="..\..\artifacts\x64\gsudo.exe"/>
</Component>

<Component Id="GSudoExeX86" Guid="bec137e1-06e2-4efb-aea9-30306cc01c86">
<Component Id="GSudoExeX86" Guid="">
<Condition>
<![CDATA[NOT(VersionNT64)]]>
</Condition>
Expand Down Expand Up @@ -129,6 +127,12 @@
Execute="deferred"
Return="ignore"
Impersonate="no" />
<CustomAction Id="RemoveInstallFolder"
Directory="INSTALLFOLDER"
ExeCommand='cmd /c RD /S /Q "[INSTALLFOLDER]"'
Execute="deferred"
Return="ignore"
Impersonate="no" />
</Fragment>

</Wix>

0 comments on commit bce6013

Please sign in to comment.