Skip to content

Commit

Permalink
Updates to download_ap.ps1 (#550)
Browse files Browse the repository at this point in the history
* Updates to download_ap.ps1

- adds support to run the AP download script on ARM based mac
- #549

* Update download_ap.ps1

Co-authored-by: Anthony Truskinger <[email protected]>
  • Loading branch information
andrew-1234 and atruskie authored Nov 1, 2022
1 parent e8e71c2 commit 97cda92
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion build/download_ap.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ $alias_path = PickForOS "${Destination}${dir_seperator}AP.exe" "${home}/.local/b
$binary_name = PickForOS "AnalysisPrograms.exe" "AnalysisPrograms" "AnalysisPrograms"
$ap_path = "$Destination$dir_seperator$binary_name"
$version_regex = '\d{2}\.\d{1,2}\.\d{1,2}\.\d{1,2}'
$zsh_exists = $(which zsh; $LASTEXITCODE -eq 0)

if ($Version) {

Expand Down Expand Up @@ -227,6 +228,9 @@ function Get-AssetUrl($prerelease ) {
{ $_ -eq "X64" -and $IsWindows } { "win-x64_v" }
#AP_osx-x64_v20.11.2.0.tar.xz
{ $_ -eq "X64" -and $IsMacOS } { "osx-x64_v" }
#AP_osx-x64_v20.11.2.0.tar.xz ARM mac supports virtualization
{ $_ -eq "Arm64" -and $IsMacOS } { "osx-x64_v" }

default { $null }
}

Expand Down Expand Up @@ -448,6 +452,9 @@ $actions = [ordered]@{
} )
"Check" = ("AP executable should have execute permission", {
if($IsWindows) { return $null }
if (Test-Path "/bin/test") {
return $(/bin/test -x $ap_path ; 0 -eq $LASTEXITCODE)
}
$(/usr/bin/test -x $ap_path ; 0 -eq $LASTEXITCODE)
} )
"Uninstall" = $null
Expand Down Expand Up @@ -499,6 +506,10 @@ $actions = [ordered]@{
if ($IsWindows) {
$new_path = [System.Environment]::GetEnvironmentVariable("Path","User") + $to_add
[System.Environment]::SetEnvironmentVariable("Path", $new_path, "User")
} if ($zsh_exists -eq $true){
# if zsh is installed, add path to both .zshrc and .profile
"PATH=`$PATH$to_add`n" | Out-File "$HOME/.zshrc" -Encoding utf8NoBOM -Append
"PATH=`$PATH$to_add`n" | Out-File "$HOME/.profile" -Encoding utf8NoBOM -Append
} else {
# bash syntax
"PATH=`$PATH$to_add`n" | Out-File "$HOME/.profile" -Encoding utf8NoBOM -Append
Expand Down Expand Up @@ -678,7 +689,6 @@ function Write-Metadata() {
}
}


switch -wildcard ($PsCmdlet.ParameterSetName) {
"Install-*" {
Invoke-APInstallTasks $actions "Install"
Expand Down

0 comments on commit 97cda92

Please sign in to comment.