kydriv/installer/build.sh

54 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
set -e
VERSION="1.0.0"
IDENTIFIER="de.kydriv.driver"
PKG_NAME="kydriv-driver-${VERSION}.pkg"
# Build installer/root from source files
mkdir -p installer/root/Library/Printers/PPDs/Contents/Resources
mkdir -p installer/root/usr/libexec/cups/filter
cp ppd/TA3505ci_AS.ppd \
installer/root/Library/Printers/PPDs/Contents/Resources/
cp filter/kyofilter \
installer/root/usr/libexec/cups/filter/
chmod 755 installer/root/usr/libexec/cups/filter/kyofilter
# Validate PPD — fail only on structural errors, not on known pre-existing issues
echo "Validating PPD..."
UNEXPECTED=$(cupstestppd installer/root/Library/Printers/PPDs/Contents/Resources/TA3505ci_AS.ppd 2>&1 \
| grep "\*\*FAIL\*\*" \
| grep -v "FeedingEdgeConstraint\|kyofilter\|Übersetzungsstring\|Übersetzung") || true
if [ -n "$UNEXPECTED" ]; then
echo "ERROR: PPD has unexpected structural errors:" >&2
echo "$UNEXPECTED" >&2
exit 1
fi
echo "PPD OK"
# Build (unsigned if SIGN_IDENTITY not set)
SIGN_ARGS=()
if [ -n "${SIGN_IDENTITY}" ]; then
SIGN_ARGS=(--sign "${SIGN_IDENTITY}")
fi
pkgbuild \
--root installer/root \
--scripts installer/scripts \
--identifier "${IDENTIFIER}" \
--version "${VERSION}" \
"${SIGN_ARGS[@]}" \
"${PKG_NAME}"
echo ""
echo "Built: ${PKG_NAME}"
if [ -z "${SIGN_IDENTITY}" ]; then
echo ""
echo "To sign: SIGN_IDENTITY='Developer ID Installer: NAME (TEAMID)' bash installer/build.sh"
echo ""
echo "To notarize after signing:"
echo " xcrun notarytool submit ${PKG_NAME} --apple-id YOUR@EMAIL --team-id TEAMID --password APP-PW --wait"
echo " xcrun stapler staple ${PKG_NAME}"
fi