Skip to content

Commit

Permalink
msi: remove the smb share created during installation
Browse files Browse the repository at this point in the history
adds a custom action to remove the smb share 'crc-dir0'
when crc is uinstalled
  • Loading branch information
anjannath committed Oct 12, 2022
1 parent 2aa7059 commit fff474a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packaging/windows/product.wxs.template
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@
Before="EnableFileAndPrinterSharing"
Sequence="execute"/>
<CustomAction Id="EnableFileAndPrinterSharing" BinaryKey="WixCA" DllEntry="WixQuietExec64" Execute="deferred" Impersonate="no" Return="check" />
<SetProperty Action="CARemoveSMBShare"
Id="RemoveSMBShare"
Value="&quot;[POWERSHELLEXE]&quot; -NonInteractive -ExecutionPolicy Bypass -NoProfile -Command &quot;Remove-SmbShare -Name '[SHAREDDIRNAME]' -Force&quot;"
Before="RemoveSMBShare"
Sequence="execute"/>
<CustomAction Id="RemoveSMBShare" BinaryKey="WixCA" DllEntry="WixQuietExec64" Execute="deferred" Impersonate="no" Return="ignore" />

<util:CloseApplication Id = "TrayRunning" Description="Please exit Red Hat OpenShift Local from tray and run the installation again." Target="crc-tray.exe" RebootPrompt="no" PromptToContinue="yes" />

Expand All @@ -131,6 +137,7 @@
<Custom Action="RemoveCrcDaemonTask" Before='RemoveFiles'>Installed AND NOT UPGRADINGPRODUCTCODE</Custom>
<Custom Action="EnableFileAndPrinterSharing" After="AddUserToHypervAdminGroup"> NOT Installed AND NOT REMOVE~="ALL" AND NOT WIX_UPGRADE_DETECTED</Custom>
<Custom Action="CreateSMBShare" After="EnableFileAndPrinterSharing"> NOT Installed AND NOT REMOVE~="ALL" AND NOT WIX_UPGRADE_DETECTED</Custom>
<Custom Action="RemoveSMBShare" After='RemoveCrcDaemonTask'>Installed AND NOT UPGRADINGPRODUCTCODE</Custom>
<ScheduleReboot After="InstallFinalize"> NOT Installed AND NOT REMOVE~="ALL" AND NOT WIX_UPGRADE_DETECTED</ScheduleReboot>
</InstallExecuteSequence>
<Feature Id="DefaultFeature" Level="1">
Expand All @@ -152,6 +159,7 @@
<ProgressText Action="AddUserToHypervAdminGroup">Adding user: [LogonUser] to Hyper-V Administrators group</ProgressText>
<ProgressText Action="RemoveCrcDaemonTask">Removing crcDaemon task</ProgressText>
<ProgressText Action="CreateSMBShare">Creating share named: [SHAREDDIRNAME] for folder: [USERFOLDER]</ProgressText>
<ProgressText Action="RemoveSMBShare">Removing share named: [SHAREDDIRNAME] for folder: [USERFOLDER]</ProgressText>
<ProgressText Action="EnableFileAndPrinterSharing">Enabling file and printer Sharing</ProgressText>
</UI>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
Expand Down

0 comments on commit fff474a

Please sign in to comment.