diff --git a/iridium_installer/backend/os_install.py b/iridium_installer/backend/os_install.py index f8eade6..a0823c2 100644 --- a/iridium_installer/backend/os_install.py +++ b/iridium_installer/backend/os_install.py @@ -132,18 +132,35 @@ def install_minimal_os(mount_root, releasever="43"): ] # Offline installation logic - iso_repo = "/run/install/repo" - dnf_args = [] + possible_repos = [ + "/run/install/repo", + "/run/install/source", + "/mnt/install/repo", + "/run/initramfs/live", + ] - if os.path.exists(iso_repo): + iso_repo = None + for path in possible_repos: + if os.path.exists(os.path.join(path, "repodata")): + iso_repo = path + break + elif os.path.exists(os.path.join(path, "Packages")): + iso_repo = path + break + + dnf_args = [] + if iso_repo: logger.info(f"Found ISO repository at {iso_repo}. Using strictly offline mode.") dnf_args = [ "--disablerepo=*", f"--repofrompath=iridium-iso,{iso_repo}", - "--enablerepo=iridium-iso" + "--enablerepo=iridium-iso", + "--offline", ] else: - logger.warning(f"ISO repository not found at {iso_repo}. Trying to use host config (may require network).") + logger.warning("ISO repository not found in common locations. DNF might try to use network.") + # Try to at least prevent some network usage + dnf_args = ["--setopt=localpkg_only=1", "--offline"] cmd = [ "dnf", @@ -151,10 +168,15 @@ def install_minimal_os(mount_root, releasever="43"): "-y", f"--installroot={mount_root}", f"--releasever={releasever}", - "--use-host-config", "--setopt=install_weak_deps=False", "--nodocs", - ] + dnf_args + packages + ] + + # Only use host config if we didn't find an ISO repo + if not iso_repo: + cmd.append("--use-host-config") + + cmd += dnf_args + packages with mount_pseudo_fs(mount_root): run_command(cmd)