[Libguestfs] [PATCH] GuestOS: Update XF86Config or xorg.conf as appropriate

Matthew Booth mbooth at redhat.com
Tue May 11 17:15:05 UTC 2010


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);
         }
-- 
1.6.6.1




More information about the Libguestfs mailing list