Add support for deploying eBPF to arbitrary filesystem locations (#1995)

* add support for deploying ebpf to arbitrary filesystem locations

* fix typo

* add documentation

* fix coding style
This commit is contained in:
Michael Friesen 2023-02-01 18:13:25 -05:00 коммит произвёл GitHub
Родитель 27fee383cd
Коммит c556b4dfae
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 17 добавлений и 8 удалений

Просмотреть файл

@ -71,6 +71,10 @@ has already built the binaries for `x64/Debug` or `x64/Release`.
```ps
.\x64\debug\deploy-ebpf --vm="<test-vm-name>" -t
```
or, to copy files to a specific directory, including file shares, run:
```ps
.\x64\debug\deploy-ebpf -l="c:\some\path"
```
2. From within the VM, install the binaries by starting an administrator Command Prompt shell (cmd.exe)
, and running the following commands:

Просмотреть файл

@ -179,7 +179,7 @@ OVERVIEW:
Copies eBPF framework files into a temp directory on the local machine or into a VM
$ deploy-ebpf [--dir="..."] [-h] [-l] [-m] [-t] [--vm="..."]
$ deploy-ebpf [--dir="..."] [-h] [-l[=path]] [-m] [-t] [--vm="..."]
OPTIONS:
--dir Specifies the source directory path, which defaults to "."
@ -202,8 +202,11 @@ OPTIONS:
$vm=($arg -split "=")[1];
break
}
{ @("-l", "--local") -contains $_ }
"^(?:-l|--list)(?:=(.+))?$"
{
if ($matches[1]) {
$destination_directory = $matches[1]
}
Clear-Variable -name vm
break
}
@ -234,22 +237,24 @@ if ($vm -eq $null) {
foreach ( $file in $built_files ) {
$source_path = "$build_directory\$file"
$destination_path = "$destination_directory\$file"
$destination_full_directory = Split-Path $destination_path
Write-Host " $source_path -> $destination_path"
Copy-Item "$source_path" -Destination "$destination_path"
if (! $?) {
exit 1
if (! (Test-Path $destination_full_directory)) {
New-Item -Type Directory $destination_full_directory -ErrorAction Stop | Write-Verbose
}
Copy-Item "$source_path" -Destination "$destination_path" -ErrorAction Stop
}
Write-Host "Copying files from `"$source_directory`" to `"$destination_directory`""
foreach ( $file in $source_files ) {
$source_path = "$source_directory\$file"
$destination_path = "$destination_directory\$file"
$destination_full_directory = Split-Path $destination_path
Write-Host " $source_path -> $destination_path"
Copy-Item "$source_path" -Destination "$destination_path"
if (! $?) {
exit 1
if (! (Test-Path $destination_full_directory)) {
New-Item -Type Directory $destination_full_directory -ErrorAction Stop | Write-Verbose
}
Copy-Item "$source_path" -Destination "$destination_path" -ErrorAction Stop
}
exit 0
}