On Tuesday, 16 April 2019 10:55:39 CEST Richard W.M. Jones wrote:
+(* Unfortunately Powershell scripts cannot be directly executed
+ * (unless some system config changes are made which for other
+ * reasons we don't want to do) and so we have to run this via
+ * a regular batch file.
+ *)
+let install_firstboot_powershell g { Types.i_windows_systemroot; i_root }
+ filename code =
+ let tempdir = sprintf "%s/Temp" i_windows_systemroot in
+ g#mkdir_p tempdir;
+ let code = String.concat "\r\n" code ^ "\r\n" in
The Firstboot module uses String.unix2dos to convert the script to the
proper newline style for Windows. What about assuming that 'code' is a
single Unix-style string with the whole script, calling String.unix2dos,
instead of taking the list of lines? Mostly for consistency, so
everything that writes files on Windows uses String.unix2dos.
+ (* Powershell interpreter. Should we check this exists? XXX *)
+ let ps_exe =
+ i_windows_systemroot ^
+ "\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" in
According to the Interweb, it looks like this location was kept even
for PowerShell 2.0+ for "compatibility".
OTOH the comment raises another concern: what about old Windows versions
without PowerShell? Most probably virt-v2v needs to report that to the
user (a warning, perhaps) so they know that the static IPs (specified
on the command line) cannot be preserved anyway. Otherwise, the
conversion will work fine, and the user realize that this did not work
only when booting the converted Windows.
Maybe add a simple is_powershell_available helper to this (Windows)
module?
--
Pino Toscano