[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH 3/4] Update /etc/sysconfig/kernel when updating the kernel



/etc/sysconfig/kernel contains the default kernel package. Ensure we set
DEFAULTKERNEL to whichever kernel we install.

Fixes RHBZ#609526
---
 lib/Sys/VirtV2V/GuestOS/RedHat.pm |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/lib/Sys/VirtV2V/GuestOS/RedHat.pm b/lib/Sys/VirtV2V/GuestOS/RedHat.pm
index a475db8..a322a5d 100644
--- a/lib/Sys/VirtV2V/GuestOS/RedHat.pm
+++ b/lib/Sys/VirtV2V/GuestOS/RedHat.pm
@@ -654,6 +654,23 @@ sub _install_any
 
     my $g = $self->{g};
 
+    # If we're updating the kernel, make sure DEFAULTKERNEL is updated in case
+    # the kernel package has changed
+    if (defined($kernel)) {
+        eval {
+            foreach my $path
+                ($g->aug_match('/files/etc/sysconfig/kernel/DEFAULTKERNEL/value'))
+            {
+                $g->aug_set($path, $kernel->[0]);
+            }
+
+            $g->aug_save();
+        };
+
+        # Propagate augeas errors
+        augeas_error($g, $@) if ($@);
+    };
+
     my $resolv_bak = $g->exists('/etc/resolv.conf');
     $g->mv('/etc/resolv.conf', '/etc/resolv.conf.v2vtmp') if ($resolv_bak);
 
-- 
1.7.2.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]