diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-04-30 11:33:19 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-05-01 09:39:35 +0100 |
commit | 027fefd517b8a93c54611a6cc4c51a54fea1b9fe (patch) | |
tree | 143c33d12478dd2f66a60d3d28c3529806b5bec7 /sysprep/sysprep_operation_script.ml | |
parent | 75514ab57a06e534f26698fe1725ca29b966c3ad (diff) | |
download | libguestfs-027fefd517b8a93c54611a6cc4c51a54fea1b9fe.tar.gz libguestfs-027fefd517b8a93c54611a6cc4c51a54fea1b9fe.tar.xz libguestfs-027fefd517b8a93c54611a6cc4c51a54fea1b9fe.zip |
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.
Diffstat (limited to 'sysprep/sysprep_operation_script.ml')
-rw-r--r-- | sysprep/sysprep_operation_script.ml | 23 |
1 files changed, 12 insertions, 11 deletions
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<script> module lets you run arbitrary shell scripts or programs against the guest. @@ -133,10 +134,10 @@ guest's DNS configuration file, but C<rm /etc/resolv.conf> would (try to) remove the host's file. Normally a temporary mount point for the guest is used, but you -can choose a specific one by using the I<--scriptdir> parameter."; +can choose a specific one by using the I<--scriptdir> parameter."); extra_args = [ - ("--scriptdir", Arg.String set_scriptdir, "dir Mount point on host"), - "\ + ("--scriptdir", Arg.String set_scriptdir, s_"dir" ^ " " ^ s_"Mount point on host"), + s_"\ The mount point (an empty directory on the host) used when the C<script> operation is enabled and one or more scripts are specified using I<--script> parameter(s). @@ -145,8 +146,8 @@ B<Note:> C<scriptdir> B<must> be an absolute path. If I<--scriptdir> is not specified then a temporary mountpoint will be created."; - ("--script", Arg.String add_script, "script Script or program to run on guest"), - "\ + ("--script", Arg.String add_script, s_"script" ^ " " ^ s_"Script or program to run on guest"), + s_"\ Run the named C<script> (a shell script or program) against the guest. The script can be any program on the host. The script's current directory will be the guest's root directory. |