package-macos.sh 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/usr/bin/env bash
  2. # macOS package of a built LYNX.app: ad-hoc signature (LYNX has no Apple Developer ID, so it is NOT notarized) and a
  3. # compressed .dmg with the app, a link to /Applications and a "read me first" note on how to open it the first time.
  4. #
  5. # usage: scripts/package-macos.sh <LYNX.app> <label> <output folder> [Demo.lynx]
  6. set -euo pipefail
  7. cd "$(dirname "$0")/.."
  8. APP="$1"; LABEL="$2"; OUTDIR="$3"; DEMO="${4:-}"
  9. NAME="LYNX-$LABEL-macos-universal"
  10. STAGE="$(mktemp -d)/LYNX"
  11. mkdir -p "$STAGE" "$OUTDIR"
  12. ditto "$APP" "$STAGE/LYNX.app"
  13. # ad-hoc signature over the whole bundle: Apple Silicon refuses to run unsigned code, and a consistent bundle
  14. # signature turns "LYNX is damaged" into the normal "unidentified developer" prompt
  15. codesign --force --deep --sign - "$STAGE/LYNX.app"
  16. codesign --verify --deep --strict "$STAGE/LYNX.app"
  17. ln -s /Applications "$STAGE/Applications"
  18. [[ -n "$DEMO" && -f "$DEMO" ]] && cp "$DEMO" "$STAGE/Demo.lynx"
  19. cp LICENSE "$STAGE/LICENSE.txt"
  20. cat > "$STAGE/Read me first.txt" <<'EOF'
  21. LYNX for macOS (Apple Silicon and Intel, macOS 11 or newer)
  22. 1. Drag LYNX into the Applications folder.
  23. 2. LYNX is free software from an independent developer without an Apple Developer ID, so it is not notarized by
  24. Apple. The first time, open it like this:
  25. - Control-click (or right-click) LYNX in Applications, choose Open, then Open again.
  26. - On macOS 15 Sequoia or newer: try to open LYNX once, then go to System Settings > Privacy & Security and
  27. click "Open Anyway" next to the message about LYNX.
  28. Or, in Terminal: xattr -dr com.apple.quarantine /Applications/LYNX.app
  29. After that it opens normally.
  30. 3. macOS asks for microphone access the first time you record.
  31. Source code, checksums and help: https://github.com/Ka1-S/LYNX
  32. ---
  33. LYNX para macOS (Apple Silicon e Intel, macOS 11 ou mais novo)
  34. 1. Arraste o LYNX para a pasta Aplicativos.
  35. 2. O LYNX é software livre de um desenvolvedor independente sem Apple Developer ID, por isso não é notarizado pela
  36. Apple. Na primeira vez, abra assim:
  37. - Clique com o botão direito (ou Control-clique) no LYNX em Aplicativos, escolha Abrir e depois Abrir de novo.
  38. - No macOS 15 Sequoia ou mais novo: tente abrir o LYNX uma vez, depois vá em Ajustes do Sistema > Privacidade e
  39. Segurança e clique em "Abrir Mesmo Assim" ao lado da mensagem sobre o LYNX.
  40. Ou, no Terminal: xattr -dr com.apple.quarantine /Applications/LYNX.app
  41. Depois disso ele abre normalmente.
  42. 3. O macOS pede acesso ao microfone na primeira vez que você gravar.
  43. EOF
  44. rm -f "$OUTDIR/$NAME.dmg"
  45. # hdiutil sometimes fails with "Resource busy" on CI runners (a transient lock on the image); retry a few times
  46. for attempt in 1 2 3 4 5; do
  47. hdiutil create -volname "LYNX $LABEL" -srcfolder "$STAGE" -fs HFS+ -format UDZO -imagekey zlib-level=9 -ov \
  48. "$OUTDIR/$NAME.dmg" && break
  49. [[ $attempt -lt 5 ]] || exit 1
  50. echo "hdiutil create failed (attempt $attempt), retrying"; sleep $((attempt * 10))
  51. done
  52. hdiutil verify "$OUTDIR/$NAME.dmg"
  53. ls -la "$OUTDIR/$NAME.dmg"