Improve Discord logging for errors and further fix UEFI mount robustness
This commit is contained in:
@@ -97,11 +97,16 @@ def mount_pseudo_fs(mount_root):
|
||||
target = os.path.join(mount_root, "sys/firmware/efi/efivars")
|
||||
os.makedirs(target, exist_ok=True)
|
||||
try:
|
||||
# Use --bind if already mounted, or mount -t efivarfs
|
||||
# Try bind mount first
|
||||
run_command(["mount", "--bind", efivars_path, target])
|
||||
mounted_paths.append(target)
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to mount efivarfs: {e}")
|
||||
except Exception:
|
||||
try:
|
||||
# Fallback to direct mount
|
||||
run_command(["mount", "-t", "efivarfs", "efivarfs", target])
|
||||
mounted_paths.append(target)
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to mount efivarfs: {e}")
|
||||
|
||||
yield
|
||||
finally:
|
||||
@@ -287,8 +292,17 @@ def configure_system(mount_root, partition_info, user_info=None, disk_device=Non
|
||||
f.write('GRUB_TIMEOUT=5\nGRUB_DISTRIBUTOR="$(sed \'s, release .*$,,g\' /etc/system-release)"\nGRUB_DEFAULT=saved\nGRUB_DISABLE_SUBMENU=true\nGRUB_TERMINAL_OUTPUT="console"\nGRUB_CMDLINE_LINUX="rhgb quiet"\nGRUB_DISABLE_RECOVERY="true"\nGRUB_ENABLE_BLSCFG=true\n')
|
||||
|
||||
if uefi:
|
||||
run_command(["chroot", mount_root, "grub2-install", "--target=x86_64-efi", "--efi-directory=/boot/efi", "--bootloader-id=iridium", "--recheck"])
|
||||
run_command(["chroot", mount_root, "grub2-mkconfig", "-o", "/boot/efi/EFI/iridium/grub.cfg"])
|
||||
efi_dir = "/boot/efi"
|
||||
# Re-verify mount inside chroot if possible, but we already mounted it outside
|
||||
|
||||
logger.info("Installing GRUB2 for UEFI...")
|
||||
# Using --removable can help on some systems that don't like efibootmgr entries
|
||||
# but for now let's stick to standard and add --recheck
|
||||
run_command(["chroot", mount_root, "grub2-install", "--target=x86_64-efi", f"--efi-directory={efi_dir}", "--bootloader-id=iridium", "--recheck"])
|
||||
|
||||
config_path = "/boot/efi/EFI/iridium/grub.cfg"
|
||||
run_command(["chroot", mount_root, "grub2-mkconfig", "-o", config_path])
|
||||
|
||||
# Fedora compatibility link
|
||||
fedora_dir = os.path.join(mount_root, "boot/efi/EFI/fedora")
|
||||
os.makedirs(fedora_dir, exist_ok=True)
|
||||
|
||||
Reference in New Issue
Block a user