Files
cupsadmin/pkg/postinstall
2026-09-16 13:59:05 -05:00

19 lines
725 B
Bash
Executable File

#!/bin/bash
# cupsadmin postinstall: installs the CLI. The binary ships in the Scripts archive next to this file
# (not in the payload), so the package never changes ownership/permissions of an existing
# /usr/local/bin (Homebrew on Intel owns it). CUPS Admin.app is a normal payload with a receipt.
set -euo pipefail
TARGET="${3:-/}"
HERE="$(cd "$(dirname "$0")" && pwd)"
DEST_DIR="${TARGET%/}/usr/local/bin"
if [ ! -d "$DEST_DIR" ]; then
mkdir -p -m 755 "$DEST_DIR"
echo "cupsadmin: created $DEST_DIR"
fi
# -S: copy to a temp file and rename, so a running cupsadmin is never half-written.
install -S -m 755 -o root -g wheel "$HERE/cupsadmin" "$DEST_DIR/cupsadmin"
echo "cupsadmin: installed $DEST_DIR/cupsadmin"