From 027fefd517b8a93c54611a6cc4c51a54fea1b9fe Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 30 Apr 2012 11:33:19 +0100 Subject: Add gettext support for OCaml tools (virt-resize, virt-sparsify, virt-sysprep). Note that this support is optional: To enable it, install the ocaml-gettext library from http://forge.ocamlcore.org/projects/ocaml-gettext . If this library is not installed, then configure detects this and inserts dummy gettext functions that do nothing. --- sysprep/sysprep_operation_script.ml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'sysprep/sysprep_operation_script.ml') diff --git a/sysprep/sysprep_operation_script.ml b/sysprep/sysprep_operation_script.ml index bcbba739..1f33c053 100644 --- a/sysprep/sysprep_operation_script.ml +++ b/sysprep/sysprep_operation_script.ml @@ -21,13 +21,14 @@ open Unix open Utils open Sysprep_operation +open Sysprep_gettext.Gettext module G = Guestfs let scriptdir = ref None let set_scriptdir dir = if !scriptdir <> None then ( - eprintf "virt-sysprep: --scriptdir cannot be used more than once\n"; + eprintf (f_"virt-sysprep: --scriptdir cannot be used more than once\n"); exit 1 ); scriptdir := Some dir @@ -61,17 +62,17 @@ let rec script_perform (g : Guestfs.guestfs) root = match snd (waitpid [] pid) with | WEXITED 0 -> true | WEXITED i -> - eprintf "virt-sysprep: script: failed (code %d)\n" i; + eprintf (f_"virt-sysprep: script: failed (code %d)\n") i; false | WSIGNALED i | WSTOPPED i -> - eprintf "virt-sysprep: script: killed by signal (%d)\n" i; + eprintf (f_"virt-sysprep: script: killed by signal (%d)\n") i; false in (* Remote temporary directory / mountpoint. *) if cleanup then rmdir scriptdir; - if not ok then failwith "script failed" + if not ok then failwith (s_"script failed") ); [] @@ -114,8 +115,8 @@ trap cleanup INT TERM QUIT EXIT ERR\n" let script_op = { name = "script"; enabled_by_default = true; - heading = "Run arbitrary scripts against the guest"; - pod_description = Some "\ + heading = s_"Run arbitrary scripts against the guest"; + pod_description = Some (s_"\ The C