Skip to content

Commit

Permalink
Add support for deploying eBPF to arbitrary filesystem locations (mic…
Browse files Browse the repository at this point in the history
…rosoft#1995)

* add support for deploying ebpf to arbitrary filesystem locations

* fix typo

* add documentation

* fix coding style
  • Loading branch information
mtfriesen authored Feb 1, 2023
1 parent 27fee38 commit c556b4d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
4 changes: 4 additions & 0 deletions docs/InstallEbpf.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
21 changes: 13 additions & 8 deletions scripts/deploy-ebpf.ps1.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 "."
Expand All @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit c556b4d

Please sign in to comment.