#!/usr/bin/env bash # plist_lint : refuses a launchd plist that is not a well-formed property # list. A Mac lints with plutil; a host without it (the Linux CI runner, which # renders these plists in the installer tests) parses it with Python's plistlib, # so the rendered file is checked on both rather than skipped on one. plist_lint() { if command -v plutil >/dev/null 2>&1; then plutil -lint "$1" >/dev/null else python3 -c 'import plistlib, sys with open(sys.argv[1], "rb") as f: plistlib.load(f, fmt=plistlib.FMT_XML)' "$1" \ || { echo "plist_lint: $1 is not a well-formed property list" >&2; return 1; } fi }