redhat-upgrade-tool/SOURCES/0006-Do-not-rename-grub-con...

73 lines
3.3 KiB
Diff

From 464fbb06a2e46b1ac91babf82c3ced6cbc14a405 Mon Sep 17 00:00:00 2001
From: Petr Stodulka <pstodulk@redhat.com>
Date: Fri, 31 Jul 2020 15:18:06 +0200
Subject: [PATCH] Do not rename grub config file
Update of the previous solution. In case the BIOS and EFI grub conf
files exist, the one that is not expected to be used will not be
renamed, but kept as it is. Instead, we print warnings and update
boom to orient with the same logic as r-u-t.
---
boom-0.8/boom/legacy.py | 5 ++++-
redhat_upgrade_tool/__init__.py | 7 ++++---
redhat_upgrade_tool/rollback/bootloader.py | 7 ++++---
3 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/boom-0.8/boom/legacy.py b/boom-0.8/boom/legacy.py
index 53cf939..6d4464b 100644
--- a/boom-0.8/boom/legacy.py
+++ b/boom-0.8/boom/legacy.py
@@ -36,9 +36,12 @@ BOOM_LEGACY_END_FMT="#--- BOOM_%s_END ---"
#: Constants for legacy boot loaders supported by boom
BOOM_LOADER_GRUB1="grub1"
BOOM_GRUB1_CFG_PATH="grub/grub.conf"
-if not path_exists(path_join("/boot/", BOOM_GRUB1_CFG_PATH)):
+if path_exists("/sys/firmware/efi"):
BOOM_GRUB1_CFG_PATH="efi/EFI/redhat/grub.conf"
+if not path_exists(path_join("/boot/", BOOM_GRUB1_CFG_PATH)):
+ raise BoomLegacyLoaderError("Could not execute grub1 shell.")
+
# Module logging configuration
_log = logging.getLogger(__name__)
diff --git a/redhat_upgrade_tool/__init__.py b/redhat_upgrade_tool/__init__.py
index 9e1fecd..48ef27e 100644
--- a/redhat_upgrade_tool/__init__.py
+++ b/redhat_upgrade_tool/__init__.py
@@ -102,9 +102,10 @@ def detect_grub_conf():
os.remove(_non_grub_file)
else:
# this is really weird when it happens
- print "WARNING: Detected two grub configuration files, but only one can exist"
- print "WARNING: Moving {fname} to {fname}.preupg_rollback_backup".format(fname=_non_grub_file)
- shutil.move(_non_grub_file, "{}.preupg_rollback_backup".format(_non_grub_file))
+ print "WARNING: Detected two grub configuration files, but only one should exist"
+ print "WARNIng: Ignoring the {} config file.".format(_non_grub_file)
+ # rather do not move this file...
+ # shutil.move(_non_grub_file, "{}.preupg_rollback_backup".format(_non_grub_file))
return grub_conf_file
diff --git a/redhat_upgrade_tool/rollback/bootloader.py b/redhat_upgrade_tool/rollback/bootloader.py
index 2f605ff..bad16d1 100644
--- a/redhat_upgrade_tool/rollback/bootloader.py
+++ b/redhat_upgrade_tool/rollback/bootloader.py
@@ -40,9 +40,10 @@ except ImportError:
os.remove(_non_grub_file)
else:
# this is really weird when it happens
- print "WARNING: Detected two grub configuration files, but only one can exist"
- print "WARNING: Moving {fname} to {fname}.preupg_rollback_backup".format(fname=_non_grub_file)
- shutil.move(_non_grub_file, "{}.preupg_rollback_backup".format(_non_grub_file))
+ print "WARNING: Detected two grub configuration files, but only one should exist"
+ print "WARNIng: Ignoring the {} config file.".format(_non_grub_file)
+ # rather do not move this file out
+ # shutil.move(_non_grub_file, "{}.preupg_rollback_backup".format(_non_grub_file))
def check_call(*popenargs, **kwargs):
retcode = call(*popenargs, **kwargs)
--
2.25.4