diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ec5dfd..1e9aa1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ All notable changes to this project will be documented in this file. +## Release 1.1.3 (2025-01-07) + +[Full Changelog](https://github.com/webalexeu/winbgp/compare/v1.1.2...v1.1.3) + +**Features** + +- Add service start if feature is installed and routing enabled + +**Bugfixes** + +- [API restart cause failure of the engine](https://github.com/webalexeu/winbgp/issues/1) + ## Release 1.1.2 (2025-01-06) [Full Changelog](https://github.com/webalexeu/winbgp/compare/v1.1.1...v1.1.2) @@ -13,10 +25,10 @@ All notable changes to this project will be documented in this file. **Bugfixes** -- [API restart cause failure of the engine](https://github.com/webalexeu/winbgp/issues/1) - **Known Issues** +- API restart cause failure of the engine + ## Release 1.1.1 (2024-12-30) [Full Changelog](https://github.com/webalexeu/winbgp/compare/v1.1.0...v1.1.1) @@ -29,9 +41,6 @@ All notable changes to this project will be documented in this file. **Known Issues** -- API restart cause failure of the engine - - ## Release 1.1.0 (2024-12-20) **Features** diff --git a/builder/build.ps1 b/builder/build.ps1 index ec896fd..30411ba 100644 --- a/builder/build.ps1 +++ b/builder/build.ps1 @@ -38,6 +38,9 @@ Invoke-Expression "wix build -arch $wixArch -o .\WinBGP-$($Version)-$($Arch).msi Write-Verbose "Done!" Pop-Location +# Clean temporary build folder +Remove-Item -Path "..\engine\*" + Copy-Item -Path "WinBGP-$($Version)-$($Arch).msi" -Destination "..\release" -Force if ($Sign) { & "C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\signtool.exe" sign /sha1 $CertificateThumbprint /tr http://time.certum.pl/ /td sha256 /fd sha256 /v "..\release\WinBGP-$($Version)-$($Arch).msi" diff --git a/builder/files.wxs b/builder/files.wxs index dc4ee6e..4aeca66 100644 --- a/builder/files.wxs +++ b/builder/files.wxs @@ -20,7 +20,7 @@ diff --git a/builder/main.wxs b/builder/main.wxs index 865e4f3..8baf826 100644 --- a/builder/main.wxs +++ b/builder/main.wxs @@ -74,6 +74,14 @@ ExeCommand="powershell.exe -ExecutionPolicy Bypass -Command "if ((Get-RemoteAccess).RoutingStatus -ne 'Installed') { Write-Host 'Enabling routing (WinBGP prerequisite)'; Install-RemoteAccess -VpnType RoutingOnly }"" Return="check" /> + + - - + + + diff --git a/src/WinBGP-Engine.ps1 b/src/WinBGP-Engine.ps1 index 038fc3d..103f304 100644 --- a/src/WinBGP-Engine.ps1 +++ b/src/WinBGP-Engine.ps1 @@ -54,7 +54,7 @@ Param( ) # Don't forget to increment version when updating engine -$scriptVersion = '1.1.0' +$scriptVersion = '1.1.1' # This script name, with various levels of details @@ -67,7 +67,8 @@ $scriptFullName = $argv0.fullname # Ex: C:\Temp\PSService.ps1 $serviceName = "WinBGP" # A one-word name used for net start commands $serviceDisplayName = "WinBGP" # To improve (Service name should be rationalized) -$serviceInternalName = "WinBGP-Service" +$serviceInternalName = "$($serviceName)-Service" +$engineName = "$($serviceName)-Engine" $ServiceDescription = "The BGP swiss army knife of networking on Windows" $pipeName = "Service_$serviceName" # Named pipe name. Used for sending messages to the service task $installDir = "${ENV:ProgramW6432}\$serviceDisplayName" # Where to install the service files @@ -986,12 +987,14 @@ function Stop-API() { $ProcessID=$null $ApiPID=$null # Get service PID - $ProcessID=(Get-CimInstance Win32_Process -Filter "name = 'powershell.exe'" -OperationTimeoutSec 1 | Where-Object {$_.CommandLine -like "*'$installDir\$serviceInternalName.ps1' -Service*"}).ProcessId + $ProcessID=(Get-CimInstance Win32_Process -Filter "name = 'powershell.exe'" -OperationTimeoutSec 1 | Where-Object {$_.CommandLine -like "*'$installDir\$engineName.ps1' -Service*"}).ProcessId if ($ProcessID) { # Get API PID $ApiPID=(Get-WmiObject win32_process -filter "Name='powershell.exe' AND ParentProcessId=$ProcessID").ProcessId + if ($ApiPID) { + Stop-Process -Id $ApiPID -Force -ErrorAction SilentlyContinue + } } - Stop-Process -Id $ApiPID -Force -ErrorAction SilentlyContinue Stop-Job -Name 'API' -ErrorAction SilentlyContinue Remove-Job -Name 'API' -Force -ErrorAction SilentlyContinue }