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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SdbBg69LciFz8kjVCtnkbj
This commit is contained in:
1 parent
e934faf776
commit
649399aaa1
2 files changed
+12
No files matched your search
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import string
|
import string
|
||||||
import subprocess
|
import subprocess
|
||||||
@@ -273,6 +274,11 @@ qemu_args = [
|
|||||||
|
|
||||||
print(f"Starting {host_arch} VM from {qemu_config_template} "
|
print(f"Starting {host_arch} VM from {qemu_config_template} "
|
||||||
f"and {qemu_arch_config}.", flush=True)
|
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:
|
if daemonize:
|
||||||
log_file.write_text("")
|
log_file.write_text("")
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import string
|
import string
|
||||||
import subprocess
|
import subprocess
|
||||||
@@ -275,6 +276,11 @@ qemu_args = [
|
|||||||
|
|
||||||
print(f"Starting Fedora 44 ({host_arch}) from {qemu_config_template} "
|
print(f"Starting Fedora 44 ({host_arch}) from {qemu_config_template} "
|
||||||
f"and {qemu_arch_config}.", flush=True)
|
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:
|
if daemonize:
|
||||||
log_file.write_text("")
|
log_file.write_text("")
|
||||||
|
|||||||
Reference in new issue
Block a user