mirror of
https://github.com/saphid/frame-control.git
synced 2026-10-06 16:00:40 +02:00
- Pairing saves nothing if it was cancelled while adding the key. - The ssh stand-in runs under bash: dash refuses job control without a terminal, which cost stdin and the process group. - A server that stops while the tunnel opens fails the attempt (and retries) instead of leaving it half-connected. - The health probe answers within its deadline even when a dead link keeps the probe itself waiting. - A cached version is deleted only if no server runs from it (servers now run by absolute path) and it's two weeks unused. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
30 lines
1.1 KiB
Bash
Executable File
30 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# Stand-in for ssh when Frame Control's server runs on the Frame itself
|
|
# (FRAME_LOCAL=1, started by the iPhone app). The server and its helpers call
|
|
# `ssh [options] frame COMMAND`, and rsync calls it as its transport; here that
|
|
# means: run COMMAND in the home directory, as ssh would, with the same stdin.
|
|
while [ $# -gt 0 ]; do
|
|
case "$1" in
|
|
-[bcDEeFIiJLlmOoPpQRSWwB]) shift 2 ;; # options that take a value
|
|
-?*) shift ;;
|
|
*) break ;;
|
|
esac
|
|
done
|
|
[ $# -gt 0 ] && shift # the host alias
|
|
cd "$HOME" || exit 255
|
|
[ $# -eq 0 ] && exit 0 # -N: nothing to run
|
|
# Stopping ssh ends everything the command started (sshd hangs up the session).
|
|
# To do the same, run COMMAND as its own process group and pass on a TERM, HUP
|
|
# or INT to all of it, so e.g. a live-video ffmpeg can't outlive its stream.
|
|
set -m # job control (bash allows it without a terminal): own process group, and stdin kept
|
|
"${SHELL:-/bin/sh}" -c "$*" &
|
|
child=$!
|
|
trap 'kill -TERM -- "-$child" 2>/dev/null' TERM HUP INT
|
|
wait "$child"
|
|
status=$?
|
|
while kill -0 "$child" 2>/dev/null; do # a trapped signal ends `wait` early
|
|
wait "$child"
|
|
status=$?
|
|
done
|
|
exit "$status"
|