[Libguestfs] [PATCH] GuestOS: Update XF86Config or xorg.conf as appropriate
Richard W.M. Jones
rjones at redhat.com
Tue May 11 17:54:02 UTC 2010
On Tue, May 11, 2010 at 06:15:05PM +0100, Matthew Booth wrote:
> RHEL 3 has XF86Config instead of xorg.conf. The configs are sufficiently similar
> to be matched by the same augeas lens, so switch based on whichever is present.
> ---
> lib/Sys/VirtV2V/GuestOS/RedHat.pm | 13 ++++++++++++-
> 1 files changed, 12 insertions(+), 1 deletions(-)
>
> diff --git a/lib/Sys/VirtV2V/GuestOS/RedHat.pm b/lib/Sys/VirtV2V/GuestOS/RedHat.pm
> index 1920468..7c41ff6 100644
> --- a/lib/Sys/VirtV2V/GuestOS/RedHat.pm
> +++ b/lib/Sys/VirtV2V/GuestOS/RedHat.pm
> @@ -173,6 +173,17 @@ sub _init_augeas
> "/boot/grub/menu.lst");
> }
>
> + # If we have XF86Config instead of xorg.conf, use that instead.
> + if (! $g->exists('/etc/X11/xorg.conf') &&
> + $g->exists('/etc/X11/XF86Config'))
> + {
> + $g->aug_set('/augeas/load/Xorg/incl[last()+1]',
> + '/etc/X11/XF86Config');
> + $self->{xorg} = '/etc/X11/XF86Config';
> + } else {
> + $self->{xorg} = '/etc/X11/xorg.conf';
> + }
> +
> # Make augeas pick up the new configuration
> $g->aug_load();
> };
> @@ -287,7 +298,7 @@ sub update_display_driver
> # Update the display driver if it exists
> eval {
> foreach my $path
> - ($g->aug_match('/files/etc/X11/xorg.conf/Device/Driver'))
> + ($g->aug_match('/files'.$self->{xorg}.'/Device/Driver'))
> {
> $g->aug_set($path, $driver);
> }
ACK.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v
More information about the Libguestfs
mailing list