#!/usr/bin/env python3 """Push a local script into the running maintenance guest and run it. sudo owuivm-guest-run vm/images/ubuntu/by-hand.sh WHY THIS EXISTS Preparing a base image by hand means typing into a VNC console, and the list of things to do to it is a hundred lines long. Everything on that list is ordinary shell, so the only real problem is getting the text in there - and the machine already has a channel for exactly that, the same one every session uses. It needs qemu-guest-agent inside the guest, which is also the one thing on that list that genuinely has to be typed by hand: it is what this speaks to. So the sequence is always "install the guest agent by hand, then push the rest". Deliberately the maintenance socket only. A session's guest belongs to the agent, and a way to inject a script into it from the host is not something this host should own. """ from __future__ import annotations import sys sys.path.insert(0, "/usr/local/lib/owuivm") from guest import Guest, GuestError # noqa: E402 SOCKET = "/run/owuivm/00000000000000000000000000000000/ga.sock" def main(argv: list[str]) -> int: if len(argv) != 2: print(f"usage: {argv[0]}