mirror of
https://github.com/Lakr233/vphone-cli.git
synced 2026-09-02 02:34:29 +00:00
The v1.0.2 release build failed at the bundle codesign step:
.build/vphone-cli.app/Contents/MacOS/vphone-cli: code object is not signed at all
In subcomponent: .../Contents/MacOS/vphone-amfidont
Contents/MacOS is the bundle's nested-code directory, so signing the main
executable seals everything there and rejected the vphone-amfidont shell
script as unsigned nested code. (A script only gets a "generic" xattr
signature that wouldn't survive the release zip anyway.)
Move the bundled helper to Contents/Resources/vphone-amfidont, where it is
sealed as an ordinary resource (hashed, survives zip). Resources sits at the
same depth under Contents as MacOS, so the script's `${0:A:h:h:h}` .app
resolution is unchanged. The Homebrew `binary` stanza should point at
Contents/Resources/vphone-amfidont.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Y4VDqWf5pVakcFLqB23CKe
44 lines
2.1 KiB
Bash
Executable File
44 lines
2.1 KiB
Bash
Executable File
#!/bin/zsh
|
|
# vphone-amfidont — allow this vphone-cli.app through amfid via amfidont,
|
|
# started in daemon mode with --spoof-apple. Automates the README "Option B"
|
|
# step. amfidont: https://github.com/zqxwce/amfidont
|
|
set -euo pipefail
|
|
|
|
# The enclosing .app (this lives at vphone-cli.app/Contents/Resources/vphone-amfidont;
|
|
# `:A` resolves a Homebrew symlink back into the bundle).
|
|
app="${0:A:h:h:h}"
|
|
[[ "${app:e}" == app && -x "$app/Contents/MacOS/vphone-cli" ]] \
|
|
|| { print -u2 "error: run vphone-amfidont from inside vphone-cli.app"; exit 1 }
|
|
|
|
# Ensure amfidont is installed.
|
|
if ! command -v amfidont >/dev/null; then
|
|
printf "amfidont is not installed. Install it via pip now? [y/N] "
|
|
read -r ans || ans=n
|
|
[[ "$ans" == [yY]* ]] || { print "Aborted."; exit 1 }
|
|
xcrun python3 -m pip install -U amfidont
|
|
command -v amfidont >/dev/null \
|
|
|| { print -u2 "amfidont installed but not on PATH — open a new shell and retry."; exit 1 }
|
|
fi
|
|
# Absolute path: sudo's secure_path won't find a pip-user install by name.
|
|
bin="$(command -v amfidont)"
|
|
|
|
# Is amfidont already running? Only one can attach to amfid at a time. Check
|
|
# cheaply without root first; its args (and /var/root config) need root, so
|
|
# escalate to a single sudo ONLY when something is actually running.
|
|
raw="$(ps -ax -o pid=,command= | grep '[a]mfidont' | grep -v vphone-amfidont | awk '{print $1}' || true)"
|
|
if [[ -n "${raw//[[:space:]]/}" ]]; then
|
|
pids=(${(f)raw})
|
|
print "amfidont is already running — checking coverage (needs sudo)…"
|
|
info="$(sudo sh -c "ps -o command= -p ${(j:,:)pids} 2>/dev/null; cat /var/root/.amfidont/paths 2>/dev/null" || true)"
|
|
info+=$'\n'"$(cat ~/.amfidont/paths 2>/dev/null || true)"
|
|
# Covered if this .app's path is allowed, or if it's running with --allow-all.
|
|
if print -r -- "$info" | grep -Fq -- "$app" || print -r -- "$info" | grep -Fq -- "--allow-all"; then
|
|
print "amfidont is already running and allows this .app — nothing to do."
|
|
exit 0
|
|
fi
|
|
print -u2 "amfidont is already running but does NOT allow this .app. Stop it, then re-run vphone-amfidont."
|
|
exit 1
|
|
fi
|
|
|
|
exec sudo "$bin" daemon --spoof-apple --path "$app"
|