Files
okxlinandSisyphus 387d93d4d1 fix(opencode-workstation): don't skip avx2 detection when OMO_PACKAGE is set
When OMO_PACKAGE is explicitly set (e.g. via compose .env), the resolver was short-circuiting and outputting baseline=0, bypassing AVX2 detection. This meant Bun was never reinstalled as baseline and kept SIGILLing. Now the resolver always computes the baseline flag and only uses OMO_PACKAGE as the package name override.

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-06-06 23:47:59 +08:00

43 lines
919 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
: "${OMO_PACKAGE:=}"
: "${OMO_FORCE_BASELINE:=auto}"
normalize_bool() {
case "${1,,}" in
1|yes|true|on) printf 'yes' ;;
0|no|false|off) printf 'no' ;;
*) printf '%s' "$1" ;;
esac
}
has_avx2() {
[[ -r /proc/cpuinfo ]] && grep -qiE '(^|[[:space:]])avx2($|[[:space:]])' /proc/cpuinfo
}
# Honour explicit OMO_PACKAGE but still detect AVX2 for the baseline flag.
targeted_package='oh-my-opencode'
if [[ -n "${OMO_PACKAGE}" ]]; then
targeted_package="${OMO_PACKAGE}"
fi
arch="$(uname -m)"
force_baseline="$(normalize_bool "${OMO_FORCE_BASELINE}")"
needs_baseline=0
if [[ "${force_baseline}" == "yes" ]]; then
needs_baseline=1
elif [[ "${force_baseline}" != "no" ]]; then
case "${arch}" in
x86_64|amd64)
if ! has_avx2; then
needs_baseline=1
fi
;;
esac
fi
printf '%s\n' "${targeted_package}"
printf '%s\n' "${needs_baseline}"