SPB Git

Repository Public License

fetch.sh 1.8 KB 42 lines shellscript

1#!/bin/bash2# ORIX Convert — EmbeddedEngines/pandoc/fetch.sh3# Description: Downloads the official Pandoc arm64 macOS release (pinned version + SHA-256) and installs the4#              unmodified executable as EmbeddedEngines/tools/pandoc. Pandoc is run only as a separate process.5# Author: Simon-Pierre Boucher — contact@spboucher.ai6set -euo pipefail78VERSION="3.14"9ARCHIVE="pandoc-${VERSION}-arm64-macOS.zip"10URL="https://github.com/jgm/pandoc/releases/download/${VERSION}/${ARCHIVE}"11ARCHIVE_SHA256="58d6593884fec9d4424b641b92503c316d9c36decb2891ff8d73ae74dd3b6304"12BINARY_SHA256="42ee145b4b12d449c6aa13cb3d7f8be31d6f3cc1637ef45d06fc68fa86b7fd98"1314HERE="$(cd "$(dirname "$0")" && pwd)"15WORK="$HERE/work"16TOOLS="$HERE/../tools"17mkdir -p "$WORK" "$TOOLS"1819if [ ! -f "$WORK/$ARCHIVE" ]; then20  echo "Downloading $URL"21  /usr/bin/curl --fail --location --silent --show-error -o "$WORK/$ARCHIVE.part" "$URL"22  mv "$WORK/$ARCHIVE.part" "$WORK/$ARCHIVE"23fi24echo "$ARCHIVE_SHA256  $WORK/$ARCHIVE" | /usr/bin/shasum -a 256 -c -2526rm -rf "$WORK/extract"27mkdir -p "$WORK/extract"28/usr/bin/ditto -x -k "$WORK/$ARCHIVE" "$WORK/extract"29BIN="$WORK/extract/pandoc-${VERSION}-arm64/bin/pandoc"30echo "$BINARY_SHA256  $BIN" | /usr/bin/shasum -a 256 -c -3132# The executable must be arm64 only and link nothing but system libraries.33/usr/bin/lipo -archs "$BIN" | /usr/bin/grep -qx "arm64"34if /usr/bin/otool -L "$BIN" | /usr/bin/tail -n +2 | /usr/bin/awk '{print $1}' | /usr/bin/grep -Ev '^(/usr/lib/|/System/Library/)'; then35  echo "error: pandoc links a non-system library" >&2; exit 136fi3738/bin/cp -f "$BIN" "$TOOLS/pandoc"39/bin/chmod 755 "$TOOLS/pandoc"40rm -rf "$WORK/extract"41echo "Installed $("$TOOLS/pandoc" --version | /usr/bin/head -1) at $TOOLS/pandoc ($(LC_ALL=C /usr/bin/stat -f %z "$TOOLS/pandoc") bytes)"42
Files main
Menu

Theme