diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-06 22:44:22 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-07 08:26:22 +0200 |
commit | baf30544c874a0d86901d93526e839ca947377b3 (patch) | |
tree | 71d0a5d673be863605bff25c444d029bb78784c8 /installer | |
parent | ringlogger: export R/O handle for UI process (diff) | |
download | wireguard-windows-baf30544c874a0d86901d93526e839ca947377b3.tar.xz wireguard-windows-baf30544c874a0d86901d93526e839ca947377b3.zip |
installer: delete config file with custom action
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'installer')
-rw-r--r-- | installer/customactions.js (renamed from installer/serviceevaluation.js) | 12 | ||||
-rw-r--r-- | installer/wireguard.wxs | 15 |
2 files changed, 20 insertions, 7 deletions
diff --git a/installer/serviceevaluation.js b/installer/customactions.js index 4a5b663e..9ca93ca5 100644 --- a/installer/serviceevaluation.js +++ b/installer/customactions.js @@ -9,7 +9,7 @@ var fso = new ActiveXObject("Scripting.FileSystemObject"); function logMessage(msg) { var record = Installer.CreateRecord(1); - record.StringData(0) = "WireGuard service evaluation: [1]"; + record.StringData(0) = "Custom action: [1]"; record.StringData(1) = msg.toString(); Session.Message(0x04000000, record); } @@ -34,7 +34,7 @@ function runWithNoWindowFlash(command) { txt = file.ReadAll(); file.Close(); } catch (e) { - logMessage("Unable to read temporary file " + tmpfile + " for command " + cmd + ": " + e.toString()); + logMessage("Unable to read temporary file " + tmpfile + " for command " + cmd + ": " + e.message); return ""; } return txt; @@ -87,3 +87,11 @@ function EvaluateWireGuardServices() { } } } + +function RemoveConfigFolder() { + try { + fso.DeleteFolder(fso.BuildPath(fso.GetSpecialFolder(1), "config\\systemprofile\\AppData\\Local\\WireGuard"), true); + } catch(e) { + logMessage("Failed to remove configuration on uninstall: " + e.message); + } +} diff --git a/installer/wireguard.wxs b/installer/wireguard.wxs index 986576d3..e92177c6 100644 --- a/installer/wireguard.wxs +++ b/installer/wireguard.wxs @@ -27,7 +27,7 @@ <MediaTemplate EmbedCab="yes" CompressionLevel="high"/> <Icon Id="wireguard.ico" SourceFile="..\ui\icon\wireguard.ico"/> - <Binary Id="serviceevaluation.js" SourceFile="serviceevaluation.js"/> + <Binary Id="customactions.js" SourceFile="customactions.js"/> <Property Id="ARPPRODUCTICON" Value="wireguard.ico"/> <Property Id="ARPURLINFOABOUT" Value="https://www.wireguard.com/"/> @@ -101,12 +101,20 @@ <!-- Evaluate WireGuard services and populate ServiceControl table --> - <CustomAction Id="EvaluateWireGuardServices" BinaryKey="serviceevaluation.js" JScriptCall="EvaluateWireGuardServices"/> + <CustomAction Id="EvaluateWireGuardServices" BinaryKey="customactions.js" JScriptCall="EvaluateWireGuardServices"/> <InstallExecuteSequence> <Custom Action="EvaluateWireGuardServices" After="FindRelatedProducts"/> </InstallExecuteSequence> <!-- + Clear out our config folder on uninstall + --> + <CustomAction Id="RemoveConfigFolder" BinaryKey="customactions.js" JScriptCall="RemoveConfigFolder" Execute="deferred" Impersonate="no"/> + <InstallExecuteSequence> + <Custom Action="RemoveConfigFolder" After="DeleteServices">(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom> + </InstallExecuteSequence> + + <!-- Launch wireguard.exe after setup complete --> <CustomAction Id="LaunchApplication" HideTarget="yes" Impersonate="no" Execute="deferred" FileKey="wireguard.exe" ExeCommand="" Return="asyncNoWait"/> @@ -114,8 +122,5 @@ <!-- TODO: this should not launch when msiexec is called with whatever flag means it shouldn't launch. --> <Custom Action="LaunchApplication" After="PublishProduct">NOT Installed</Custom> </InstallExecuteSequence> - - <!-- TODO: On uninstall remove system32\config\wireguard. --> - <!-- TODO: On install and uninstall, kill services. --> </Product> </Wix> |