Merge pull request #3 from webalexeu/fix/engine_name

Fix process name
This commit is contained in:
Alexandre JARDON
2025-01-07 21:14:13 +01:00
committed by GitHub
5 changed files with 38 additions and 14 deletions

View File

@@ -2,6 +2,18 @@
All notable changes to this project will be documented in this file. 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) ## Release 1.1.2 (2025-01-06)
[Full Changelog](https://github.com/webalexeu/winbgp/compare/v1.1.1...v1.1.2) [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** **Bugfixes**
- [API restart cause failure of the engine](https://github.com/webalexeu/winbgp/issues/1)
**Known Issues** **Known Issues**
- API restart cause failure of the engine
## Release 1.1.1 (2024-12-30) ## Release 1.1.1 (2024-12-30)
[Full Changelog](https://github.com/webalexeu/winbgp/compare/v1.1.0...v1.1.1) [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** **Known Issues**
- API restart cause failure of the engine
## Release 1.1.0 (2024-12-20) ## Release 1.1.0 (2024-12-20)
**Features** **Features**

View File

@@ -38,6 +38,9 @@ Invoke-Expression "wix build -arch $wixArch -o .\WinBGP-$($Version)-$($Arch).msi
Write-Verbose "Done!" Write-Verbose "Done!"
Pop-Location Pop-Location
# Clean temporary build folder
Remove-Item -Path "..\engine\*"
Copy-Item -Path "WinBGP-$($Version)-$($Arch).msi" -Destination "..\release" -Force Copy-Item -Path "WinBGP-$($Version)-$($Arch).msi" -Destination "..\release" -Force
if ($Sign) { 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" & "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"

View File

@@ -20,7 +20,7 @@
<Component Transitive="yes"> <Component Transitive="yes">
<File Id="winbgp_service" Source="..\service\WinBGP-Service.exe" KeyPath="yes" Vital="yes" Checksum="yes" /> <File Id="winbgp_service" Source="..\service\WinBGP-Service.exe" KeyPath="yes" Vital="yes" Checksum="yes" />
<ServiceInstall <ServiceInstall
Id="InstallExporterService" Id="InstallWinBGPService"
Name="WinBGP" Name="WinBGP"
DisplayName="WinBGP Engine" DisplayName="WinBGP Engine"
Description="The BGP swiss army knife of networking on Windows" Description="The BGP swiss army knife of networking on Windows"
@@ -39,10 +39,10 @@
<ServiceDependency Id="RemoteAccess" /> <ServiceDependency Id="RemoteAccess" />
</ServiceInstall> </ServiceInstall>
<ServiceControl <ServiceControl
Id="MyServiceControl" Id="WinBGPServiceControl"
Name="WinBGP" Name="WinBGP"
Remove="both"
Stop="both" Stop="both"
Remove="both"
Wait="yes" /> Wait="yes" />
</Component> </Component>
</DirectoryRef> </DirectoryRef>

View File

@@ -75,6 +75,14 @@
Return="check" Return="check"
/> />
<CustomAction Id="ServiceStart"
Execute="immediate"
Impersonate="no"
Directory="TARGETDIR"
ExeCommand="powershell.exe -ExecutionPolicy Bypass -Command &quot;if ((Get-RemoteAccess).RoutingStatus -eq 'Installed') { Write-Host 'Starting WinBGP service'; Start-Service -Name WinBGP -ErrorAction SilentlyContinue }&quot;"
Return="ignore"
/>
<CustomAction Id="RemoveConfig" <CustomAction Id="RemoveConfig"
Execute="deferred" Execute="deferred"
Impersonate="no" Impersonate="no"
@@ -90,8 +98,9 @@
<Custom Action="GenerateConfig" After="InstallFiles" Condition="NOT Installed AND NOT WIX_UPGRADE_DETECTED AND NOT WIX_DOWNGRADE_DETECTED" /> <Custom Action="GenerateConfig" After="InstallFiles" Condition="NOT Installed AND NOT WIX_UPGRADE_DETECTED AND NOT WIX_DOWNGRADE_DETECTED" />
<Custom Action="EnableWindowsFeature" After="InstallFiles" Condition="&amp;Features=3 AND NOT Installed AND (MsiNTProductType=2 OR MsiNTProductType=3)" /> <Custom Action="EnableWindowsFeature" After="InstallFiles" Condition="&amp;Features=3 AND NOT Installed AND (MsiNTProductType=2 OR MsiNTProductType=3)" />
<Custom Action="EnableWindowsFeatureRSAT" After="EnableWindowsFeature" Condition="&amp;Features=3 AND NOT Installed AND (MsiNTProductType=2 OR MsiNTProductType=3)" /> <Custom Action="EnableWindowsFeatureRSAT" After="EnableWindowsFeature" Condition="&amp;Features=3 AND NOT Installed AND (MsiNTProductType=2 OR MsiNTProductType=3)" />
<Custom Action="EnableRouting" After="EnableWindowsFeatureRSAT" Condition="&amp;Features=3 AND NOT Installed AND (MsiNTProductType=2 OR MsiNTProductType=3)" /> <!-- TO CHECK to use Condition="MAINTENANCE" for upgrade --> <Custom Action="EnableRouting" After="EnableWindowsFeatureRSAT" Condition="&amp;Features=3 AND NOT Installed AND (MsiNTProductType=2 OR MsiNTProductType=3)" />
<ScheduleReboot After="InstallFinalize" Condition="&amp;Features=3 AND NOT Installed AND (MsiNTProductType=2 OR MsiNTProductType=3)" /> <!-- TO CHECK <Condition>REBOOT_REQUIRED</Condition> --> <Custom Action="ServiceStart" After="InstallFinalize" Condition='NOT REMOVE="ALL" AND (MsiNTProductType=2 OR MsiNTProductType=3)' />
<ScheduleReboot After="InstallFinalize" Condition="&amp;Features=3 AND NOT Installed AND NOT (WIX_UPGRADE_DETECTED OR UPGRADINGPRODUCTCODE) AND (MsiNTProductType=2 OR MsiNTProductType=3)" /> <!-- TO CHECK <Condition>REBOOT_REQUIRED</Condition> -->
<Custom Action='RemoveConfig' Before='RemoveFiles' Condition='Installed AND (REMOVE="ALL") AND NOT (WIX_UPGRADE_DETECTED OR UPGRADINGPRODUCTCODE)' /> <Custom Action='RemoveConfig' Before='RemoveFiles' Condition='Installed AND (REMOVE="ALL") AND NOT (WIX_UPGRADE_DETECTED OR UPGRADINGPRODUCTCODE)' />
</InstallExecuteSequence> </InstallExecuteSequence>

View File

@@ -54,7 +54,7 @@ Param(
) )
# Don't forget to increment version when updating engine # 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 # 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 $serviceName = "WinBGP" # A one-word name used for net start commands
$serviceDisplayName = "WinBGP" $serviceDisplayName = "WinBGP"
# To improve (Service name should be rationalized) # 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" $ServiceDescription = "The BGP swiss army knife of networking on Windows"
$pipeName = "Service_$serviceName" # Named pipe name. Used for sending messages to the service task $pipeName = "Service_$serviceName" # Named pipe name. Used for sending messages to the service task
$installDir = "${ENV:ProgramW6432}\$serviceDisplayName" # Where to install the service files $installDir = "${ENV:ProgramW6432}\$serviceDisplayName" # Where to install the service files
@@ -986,12 +987,14 @@ function Stop-API() {
$ProcessID=$null $ProcessID=$null
$ApiPID=$null $ApiPID=$null
# Get service PID # 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) { if ($ProcessID) {
# Get API PID # Get API PID
$ApiPID=(Get-WmiObject win32_process -filter "Name='powershell.exe' AND ParentProcessId=$ProcessID").ProcessId $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 Stop-Job -Name 'API' -ErrorAction SilentlyContinue
Remove-Job -Name 'API' -Force -ErrorAction SilentlyContinue Remove-Job -Name 'API' -Force -ErrorAction SilentlyContinue
} }