mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 00:49:03 +00:00
This adds two things: - when implementing the CLI, I found [a panel](https://www.figma.com/file/oQl2oQUG0iRkUy0YOxc307/%2314921-Deploy-security-agents-to-macOS%2C-Windows%2C-and-Linux-hosts?type=design&node-id=779-29335&mode=design&t=Y27cbj7DdhUEGJko-4) in the Figma file with validations that I missed - explicit shebang for bash scrips (requested by product) and removed a comment that will be user facing for exe files.
16 lines
660 B
PowerShell
16 lines
660 B
PowerShell
$exeFilePath = "$INSTALLER_PATH"
|
|
|
|
# extract the name of the executable to use as the sub-directory name
|
|
$exeName = [System.IO.Path]::GetFileName($exeFilePath)
|
|
$subDir = [System.IO.Path]::GetFileNameWithoutExtension($exeFilePath)
|
|
|
|
$destinationPath = Join-Path -Path $env:ProgramFiles -ChildPath $subDir
|
|
|
|
# check if the directory does not exist, and create it if necessary
|
|
if (-not (Test-Path -Path $destinationPath)) {
|
|
New-Item -ItemType Directory -Path $destinationPath
|
|
}
|
|
|
|
# copy the .exe file to the new sub-directory
|
|
$destinationExePath = Join-Path -Path $destinationPath -ChildPath $exeName
|
|
Copy-Item -Path $exeFilePath -Destination $destinationExePath
|