diff --git a/run-windows11.py b/run-windows11.py index a106a31..f693d8c 100755 --- a/run-windows11.py +++ b/run-windows11.py @@ -486,6 +486,32 @@ print("Account: guofang / password; " + "; ".join( f"{forward.label}: 0.0.0.0:{forward.host_port}" for forward in forwards), flush=True) +if installing_from_iso and not install_from_img: + # The Windows ISO boots through bootmgr, which waits for a key ("Press any + # key to boot from CD or DVD...") and gives up after a few seconds. Nobody + # is there to press it, so a detached helper taps the space bar through the + # QEMU monitor for the first 30 s. It exits by itself; later key presses + # are harmless because Setup is unattended. + key_script = ( + "import socket, sys, time\n" + "path = sys.argv[1]\n" + "end = time.time() + 30\n" + "while time.time() < end:\n" + " try:\n" + " s = socket.socket(socket.AF_UNIX)\n" + " s.connect(path)\n" + " break\n" + " except OSError:\n" + " time.sleep(0.5)\n" + "else:\n" + " sys.exit(0)\n" + "while time.time() < end:\n" + " s.sendall(b'sendkey spc\\n')\n" + " time.sleep(1)\n") + subprocess.Popen([sys.executable, "-c", key_script, str(monitor_socket)], + stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, start_new_session=True) + if daemonize: log_file.write_text("") qemu_args += ["-serial", f"file:{log_file}", "-daemonize", "-pidfile", str(pid_file)] diff --git a/vm-images b/vm-images index 71c0c3d..1dc4065 160000 --- a/vm-images +++ b/vm-images @@ -1 +1 @@ -Subproject commit 71c0c3d029f1366b7c5faa4f5f078210abe5f5b9 +Subproject commit 1dc40655dffcc07ca34907b6d36063d8dbe7d279