diff options
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> |