feat: add optional Windows virtual USB ADB device
This commit is contained in:
1 parent
2abfb63da9
commit
08d60de364
23 files changed
+802
-26
No files matched your search
@@ -0,0 +1,21 @@
|
||||
param([switch]$Install)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
if (-not $IsWindows) { throw 'Windows only; run using PowerShell 7' }
|
||||
if ([Runtime.InteropServices.RuntimeInformation]::OSArchitecture -ne 'X64') { throw 'This pinned installer supports Windows x64 only' }
|
||||
$projectRoot = Split-Path $PSScriptRoot -Parent
|
||||
$installer = Join-Path $projectRoot 'work/USBip-0.9.8.1-x64.exe'
|
||||
$expectedHash = '38CAD6D4432B52D5BB9409D9AD03B72FDFFC4ADA4CD3A48FBECA1A2752A8518A'
|
||||
New-Item -ItemType Directory -Force -Path (Split-Path $installer -Parent) | Out-Null
|
||||
if (-not (Test-Path -LiteralPath $installer)) {
|
||||
Invoke-WebRequest 'https://github.com/vadimgrn/usbip-win2/releases/download/v.0.9.8.1/USBip-0.9.8.1-x64.exe' -OutFile $installer
|
||||
}
|
||||
if ((Get-FileHash -LiteralPath $installer -Algorithm SHA256).Hash -ne $expectedHash) { throw 'Installer SHA256 mismatch' }
|
||||
$signature = Get-AuthenticodeSignature -LiteralPath $installer
|
||||
if ($signature.Status -ne 'Valid' -or $signature.SignerCertificate.Thumbprint -ne '9AC56B6C76141395D74FFF6652818376E80B9C95') { throw 'Unexpected installer signature' }
|
||||
Write-Output "Verified upstream USBip 0.9.8.1 installer: $installer"
|
||||
if ($Install) {
|
||||
# Interactive installation retains user control. Never change test signing or Secure Boot.
|
||||
$process = Start-Process -FilePath $installer -ArgumentList '/NORESTART' -Verb RunAs -PassThru -Wait
|
||||
if ($process.ExitCode -notin @(0,3010)) { throw "USBip installer exited with code $($process.ExitCode)" }
|
||||
if ($process.ExitCode -eq 3010) { Write-Output 'Reboot required; no reboot was started.' }
|
||||
}
|
||||
Reference in new issue
Block a user