Skip to content

Commit 8b47e8f

Browse files
committed
Ignore existing installation for upgrade if boot modes don't match
This patch checks that the current installation is not proposed as upgradeable if its boot mode differs from the installer one. This uses the helper function is_rootfs_uefi(). Signed-off-by: Thierry Escande <thierry.escande@vates.tech>
1 parent 9b52514 commit 8b47e8f

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

product.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ def isUpgradeable(self):
7575
self.mount_state()
7676
result = True
7777
try:
78+
# Don't propose to upgrade a BIOS installation with a UEFI installer and conversely
79+
existing_is_uefi = is_rootfs_uefi(self.join_state_path())
80+
if existing_is_uefi != constants.UEFI_INSTALLER:
81+
logger.log("Cannot upgrade %s, installer mode (%s) does not match existing boot mode (%s)" %
82+
(self.primary_disk,
83+
"uefi" if constants.UEFI_INSTALLER else "legacy",
84+
"uefi" if existing_is_uefi else "legacy"))
85+
return False
86+
7887
# CA-38459: handle missing firstboot directory e.g. Rio
7988
if os.path.exists(self.join_state_path('etc/firstboot.d/state')):
8089
firstboot_files = [ f for f in os.listdir(self.join_state_path('etc/firstboot.d')) \

0 commit comments

Comments
 (0)