Skip to content

Commit 4b9fa23

Browse files
committed
fix(axe): Fix binary lookup and switch to universal archive
The archive directory search matched AXe_AXe.bundle/skills/axe instead of the top-level binary. Now checks for the binary directly before falling back to a file-based search. Also switches from the homebrew-specific archive to the universal archive as the preferred download.
1 parent 2847eff commit 4b9fa23

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

scripts/bundle-axe.sh

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,8 @@ else
9494

9595
echo "📥 Downloading latest AXe release from GitHub..."
9696

97-
# On macOS, prefer the Homebrew-specific archive (unsigned for relocation
98-
# compatibility) and ad-hoc sign it later. On non-macOS (e.g. CI on Linux),
99-
# codesign is unavailable so use the legacy pre-signed archive directly.
10097
AXE_RELEASE_BASE_URL="https://github.com/cameroncooke/AXe/releases/download/v${PINNED_AXE_VERSION}"
101-
AXE_HOMEBREW_URL="${AXE_RELEASE_BASE_URL}/AXe-macOS-homebrew-v${PINNED_AXE_VERSION}.tar.gz"
98+
AXE_UNIVERSAL_URL="${AXE_RELEASE_BASE_URL}/AXe-macOS-v${PINNED_AXE_VERSION}-universal.tar.gz"
10299
AXE_LEGACY_URL="${AXE_RELEASE_BASE_URL}/AXe-macOS-v${PINNED_AXE_VERSION}.tar.gz"
103100

104101
# Create temp directory
@@ -110,23 +107,26 @@ else
110107
echo "📥 Non-macOS detected; downloading pre-signed legacy archive ($AXE_LEGACY_URL)..."
111108
curl -fL -o "axe-release.tar.gz" "$AXE_LEGACY_URL"
112109
AXE_ARCHIVE_FLAVOR="legacy-signed"
113-
elif curl -fL -o "axe-release.tar.gz" "$AXE_HOMEBREW_URL"; then
114-
AXE_ARCHIVE_FLAVOR="homebrew-unsigned"
115-
echo "✅ Downloaded AXe Homebrew archive"
110+
elif curl -fL -o "axe-release.tar.gz" "$AXE_UNIVERSAL_URL"; then
111+
AXE_ARCHIVE_FLAVOR="universal"
112+
echo "✅ Downloaded AXe universal archive"
116113
else
117-
echo "⚠️ AXe Homebrew archive unavailable, falling back to legacy archive"
114+
echo "⚠️ AXe universal archive unavailable, falling back to legacy archive"
118115
curl -fL -o "axe-release.tar.gz" "$AXE_LEGACY_URL"
119116
AXE_ARCHIVE_FLAVOR="legacy-signed"
120117
fi
121118

122119
echo "📦 Extracting AXe release archive..."
123120
tar -xzf "axe-release.tar.gz"
124121

125-
# Find the extracted directory (might be named differently)
126-
EXTRACTED_DIR=$(find . -type d \( -name "*AXe*" -o -name "*axe*" \) | head -1)
127-
if [ -z "$EXTRACTED_DIR" ]; then
128-
# If no AXe directory found, assume files are in current directory
122+
# Find the extracted directory containing the axe binary
123+
if [ -f "axe" ] || [ -f "bin/axe" ]; then
129124
EXTRACTED_DIR="."
125+
else
126+
EXTRACTED_DIR=$(find . -maxdepth 2 -type f -name "axe" ! -path "*/skills/*" | head -1 | xargs -I{} dirname {})
127+
if [ -z "$EXTRACTED_DIR" ]; then
128+
EXTRACTED_DIR="."
129+
fi
130130
fi
131131

132132
cd "$EXTRACTED_DIR"
@@ -196,8 +196,8 @@ if [ "$OS_NAME" = "Darwin" ]; then
196196
ad_hoc_sign_bundled_axe_assets
197197
fi
198198

199-
if [ "$AXE_ARCHIVE_FLAVOR" = "homebrew-unsigned" ]; then
200-
echo "ℹ️ Homebrew AXe archive detected; using ad-hoc signatures for local runtime compatibility"
199+
if [ "$AXE_ARCHIVE_FLAVOR" = "universal" ]; then
200+
echo "ℹ️ Universal AXe archive detected; using ad-hoc signatures for local runtime compatibility"
201201
else
202202
echo "🔏 Verifying AXe signatures..."
203203
if ! codesign --verify --deep --strict "$BUNDLED_DIR/axe"; then
@@ -222,8 +222,8 @@ if [ "$OS_NAME" = "Darwin" ]; then
222222
done < <(find "$BUNDLED_DIR/Frameworks" -name "*.framework" -type d)
223223
fi
224224

225-
if [ "$AXE_ARCHIVE_FLAVOR" = "homebrew-unsigned" ]; then
226-
echo "ℹ️ Skipping Gatekeeper assessment for unsigned AXe Homebrew archive"
225+
if [ "$AXE_ARCHIVE_FLAVOR" = "universal" ]; then
226+
echo "ℹ️ Skipping Gatekeeper assessment for universal AXe archive"
227227
else
228228
echo "🛡️ Assessing AXe with Gatekeeper..."
229229
SPCTL_LOG="$(mktemp)"

0 commit comments

Comments
 (0)