diff --git a/.github/workflows/standalone-installers.yaml b/.github/workflows/standalone-installers.yaml index e1114fd3..a522677c 100644 --- a/.github/workflows/standalone-installers.yaml +++ b/.github/workflows/standalone-installers.yaml @@ -39,6 +39,7 @@ jobs: - ubuntu-22.04 - macos-11 - macos-12 + - macos-14 # (aarch64) - windows-2019 - windows-2022 diff --git a/bin/standalone-installer-unix b/bin/standalone-installer-unix index 155d8cc9..e5fa9749 100755 --- a/bin/standalone-installer-unix +++ b/bin/standalone-installer-unix @@ -20,17 +20,17 @@ shopt -s failglob # Globals declared here to make them more obvious, but set by main() to avoid # source ordering requirements and delay execution until the full file is # parsed. -declare KERNEL TARGET DESTINATION VERSION +declare VERSION KERNEL TARGET DESTINATION # Wrap everything in a function which we call at the end to avoid execution of # a partially-downloaded program. main() { + VERSION="${1:-${VERSION:-latest}}" + KERNEL="${KERNEL:-$(uname -s)}" TARGET="${TARGET:-$(target-triple)}" DESTINATION="${DESTINATION:-${NEXTSTRAIN_HOME:-$HOME/.nextstrain}/cli-standalone}" - VERSION="${1:-${VERSION:-latest}}" - local archive archive_url tmp archive="standalone-${TARGET}.tar.gz" @@ -115,9 +115,23 @@ target-triple() { ;; Darwin) - [[ "$machine" == x86_64 || "$machine" == arm64 ]] || die "unsupported architecture: $machine" - [[ "$machine" != arm64 ]] || pgrep -qU _oahd 2>/dev/null || die "Rosetta 2 not enabled. Please run:"$'\n\n'" softwareupdate --install-rosetta"$'\n\n'"and then retry this installation of Nextstrain CLI." - machine=x86_64 + # Rosetta 2 will not be needed for the standalone version of + # Nextstrain CLI itself as of 8.2.0. The Conda runtime still + # requires it and the Docker runtime can benefit from it, but we + # now check for it in their setup instead. + # -trs, 1 Feb 2024 + version-gte 8.2.0 \ + || [[ "$machine" != arm64 ]] \ + || pgrep -qU _oahd 2>/dev/null \ + || die "Rosetta 2 not enabled. Please run:"$'\n\n'" softwareupdate --install-rosetta"$'\n\n'"and then retry this installation of Nextstrain CLI." + + # aarch64 builds will only be available starting with 8.2.0. Older + # versions only provide x86_64, which will run under Rosetta. + case "$machine" in + x86_64) ;; + arm64) version-gte 8.2.0 && machine=aarch64 || machine=x86_64;; + *) die "unsupported architecture: $machine";; + esac vendor=apple os=darwin ;; @@ -129,6 +143,16 @@ target-triple() { echo "$machine-$vendor-$os" } +version-gte() { + local minimum="$1" + + # If $minimum sorts before $VERSION, then $VERSION is at least ≥$minimum. + # Note that non-numeric values sort by byte order, so "latest" and + # "pr-build/123" and so on end up after (greater than) a numeric value like + # 8.1.0. Both macOS/BSD sort and GNU sort support -V. + [[ $(printf '%s\n%s\n' "$minimum" "$VERSION" | sort -V | head -n1) == "$minimum" ]] +} + default-shell() { local shell