SPB Git

Repository Public License

sign-tools.sh 1.6 KB 34 lines shellscript

1#!/usr/bin/env bash2# ORIX Convert — Scripts/sign-tools.sh3# Description: Copies EmbeddedEngines/tools to build/signed-tools and signs every Mach-O file in it with the4#              Developer ID Application identity (Hardened Runtime, secure timestamp). LibreOffice's soffice gets5#              the single entitlement it needs (allow-jit). Nothing is uploaded.6# Author: Simon-Pierre Boucher — contact@spboucher.ai7set -euo pipefail8cd "$(dirname "$0")/.."9ID="${SIGN_IDENTITY:-Developer ID Application: Simon-Pierre Boucher (3YM54G49SN)}"10SRC="EmbeddedEngines/tools"; OUT="build/signed-tools"11rm -rf "$OUT"; mkdir -p build; ditto "$SRC" "$OUT"12ENT="build/libreoffice.entitlements"13cat > "$ENT" <<'PLIST'14<?xml version="1.0" encoding="UTF-8"?>15<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">16<plist version="1.0"><dict><key>com.apple.security.cs.allow-jit</key><true/></dict></plist>17PLIST18is_macho() { /usr/bin/file -b "$1" | grep -q "Mach-O"; }19sign() { codesign --force --options runtime --timestamp --sign "$ID" "$@" 2>&1 | grep -v "replacing existing signature" || true; }20LO="$OUT/LibreOffice.app"21n=022if [[ -d "$LO" ]]; then23  while IFS= read -r -d '' f; do24    [[ "$f" == "$LO/Contents/MacOS/soffice" ]] && continue25    if is_macho "$f"; then sign "$f"; n=$((n+1)); fi26  done < <(find "$LO/Contents" -type f -print0)27  sign --entitlements "$ENT" "$LO"28  codesign --verify --deep --strict "$LO"29fi30while IFS= read -r -d '' f; do31  if is_macho "$f"; then sign "$f"; n=$((n+1)); fi32done < <(find "$OUT" -maxdepth 1 -type f -print0)33echo "signed $n Mach-O files + LibreOffice bundle in $OUT"34
Files main
Menu

Theme