Files
felhom.eu/documentation/audits/catalog-sweep-2026-10-24/tools/vmctl.sh
T
admin 67053335d1
gates / gates (push) Successful in 13m17s
Catalog sweep 2026-10-24: all 65 catalog apps on a fresh box (52 work, 10 with a problem, 0 broken); register 208 -> 217 (R-1269..R-1277 opened; notes on R-739, R-1267); STATUS + D46; map B1 re-checked; evidence
Every catalog app installed, used, backed up, removed keeping data, reinstalled, restored and removed with data on a
fresh box from the public ISO (demo-hp VM 9360, Tester4), endpoint-level. Worst: a reinstall's capture rewrites the
kept unit so its restore breaks the app (R-1269, P2), the restore still reports success (R-1270, P2), and „use my kept
data" loaded another box's future-dated database (R-1271, P2). Drill catalog fixes for the morning list (n8n usage
data; OpenGist 256M, proven by a cgroup probe). VM 9360 and LXC 9361 destroyed; hub host Tester4-aa9466 left for the
operator. REPORT-catalog-sweep-2026-10-24.md.
2026-10-25 00:13:05 +02:00

59 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
# vmctl.sh — drive a nested VM's console on demo-hp from DooPlex (rehearsal 2026-10-20).
# The installer keeps the HUNGARIAN keyboard (as a household would), so characters are sent as the
# scancodes a Hungarian-layout keyboard produces: y<->z swapped, '-' on the US '/' key, '0' on the
# US '`' key, '@' = AltGr+V. Only the characters below are supported — anything else is refused.
#
# vmctl.sh <vmid> shot <out.png> console screenshot (QEMU screendump → PNG on DooPlex)
# vmctl.sh <vmid> key <qemu-key>... send raw keys (e.g. ret, tab, right, alt-n)
# vmctl.sh <vmid> type <text> type text with the Hungarian mapping
# vmctl.sh <vmid> typevar <ENVNAME> type the value of an env var (use inside `sec run`; never echoed)
set -euo pipefail
VMID=$1; CMD=$2; shift 2
HOST=${VMHOST:-demo-hp}
map_char() {
local c=$1
case "$c" in
[a-x]) echo "$c" ;;
y) echo "z" ;; z) echo "y" ;;
[A-X]) echo "shift-${c,,}" ;;
Y) echo "shift-z" ;; Z) echo "shift-y" ;;
[1-9]) echo "$c" ;;
0) echo "grave_accent" ;;
.) echo "dot" ;;
,) echo "comma" ;;
-) echo "slash" ;;
_) echo "shift-slash" ;;
@) echo "alt_r-v" ;;
" ") echo "spc" ;;
*) echo "UNSUPPORTED" ;;
esac
}
send_text() {
local s=$1 keys=() k i
for (( i=0; i<${#s}; i++ )); do
k=$(map_char "${s:$i:1}")
if [ "$k" = UNSUPPORTED ]; then echo "vmctl: unsupported character at position $i" >&2; exit 2; fi
keys+=("$k")
done
# one ssh, one qm sendkey per key (qm sendkey takes one key combo)
printf '%s\n' "${keys[@]}" | ssh "$HOST" "while read -r k; do LC_ALL=C qm sendkey $VMID \"\$k\" >/dev/null 2>&1 || exit 3; sleep 0.08; done"
}
case "$CMD" in
shot)
out=$1
ssh "$HOST" "rm -f /tmp/vmshot-$VMID.ppm; echo 'screendump /tmp/vmshot-$VMID.ppm' | LC_ALL=C qm monitor $VMID >/dev/null 2>&1; sleep 1; cat /tmp/vmshot-$VMID.ppm" > "$out.ppm"
convert "$out.ppm" "$out"; rm -f "$out.ppm"; echo "shot: $out" ;;
key)
for k in "$@"; do ssh "$HOST" "LC_ALL=C qm sendkey $VMID '$k'"; sleep 0.3; done ;;
type)
send_text "$1" ;;
typevar)
v=${!1:-}; [ -n "$v" ] || { echo "vmctl: env $1 empty" >&2; exit 2; }
send_text "$v" ;;
*) echo "usage: see header" >&2; exit 1 ;;
esac