diff --git a/iridium_installer/backend/os_install.py b/iridium_installer/backend/os_install.py index 16a941e..1e517df 100644 --- a/iridium_installer/backend/os_install.py +++ b/iridium_installer/backend/os_install.py @@ -131,6 +131,8 @@ def install_minimal_os(mount_root, releasever="43"): logger.info(f"Installing Iridium OS to {mount_root} via rsync...") log_os_install("INSTALL", "start", f"Target: {mount_root}") + uefi = is_uefi() + # Exclude list for rsync to avoid copying pseudo-filesystems and temporary data excludes = [ "/dev/*", @@ -148,19 +150,37 @@ def install_minimal_os(mount_root, releasever="43"): "/var/cache/dnf/*", "/etc/fstab", "/etc/hostname", + "/boot/*", # We handle boot separately # Avoid copying the installer data itself if it's in home "domek_na_skale", ] exclude_args = [f"--exclude={ex}" for ex in excludes] + # 1. Main Root Sync # We use -a (archive), -H (hard links), -A (acls), -X (xattrs), -v (verbose), -x (one file system) # --info=progress2 gives a nice summary for logging cmd = ["rsync", "-aHAXvx", "--info=progress2"] + exclude_args + ["/", mount_root] - logger.info("Starting rsync operation...") + logger.info("Starting main rsync operation...") run_command(cmd) + # 2. Boot Sync + # If UEFI, /boot is likely FAT32 which doesn't support symlinks or xattrs + logger.info(f"Syncing /boot (UEFI: {uefi})...") + boot_dst = os.path.join(mount_root, "boot/") + os.makedirs(boot_dst, exist_ok=True) + + if uefi: + # FAT32 friendly: follow links (-L), recursive (-r), preserve times (-t) + # We skip ACLs, xattrs, and hardlinks as they are not supported + boot_cmd = ["rsync", "-rtvL", "--info=progress2", "/boot/", boot_dst] + else: + # BIOS (ext4): standard archive is fine + boot_cmd = ["rsync", "-aHAXvx", "--info=progress2", "/boot/", boot_dst] + + run_command(boot_cmd) + # Ensure essential directories exist for d in ["dev", "proc", "sys", "run", "mnt", "tmp"]: os.makedirs(os.path.join(mount_root, d), exist_ok=True)