From: "Richard W.M. Jones" <rjones@redhat.com> Instead of keeping this information as comments in the source, put it into the virt-sysprep(1) man page. (cherry picked from commit 93f8baeb9a07cbbf9bdaa5d10c98c1c9d6af96f7) --- sysprep/Makefile.am | 2 +- sysprep/sysprep_operation.ml | 24 ++++++++++++++++++++++++ sysprep/sysprep_operation.mli | 4 ++++ sysprep/sysprep_operation_bash_history.ml | 4 ++++ sysprep/sysprep_operation_firstboot.ml | 5 +++-- sysprep/sysprep_operation_hostname.ml | 6 ++++++ sysprep/sysprep_operation_ssh_userdir.ml | 4 ++++ sysprep/sysprep_operation_user_account.ml | 4 ++++ sysprep/virt-sysprep.pod | 2 +- 9 files changed, 51 insertions(+), 4 deletions(-) diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am index fce639f..6bc5873 100644 --- a/sysprep/Makefile.am +++ b/sysprep/Makefile.am @@ -1,5 +1,5 @@ # libguestfs virt-sysprep tool -# Copyright (C) 2012 Red Hat Inc. +# Copyright (C) 2012-2013 Red Hat Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/sysprep/sysprep_operation.ml b/sysprep/sysprep_operation.ml index 64a6390..9a41956 100644 --- a/sysprep/sysprep_operation.ml +++ b/sysprep/sysprep_operation.ml @@ -31,6 +31,7 @@ type operation = { enabled_by_default : bool; heading : string; pod_description : string option; + pod_notes : string option; extra_args : ((Arg.key * Arg.spec * Arg.doc) * string) list; perform_on_filesystems : callback option; perform_on_devices : callback option; @@ -40,6 +41,7 @@ let defaults = { enabled_by_default = false; heading = ""; pod_description = None; + pod_notes = None; extra_args = []; perform_on_filesystems = None; perform_on_devices = None; @@ -123,6 +125,20 @@ and check op = op.name; exit 1 ) + ); + (match op.pod_notes with + | None -> () + | Some notes -> + let n = String.length notes in + if n = 0 then ( + eprintf (f_"virt-sysprep: operation %s has no POD notes\n") op.name; + exit 1 + ); + if notes.[n-1] = '\n' then ( + eprintf (f_"virt-sysprep: POD notes for %s must not end with newline\n") + op.name; + exit 1 + ) ) let extra_args () = @@ -147,6 +163,14 @@ let dump_pod () = (match op.pod_description with | None -> () | Some description -> printf "%s\n\n" description + ); + (match op.pod_notes with + | None -> () + | Some notes -> + printf "=head3 "; + printf (f_"Notes on %s") op.name; + printf "\n\n"; + printf "%s\n\n" notes ) ) !all_operations diff --git a/sysprep/sysprep_operation.mli b/sysprep/sysprep_operation.mli index 6b792cd..309ac89 100644 --- a/sysprep/sysprep_operation.mli +++ b/sysprep/sysprep_operation.mli @@ -38,6 +38,10 @@ type operation = { pod_description : string option; (** POD-format long description, used for the man page. *) + pod_notes : string option; + (** POD-format notes, used for the man page to describe any + problems, shortcomings or bugs with this operation. *) + extra_args : ((Arg.key * Arg.spec * Arg.doc) * string) list; (** Extra command-line arguments, if any. eg. The [hostname] operation has an extra [--hostname] parameter. diff --git a/sysprep/sysprep_operation_bash_history.ml b/sysprep/sysprep_operation_bash_history.ml index 56da23e..f9efa47 100644 --- a/sysprep/sysprep_operation_bash_history.ml +++ b/sysprep/sysprep_operation_bash_history.ml @@ -41,6 +41,10 @@ let op = { pod_description = Some (s_"\ Remove the bash history of user \"root\" and any other users who have a C<.bash_history> file in their home directory."); + pod_notes = Some (s_"\ +Currently this only looks in C</root> and C</home/*> for +home directories, so users with home directories in other +locations won't have the bash history removed."); perform_on_filesystems = Some bash_history_perform; } diff --git a/sysprep/sysprep_operation_firstboot.ml b/sysprep/sysprep_operation_firstboot.ml index 7c1c497..d2fc72b 100644 --- a/sysprep/sysprep_operation_firstboot.ml +++ b/sysprep/sysprep_operation_firstboot.ml @@ -67,10 +67,11 @@ configuration that must run in the context of the guest operating system, for example C<yum update>. Output or errors from the scripts are written to -C<~root/virt-sysprep-firstboot.log> (in the guest). +C<~root/virt-sysprep-firstboot.log> (in the guest)."); + pod_notes = Some (s_"\ Currently this is only implemented for Linux guests using -either System V init, or systemd."); +either SysVinit-style scripts, Upstart or systemd."); extra_args = [ ("--firstboot", Arg.String (fun s -> files := s :: !files), diff --git a/sysprep/sysprep_operation_hostname.ml b/sysprep/sysprep_operation_hostname.ml index ec199f5..f880f09 100644 --- a/sysprep/sysprep_operation_hostname.ml +++ b/sysprep/sysprep_operation_hostname.ml @@ -89,17 +89,23 @@ let op = { name = "hostname"; enabled_by_default = true; heading = s_"Change the hostname of the guest"; + pod_description = Some (s_"\ This operation changes the hostname of the guest to the value given in the I<--hostname> parameter. If the I<--hostname> parameter is not given, then the hostname is changed to C<localhost.localdomain>."); + + pod_notes = Some (s_"\ +Currently this can only set the hostname on Linux guests."); + extra_args = [ ("--hostname", Arg.Set_string hostname, s_"hostname" ^ " " ^ s_"New hostname"), s_"\ Change the hostname. If not given, defaults to C<localhost.localdomain>." ]; + perform_on_filesystems = Some hostname_perform; } diff --git a/sysprep/sysprep_operation_ssh_userdir.ml b/sysprep/sysprep_operation_ssh_userdir.ml index 54216f3..59cce9d 100644 --- a/sysprep/sysprep_operation_ssh_userdir.ml +++ b/sysprep/sysprep_operation_ssh_userdir.ml @@ -41,6 +41,10 @@ let op = { pod_description = Some (s_"\ Remove the C<.ssh> directory of user \"root\" and any other users who have a C<.ssh> directory in their home directory."); + pod_notes = Some (s_"\ +Currently this only looks in C</root> and C</home/*> for +home directories, so users with home directories in other +locations won't have the ssh files removed."); perform_on_filesystems = Some ssh_userdir_perform; } diff --git a/sysprep/sysprep_operation_user_account.ml b/sysprep/sysprep_operation_user_account.ml index 0be7772..fc39bc8 100644 --- a/sysprep/sysprep_operation_user_account.ml +++ b/sysprep/sysprep_operation_user_account.ml @@ -66,6 +66,10 @@ let op = { pod_description = Some (s_"\ Remove all the user accounts and their home directories. The \"root\" account is not removed."); + pod_notes = Some (s_"\ +Currently this does not remove the user accounts from +C</etc/shadow>. This is because there is no lens for +the shadow password file in Augeas."); perform_on_filesystems = Some user_account_perform; } diff --git a/sysprep/virt-sysprep.pod b/sysprep/virt-sysprep.pod index 73a3b29..5b4b058 100755 --- a/sysprep/virt-sysprep.pod +++ b/sysprep/virt-sysprep.pod @@ -512,6 +512,6 @@ Wanlong Gao, Fujitsu Ltd. =head1 COPYRIGHT -Copyright (C) 2011-2012 Red Hat Inc. +Copyright (C) 2011-2013 Red Hat Inc. Copyright (C) 2012 Fujitsu Ltd. -- 1.8.3.1