From 692354df0bf2915955d8c66705685f66f5f44844 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 1 Aug 2024 10:36:52 +0100 Subject: [PATCH] common: mlcustomize: Inject qemu-ga & blnsvr into /Temp Update common submodule to pick up this further change which should mean that for all Windows conversions, everything is confined to C:\Program Files\Guestfs\Firstboot (except the virtio drivers themselves). Richard W.M. Jones (1): mlcustomize: Inject qemu-ga & blnsvr into /Temp (cherry picked from commit 168eacf977ca49e96bc63ddc4109c27515ac0277) --- common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Submodule common d489469f..04116678: diff --git a/common/mlcustomize/inject_virtio_win.ml b/common/mlcustomize/inject_virtio_win.ml index b04a3b38..2981bff5 100644 --- a/common/mlcustomize/inject_virtio_win.ml +++ b/common/mlcustomize/inject_virtio_win.ml @@ -263,14 +263,28 @@ let rec inject_virtio_win_drivers ({ g } as t) reg = } ) -and inject_qemu_ga t = - let msi_files = copy_qemu_ga t in +and inject_qemu_ga ({ g; root } as t) = + (* Copy the qemu-ga MSI(s) to the guest. *) + let dir, dir_win = Firstboot.firstboot_dir g root in + let dir_win = Option.value dir_win ~default:dir in + let tempdir = sprintf "%s/Temp" dir in + let tempdir_win = sprintf "%s\\Temp" dir_win in + g#mkdir_p tempdir; + + let msi_files = copy_qemu_ga t tempdir in if msi_files <> [] then - configure_qemu_ga t msi_files; + configure_qemu_ga t tempdir_win msi_files; msi_files <> [] (* return true if we found some qemu-ga MSI files *) -and inject_blnsvr t = - let files = copy_blnsvr t in +and inject_blnsvr ({ g; root } as t) = + (* Copy the files to the guest. *) + let dir, dir_win = Firstboot.firstboot_dir g root in + let dir_win = Option.value dir_win ~default:dir in + let tempdir = sprintf "%s/Temp" dir in + let tempdir_win = sprintf "%s\\Temp" dir_win in + g#mkdir_p tempdir; + + let files = copy_blnsvr t tempdir in match files with | [] -> false (* Didn't find or install anything. *) @@ -278,7 +292,7 @@ and inject_blnsvr t = * drivers/by-driver). Pick the first. *) | blnsvr :: _ -> - configure_blnsvr t blnsvr; + configure_blnsvr t tempdir_win blnsvr; true and add_guestor_to_registry t ((g, root) as reg) drv_name drv_pciid = @@ -360,13 +374,13 @@ and copy_drivers t driverdir = (fun () -> error (f_"root directory ‘/’ is missing from the virtio-win directory or ISO.\n\nThis should not happen and may indicate that virtio-win or virt-v2v is broken in some way. Please report this as a bug with a full debug log.")) -and copy_qemu_ga t = - copy_from_virtio_win t "/" "/" (virtio_iso_path_matches_qemu_ga t) +and copy_qemu_ga t tempdir = + copy_from_virtio_win t "/" tempdir (virtio_iso_path_matches_qemu_ga t) (fun () -> error (f_"root directory ‘/’ is missing from the virtio-win directory or ISO.\n\nThis should not happen and may indicate that virtio-win or virt-v2v is broken in some way. Please report this as a bug with a full debug log.")) -and copy_blnsvr t = - copy_from_virtio_win t "/" "/" (virtio_iso_path_matches_blnsvr t) +and copy_blnsvr t tempdir = + copy_from_virtio_win t "/" tempdir (virtio_iso_path_matches_blnsvr t) (fun () -> error (f_"root directory ‘/’ is missing from the virtio-win directory or ISO.\n\nThis should not happen and may indicate that virtio-win or virt-v2v is broken in some way. Please report this as a bug with a full debug log.")) @@ -578,7 +592,7 @@ and copy_from_libosinfo { g; i_osinfo; i_arch } destdir = (* Install qemu-ga. [files] is the non-empty list of possible qemu-ga * installers we detected. *) -and configure_qemu_ga t files = +and configure_qemu_ga t tempdir_win files = let script = ref [] in let add = List.push_back script in @@ -591,16 +605,17 @@ and configure_qemu_ga t files = add ""; add "# Run qemu-ga installers"; List.iter ( - fun msi_path -> - add (sprintf "Start-Process -Wait -FilePath \"C:\\%s\" -ArgumentList \"/norestart\",\"/qn\",\"/l+*vx\",\"C:\\%s.log\"" - msi_path msi_path) + fun msi -> + (* [`] is an escape char for quotes *) + add (sprintf "Start-Process -Wait -FilePath \"%s\\%s\" -ArgumentList \"/norestart\",\"/qn\",\"/l+*vx\",\"`\"%s\\%s.log`\"\"" + tempdir_win msi tempdir_win msi) ) files; Firstboot.add_firstboot_powershell t.g t.root "install-qemu-ga" !script -and configure_blnsvr t blnsvr = +and configure_blnsvr t tempdir_win blnsvr = let cmd = sprintf "\ @echo off\n\ echo Installing %s\n\ - c:\\%s -i\n" blnsvr blnsvr in - Firstboot.add_firstboot_script t.g t.root (sprintf "install-%s" blnsvr) cmd + \"%s\\%s\" -i\n" blnsvr tempdir_win blnsvr in + Firstboot.add_firstboot_script t.g t.root "install-blnsvr" cmd