This fixes a problem where autotest will always
fail to boot-once any kernels on Ubuntu (12.04,
I assume other Ubuntu versions with grub2 are
also affected).

Ubuntu requires that we run 'update-grub' after
'grub-reboot', otherwise the changes won't be
in effect on next boot. So, update boottool to
execute that in case it's found.

Signed-off-by: Lucas Meneghel Rodrigues <l...@redhat.com>
---
 client/tools/boottool |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/client/tools/boottool b/client/tools/boottool
index 7a1cce1..8631081 100755
--- a/client/tools/boottool
+++ b/client/tools/boottool
@@ -1442,8 +1442,20 @@ class Grubby(object):
                            '%s',' ,'.join(grub_reboot_names))
             return -1
 
-        return self._run_get_return([executable,
-                                     '%s' % entry_index])
+        rc_gr = self._run_get_return([executable, '%s' % entry_index])
+        # If grub-reboot itself failed, return the rc right away
+        if rc_gr:
+            return rc_gr
+
+        # If all went well, on ubuntu we still have to run update-grub
+        # for the changes to be set. If we didn't find it, then let's
+        # just return grub_reboot's rc.
+        update_grub = 'update-grub'
+        executable = find_executable(update_grub)
+        if executable is not None:
+            return self._run_get_return([executable])
+        else:
+            return rc_gr
 
 
     def boot_once_yaboot(self, entry_title):
-- 
1.7.10.2

_______________________________________________
Autotest mailing list
Autotest@test.kernel.org
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to