On Thu, May 12, 2016 at 03:29:13PM +0200, Cédric Bosdonnat wrote:
- (* rhsrvany.exe must exist.
+ (* either rhsrvany.exe or pvvxsvc.exe must exist.
Best to capitalize "either" in this comment.
*
* (Check also that it's not a dangling symlink but a real file).
*)
- let rhsrvany_exe = virt_tools_data_dir // "rhsrvany.exe" in
- (try
- let chan = open_in rhsrvany_exe in
- close_in chan
- with
- Sys_error msg ->
- error (f_"'%s' is missing. This file is required in order to
install Windows firstboot scripts. You can get it by building rhsrvany
(
https://github.com/rwmjones/rhsrvany). Original error: %s")
- rhsrvany_exe msg
- );
+ let services = ["rhsrvany.exe"; "pvvxsvc.exe"] in
+ let srvany = (
You don't need the extra '(' here.
+ fun service -> (
Nor after the fun .. -> here.
+ try
+ let chan = open_in (virt_tools_data_dir // service) in
+ close_in chan;
+ true
+ with _ ->
+ false
+ )
+ ) services
+ with Not_found ->
+ error (f_"One of rhsrvany.exe or pvvxsvc.exe is missing in %s. One of them
is required in order to install Windows firstboot scripts. You can get one by building
rhsrvany (
https://github.com/rwmjones/rhsrvany)")
+ virt_tools_data_dir
+ ) in
Although it's not written down anywhere, I usually put the `in'
on the preceeding line when defining a non-function, so (without
the unnecessary paren) this becomes:
+ error (f_"....")
+ virt_tools_data_dir in
Rest of this commit looks good.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v