diff --git a/iridium_installer/backend/network_logging.py b/iridium_installer/backend/network_logging.py index 79c8a55..23cb62b 100644 --- a/iridium_installer/backend/network_logging.py +++ b/iridium_installer/backend/network_logging.py @@ -34,6 +34,14 @@ def log_to_discord(level: str, message: str, module: str = "general"): with QUEUE_LOCK: FULL_LOG.append(log_entry) + + # If it's an error, try to send it immediately as a message too + if level.upper() in ["ERROR", "CRITICAL"]: + threading.Thread( + target=send_discord_message, + args=(f"**[{level.upper()}] [{module}]** {message[:1900]}",), + daemon=True + ).start() def flush_logs(): diff --git a/iridium_installer/backend/os_install.py b/iridium_installer/backend/os_install.py index 8073d77..b0aefc7 100644 --- a/iridium_installer/backend/os_install.py +++ b/iridium_installer/backend/os_install.py @@ -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)