From 649399aaa11e2ea5c78c4f46096d4857fb21e190 Mon Sep 17 00:00:00 2001 From: Guofang Date: Sun, 11 Oct 2026 13:44:52 +0800 Subject: [PATCH] Print the SSH command again in the Debian and Fedora launchers Moving the SSH port forward into the QEMU config files dropped the launchers' SSH hint. Read the host port forwarded to guest port 22 from the rendered config and print the matching ssh command. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01SdbBg69LciFz8kjVCtnkbj --- run-debian13.py | 6 ++++++ run-fedora44.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/run-debian13.py b/run-debian13.py index b44eb11..bdaacd0 100755 --- a/run-debian13.py +++ b/run-debian13.py @@ -3,6 +3,7 @@ import os import platform +import re import shutil import string import subprocess @@ -273,6 +274,11 @@ qemu_args = [ print(f"Starting {host_arch} VM from {qemu_config_template} " f"and {qemu_arch_config}.", flush=True) +# The SSH port forward lives in the config file, e.g. hostfwd = "tcp::2222-:22". +ssh_forward = re.search(r'hostfwd\s*=\s*"tcp:[^:"]*:(\d+)-[^:"]*:22"', qemu_config_text) +if ssh_forward: + print(f"SSH is forwarded to localhost:{ssh_forward.group(1)}: " + f"ssh -p {ssh_forward.group(1)} guofang@localhost", flush=True) if daemonize: log_file.write_text("") diff --git a/run-fedora44.py b/run-fedora44.py index c461685..6d9bf29 100755 --- a/run-fedora44.py +++ b/run-fedora44.py @@ -3,6 +3,7 @@ import os import platform +import re import shutil import string import subprocess @@ -275,6 +276,11 @@ qemu_args = [ print(f"Starting Fedora 44 ({host_arch}) from {qemu_config_template} " f"and {qemu_arch_config}.", flush=True) +# The SSH port forward lives in the config file, e.g. hostfwd = "tcp::2224-:22". +ssh_forward = re.search(r'hostfwd\s*=\s*"tcp:[^:"]*:(\d+)-[^:"]*:22"', qemu_config_text) +if ssh_forward: + print(f"SSH is forwarded to localhost:{ssh_forward.group(1)}: " + f"ssh -p {ssh_forward.group(1)} guofang@localhost", flush=True) if daemonize: log_file.write_text("")