mirror of
https://github.com/fleetdm/fleet
synced 2026-05-12 19:48:45 +00:00
for #19039 and #19041 this: - fixes the install/remove scripts to read the env variable the proper way - truncates output before storing in the databse in case its longer than MySQL's TEXT size # Checklist for submitter If some of the following don't apply, delete the relevant line. <!-- Note that API documentation changes are now addressed by the product design team. --> - [x] Added/updated tests - [x] Manual QA for all new/changed functionality
16 lines
666 B
PowerShell
16 lines
666 B
PowerShell
$exeFilePath = "${env: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
|