From 325962a7156060a12f95604fbb6fc02ba96be544 Mon Sep 17 00:00:00 2001 From: Radiump123 Date: Sat, 9 May 2026 14:53:01 -0400 Subject: [PATCH 1/2] Removed deps.md, forgot this artifact when I made the PR. --- deps.md | 83 --------------------------------------------------------- 1 file changed, 83 deletions(-) delete mode 100644 deps.md diff --git a/deps.md b/deps.md deleted file mode 100644 index 59ac1da..0000000 --- a/deps.md +++ /dev/null @@ -1,83 +0,0 @@ -# Lufus External Dependencies (Non-Python) - -## System Privileges -- pkexec (polkit) -- sudo -- runuser (util-linux) - -## Flashing & Imaging -- dd (coreutils) -- sync (coreutils) -- cp (coreutils) -- rm (coreutils) -- mkdir (coreutils) - -## Partitioning & Disk Info -- lsblk (util-linux) -- parted -- sfdisk (util-linux) -- partprobe (parted) -- udevadm (systemd/udev) -- wipefs (util-linux) -- blockdev (util-linux) -- badblocks (e2fsprogs) - -## Filesystem Tools -- mkfs.vfat, fatlabel (dosfstools) -- mkfs.exfat (exfatprogs or exfat-utils) -- mkfs.ntfs / mkntfs, ntfslabel (ntfs-3g) -- mkfs.ext4, e2label (e2fsprogs) -- mkudffs, udflabel (udftools) - -## Mounting & ISO Handling -- mount (util-linux) -- umount (util-linux) -- 7z (p7zip-full) - Used for Windows ISO detection -- isoinfo (genisoimage) - Fallback for Windows ISO detection - -## Process & System Management -- lsof -- fuser (psmisc) -- pgrep (procps) -- which (debianutils or similar) -- stty (coreutils) -- xdg-user-dir (xdg-user-dirs) -- xdg-open (xdg-utils) - -## Windows Image Operations (WIM) -- wimlib-imagex (wimlib / wimtools) -- wimmountrw (wimlib) -- wimunmount (wimlib) - -## Bootloader Installation -- grub-install (grub2 / grub-common) - -## GUI & System Libraries (PyQt6 Requirements) -- libgl1 -- libx11-6 -- libxcb1 -- libxrender1 -- fontconfig -- libfreetype6 -- libxext6 -- libxrandr2 -- libxcursor1 -- libxi6 -- libxfixes3 -- libxcomposite1 -- libxdamage1 - -## Package Managers (Used for auto-installing missing tools) -- apt-get (Debian/Ubuntu) -- dnf (Fedora/RHEL) -- pacman (Arch) -- zypper (openSUSE) - -## Python Environment -- python3 -- python3-pip -- python3-venv - -## Other (from requirements-system.txt) -- wget -- file From 6ab0c2baf27ef38f7fc353eae04c01ed15321033 Mon Sep 17 00:00:00 2001 From: Radiump123 Date: Sat, 9 May 2026 15:55:02 -0400 Subject: [PATCH 2/2] =?UTF-8?q?Fallbacked=20some=20untested=20changes.=20?= =?UTF-8?q?=20Veuillez=20saisir=20le=20message=20de=20validation=20pour=20?= =?UTF-8?q?vos=20modifications.=20Les=20lignes=20=20commen=C3=A7ant=20par?= =?UTF-8?q?=20''=20seront=20ignor=C3=A9es,=20et=20un=20message=20vide=20ab?= =?UTF-8?q?andonne=20la=20validation.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sur la branche dev Votre branche est à jour avec 'origin/dev'. Modifications qui seront validées : modifié : install_ventoy.py modifié : windows/flash.py modifié : windows/tweaks.py --- src/lufus/writing/install_ventoy.py | 2 +- src/lufus/writing/windows/flash.py | 38 +++++++++-------------------- src/lufus/writing/windows/tweaks.py | 10 +++----- 3 files changed, 17 insertions(+), 33 deletions(-) diff --git a/src/lufus/writing/install_ventoy.py b/src/lufus/writing/install_ventoy.py index 16cb6de..1171d8a 100644 --- a/src/lufus/writing/install_ventoy.py +++ b/src/lufus/writing/install_ventoy.py @@ -162,7 +162,7 @@ def install_grub(target_device: str) -> bool: # Refresh kernel table subprocess.run(["partprobe", target_device], check=False) subprocess.run(["udevadm", "settle"], check=False) - os.sync() + subprocess.run(["sync"], check=True) # Wait for device nodes to be created by udev efi_part = f"{target_device}{sep}2" diff --git a/src/lufus/writing/windows/flash.py b/src/lufus/writing/windows/flash.py index 690915f..a68895f 100644 --- a/src/lufus/writing/windows/flash.py +++ b/src/lufus/writing/windows/flash.py @@ -71,12 +71,12 @@ def _fix_efi_bootloader(efi_mount): log.info("EFI bootloader fix: BOOTX64.EFI not found, will attempt to create at %s", boot_dir) bootx64 = os.path.join(boot_dir, "BOOTX64.EFI") - os.makedirs(boot_dir, exist_ok=True) + run_cmd(["sudo", "mkdir", "-p", boot_dir]) log.info("EFI bootloader fix: created directory %s", boot_dir) src = _find_path_case_insensitive(efi_mount, "EFI", "Microsoft", "Boot", "bootmgfw.efi") if src: - shutil.copy2(src, bootx64) + run_cmd(["sudo", "cp", src, bootx64]) log.info("EFI bootloader fix: copied %s -> %s", src, bootx64) return @@ -155,7 +155,7 @@ def _copy_file(src: str, dst: str) -> str: def _find_ntfs_tool(status_cb=None) -> str | None: """Find mkfs.ntfs/mkntfs, installing ntfs-3g if needed. Returns command name or None.""" for candidate in ["mkfs.ntfs", "mkntfs"]: - if shutil.which(candidate): + if subprocess.run(["which", candidate], capture_output=True).returncode == 0: return candidate if status_cb: @@ -167,13 +167,13 @@ def _find_ntfs_tool(status_cb=None) -> str | None: ["zypper", "install", "-y", "ntfs-3g"], ] for pm_cmd in pkg_managers: - if shutil.which(pm_cmd[0]): + if subprocess.run(["which", pm_cmd[0]], capture_output=True).returncode == 0: run_cmd(["sudo"] + pm_cmd) break # stop after the first working package manager # Re-check after installation attempt for candidate in ["mkfs.ntfs", "mkntfs"]: - if shutil.which(candidate): + if subprocess.run(["which", candidate], capture_output=True).returncode == 0: return candidate # installation succeeded return None @@ -181,7 +181,7 @@ def _find_ntfs_tool(status_cb=None) -> str | None: def _ensure_wimlib(status_cb=None) -> None: """Install wimlib-imagex if not present. Raises FileNotFoundError if it can't be found after install.""" - if shutil.which("wimlib-imagex"): + if subprocess.run(["which", "wimlib-imagex"], capture_output=True).returncode == 0: return if status_cb: status_cb("wimlib-imagex not found, attempting to install...") @@ -192,10 +192,10 @@ def _ensure_wimlib(status_cb=None) -> None: ["zypper", "install", "-y", "wimtools"], ] for pm_cmd in pkg_managers: - if shutil.which(pm_cmd[0]): + if subprocess.run(["which", pm_cmd[0]], capture_output=True).returncode == 0: run_cmd(["sudo"] + pm_cmd) break - if not shutil.which("wimlib-imagex"): + if subprocess.run(["which", "wimlib-imagex"], capture_output=True).returncode != 0: raise FileNotFoundError( "wimlib-imagex not found. Install manually: sudo pacman -S wimlib / sudo apt install wimtools" ) @@ -271,34 +271,20 @@ def _copy_efi_boot_files(iso_mount, mount_efi, _status): if efi_src: efi_items = os.listdir(efi_src) _status(f"Found EFI/ with {len(efi_items)} items: {efi_items}") - for item in efi_items: - src_path = os.path.join(efi_src, item) - dst_path = os.path.join(mount_efi, "EFI", item) - if os.path.isdir(src_path): - shutil.copytree(src_path, dst_path, dirs_exist_ok=True) - else: - os.makedirs(os.path.dirname(dst_path), exist_ok=True) - shutil.copy2(src_path, dst_path) + run_cmd(["sudo", "cp", "-r"] + [os.path.join(efi_src, i) for i in efi_items] + [mount_efi]) _status("Copied EFI/ tree to EFI partition") else: _status("WARNING: No EFI directory found in ISO - drive may not be UEFI bootable") boot_src = _find_path_case_insensitive(iso_mount, "boot") if boot_src: - for item in os.listdir(boot_src): - src_path = os.path.join(boot_src, item) - dst_path = os.path.join(mount_efi, "boot", item) - if os.path.isdir(src_path): - shutil.copytree(src_path, dst_path, dirs_exist_ok=True) - else: - os.makedirs(os.path.dirname(dst_path), exist_ok=True) - shutil.copy2(src_path, dst_path) + run_cmd(["sudo", "cp", "-r"] + [os.path.join(boot_src, i) for i in os.listdir(boot_src)] + [mount_efi]) _status("Copied boot/ tree to EFI partition") for fname in ["bootmgr", "bootmgr.efi"]: src = _find_path_case_insensitive(iso_mount, fname) if src: - shutil.copy2(src, os.path.join(mount_efi, fname)) + run_cmd(["sudo", "cp", src, f"{mount_efi}/{fname}"]) _status(f"Copied {fname} to EFI partition root") _fix_efi_bootloader(mount_efi) @@ -426,7 +412,7 @@ def _status(msg): # Step 7: Sync _status("Syncing all writes to disk...") - os.sync() + run_cmd(["sudo", "sync"]) _emit(97) _status("Sync complete") diff --git a/src/lufus/writing/windows/tweaks.py b/src/lufus/writing/windows/tweaks.py index fe3daac..095e78a 100644 --- a/src/lufus/writing/windows/tweaks.py +++ b/src/lufus/writing/windows/tweaks.py @@ -1,4 +1,3 @@ -# Not tested, at least by me, I don't remember when that was added, and never used it nor really know what it's supposed to do. """Windows installation customization functions. These modify Windows installation media (boot.wim, autounattend.xml) @@ -10,7 +9,6 @@ import re import subprocess import os -import shutil from lufus.utils import get_mount_and_drive from lufus import state from lufus.lufus_logging import get_logger @@ -56,7 +54,7 @@ def win_hardware_bypass(): cmd_string = "\n".join(commands) + "\n" log.info("win_hardware_bypass: injecting registry keys into boot.wim at %s...", mount) try: - os.makedirs("/media/tempwinmnt", exist_ok=True) + subprocess.run(["mkdir", "/media/tempwinmnt"], check=True) subprocess.run(["wimmountrw", f"{mount}/sources/boot.wim", "2", "/media/tempwinmnt"], check=True) subprocess.run( ["chntpw", "e", "/media/tempwinmnt/Windows/System32/config/SYSTEM"], @@ -66,7 +64,7 @@ def win_hardware_bypass(): check=True, ) subprocess.run(["wimunmount", "/media/tempwinmnt", "--commit"], check=True) - shutil.rmtree("/media/tempwinmnt", ignore_errors=True) + subprocess.run(["rm", "-rf", "/media/tempwinmnt"], check=True) log.info("win_hardware_bypass: registry keys injected successfully.") except subprocess.CalledProcessError as e: log.error("win_hardware_bypass: CalledProcessError: %s", e.stderr) @@ -81,7 +79,7 @@ def win_local_acc(): cmd_string = "\n".join(commands) + "\n" log.info("win_local_acc: bypassing online account requirement at %s...", mount) try: - os.makedirs("/media/tempwinmnt", exist_ok=True) + subprocess.run(["mkdir", "/media/tempwinmnt"], check=True) subprocess.run(["wimmountrw", f"{mount}/sources/boot.wim", "2", "/media/tempwinmnt"], check=True) subprocess.run( ["chntpw", "e", "/media/tempwinmnt/Windows/System32/config/SOFTWARE"], @@ -91,7 +89,7 @@ def win_local_acc(): check=True, ) subprocess.run(["wimunmount", "/media/tempwinmnt", "--commit"], check=True) - shutil.rmtree("/media/tempwinmnt", ignore_errors=True) + subprocess.run(["rm", "-rf", "/media/tempwinmnt"], check=True) log.info("win_local_acc: online account bypass applied successfully.") except subprocess.CalledProcessError as e: log.error("win_local_acc: CalledProcessError: %s", e.stderr)