Skip to content

Commit

Permalink
fix: Keep manager.yaml on uninstall (#1911)
Browse files Browse the repository at this point in the history
* Don't remove manager.yaml on uninstall.

* add CLEAN option for doing a clean manager install

* Try permissionEx instead

* move manager exists check after default installdir checked

* pass clean to install script

* remove managerexists & clean settings

* temp remove component ref

* try re-enable product folder ACLs

* revert change to PermissionEx
  • Loading branch information
BinaryFissionGames authored Oct 14, 2024
1 parent e9fe792 commit 453e148
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
7 changes: 7 additions & 0 deletions windows/install/generate-manager-yaml.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ set "install_dir=%~1"
set "endpoint=%~2"
set "secret_key=%~3"
set "labels=%~4"
set "clean=%~5"

echo %install_dir%
echo %endpoint%
echo %secret_key%
echo %labels%
echo %clean%

if "%endpoint%"=="" (
echo Endpoint not specified; Not writing output yaml
Expand All @@ -18,6 +20,11 @@ if "%endpoint%"=="" (

set "managerfile=%install_dir%manager.yaml"

if exist "%managerfile%" if "%clean%"=="" (
echo Manager.yaml already exists; Not writing output yaml
exit /b 0
)

echo Writing manager yaml
set "endpointField=endpoint: "%endpoint%""
set "secretField=secret_key: "%secret_key%""
Expand Down
17 changes: 1 addition & 16 deletions windows/templates/product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -203,18 +203,11 @@

<CustomAction Id="CustomExecCreateManagerYaml_set"
Property="CustomExecCreateManagerYaml"
Value="&quot;[CMDEXE]&quot; /C CALL &quot;[INSTALLDIR]install\generate-manager-yaml.bat&quot; &quot;[INSTALLDIR]&quot; &quot;[OPAMPENDPOINT]&quot; &quot;[OPAMPSECRETKEY]&quot; &quot;[OPAMPLABELS]&quot;"
Value="&quot;[CMDEXE]&quot; /C CALL &quot;[INSTALLDIR]install\generate-manager-yaml.bat&quot; &quot;[INSTALLDIR]&quot; &quot;[OPAMPENDPOINT]&quot; &quot;[OPAMPSECRETKEY]&quot; &quot;[OPAMPLABELS]&quot; &quot;[CLEAN]&quot;"
Execute="immediate"/>

<CustomAction Id="CustomExecCreateManagerYaml" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Impersonate="no" Return="check" />

<CustomAction Id="CustomExecRemoveManagerYaml_set"
Property="CustomExecRemoveManagerYaml"
Value="&quot;[CMDEXE]&quot; /C del &quot;[INSTALLDIR]manager.yaml&quot;"
Execute="immediate"/>

<CustomAction Id="CustomExecRemoveManagerYaml" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Impersonate="no" Return="ignore" />

<InstallExecuteSequence>
{{range $i, $h := .Hooks}}
<Custom Action="CustomExec{{$i}}" {{if eq $h.When "install"}} After="InstallFiles" {{else if eq $h.Execute "immediate"}} Before="InstallValidate" {{else}} After="InstallInitialize" {{end}}>
Expand All @@ -239,14 +232,6 @@
<Custom Action="CustomExecCreateManagerYaml" After="InstallFiles" >
<![CDATA[(VersionNT >= 603 OR VersionNT64 >= 603) AND NOT Installed AND NOT REMOVE AND ENABLEMANAGEMENT AND NOT WIX_UPGRADE_DETECTED]]>
</Custom>

<!-- Schedule the action that removes the manager.yaml file on final uninstall -->
<Custom Action="CustomExecRemoveManagerYaml_set" After="InstallInitialize" >
<![CDATA[(VersionNT >= 603 OR VersionNT64 >= 603) and REMOVE="ALL" and not UPGRADINGPRODUCTCODE]]>
</Custom>
<Custom Action="CustomExecRemoveManagerYaml" Before="RemoveFiles" >
<![CDATA[(VersionNT >= 603 OR VersionNT64 >= 603) and REMOVE="ALL" and not UPGRADINGPRODUCTCODE]]>
</Custom>
</InstallExecuteSequence>

<Feature Id="DefaultFeature" Level="1">
Expand Down

0 comments on commit 453e148

Please sign in to comment.