Prd/components/dialer-patch/apply.sh
Lucy Doupalů be9f14ce34 Helpdesk - operator console + patched GrapheneOS Dialer for call handling
A small helpdesk system: an office Pixel running a patched GrapheneOS Dialer
answers technician calls, records both call legs as separate channels, and a
Ruby backend transcribes them through Whisper and files an AI summary against
the caller.

Squashed to a single commit for sharing. No credentials are included; secrets
live outside the repo in /etc/helpdesk/env on the server or a gitignored
.claude/env.local locally. See .claude/env.local.example for the shape.

Start at README.md, then docs/architecture.md.
2026-07-27 18:50:32 +02:00

32 lines
1.6 KiB
Bash
Executable file

#!/usr/bin/env bash
# Apply the helpdesk Dialer patch into the GrapheneOS source tree.
# - copies the new com.android.dialer.helpdesk package (overlay/) into the Dialer module
# - applies patches/*.patch to modified upstream files (idempotent: skips already-applied)
# Run: bash components/dialer-patch/apply.sh
set -euo pipefail
cd "$(dirname "$0")" # -> components/dialer-patch
TREE="${DIALER_TREE:-/build/grapheneos/packages/apps/Dialer}"
[ -d "$TREE" ] || { echo "Dialer tree not found: $TREE"; exit 1; }
# 1) new files — the helpdesk package + any non-java overlay (etc/, res/…) mirrored under the module
mkdir -p "$TREE/java/com/android/dialer/helpdesk"
rsync -a overlay/java/com/android/dialer/helpdesk/ "$TREE/java/com/android/dialer/helpdesk/"
for d in etc res; do
[ -d "overlay/$d" ] && { rsync -a "overlay/$d/" "$TREE/$d/"; echo "copied overlay/$d -> $TREE/$d/"; }
done
echo "copied helpdesk package -> $TREE/java/com/android/dialer/helpdesk/"
# 2) patches to existing upstream files (version-controlled diffs)
# NB: `git -C "$TREE"` resolves file arguments relative to $TREE, so the patch path MUST be absolute
# (a relative patches/*.patch would be looked up under $TREE and silently fail every check -> WARN).
shopt -s nullglob
for p in "$PWD"/patches/*.patch; do
if git -C "$TREE" apply --reverse --check "$p" 2>/dev/null; then
echo "already applied: $(basename "$p")"
elif git -C "$TREE" apply --check "$p" 2>/dev/null; then
git -C "$TREE" apply "$p"; echo "applied: $(basename "$p")"
else
echo "WARN: cannot apply $(basename "$p") cleanly (tree changed?)"
fi
done
echo "done."