Skip to content

Commit 8791cf1

Browse files
committed
Fixed detection, lets see if shit works now...
Veuillez saisir le message de validation pour vos modifications. Les lignes commençant par '' seront ignorées, et un message vide abandonne la validation. Sur la branche less-deps-feature-win-tweaks Votre branche est en avance sur 'origin/less-deps-feature-win-tweaks' de 1 commit. (utilisez "git push" pour publier vos commits locaux) Modifications qui seront validées : modifié : src/lufus/gui/gui.py modifié : src/lufus/writing/windows/detect.py
1 parent 7505cc9 commit 8791cf1

2 files changed

Lines changed: 16 additions & 10 deletions

File tree

src/lufus/gui/gui.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,9 @@ def _detect_iso_and_update_ui(self, iso_path: str):
12111211
"""Automatically detect ISO type and update UI selectors."""
12121212
from lufus.writing.windows.detect import detect_iso_type, IsoType
12131213

1214-
if not iso_path.lower().endswith(".iso"):
1214+
# Support various disk image formats, not just .iso
1215+
valid_extensions = (".iso", ".img", ".dmg", ".bin", ".raw")
1216+
if not iso_path.lower().endswith(valid_extensions):
12151217
return
12161218

12171219
self.log_message(f"Detecting ISO type for: {iso_path}...")

src/lufus/writing/windows/detect.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -210,33 +210,36 @@ def _get_file_listing(iso_path: str) -> "str | None":
210210
#
211211
_LINUX_FILE_MARKERS = [
212212
# ---- SysLinux / ISOLINUX (Linux-only bootloaders) ----
213+
"isolinux/isolinux.bin",
213214
"isolinux/isolinux.cfg",
215+
"syslinux/syslinux.bin",
214216
"syslinux/syslinux.cfg",
215217
"syslinux/ldlinux.c32",
216218
# ---- GRUB config files — Linux-only for optical/USB media ----
217219
# Windows uses BCD / bootmgr; it never ships grub.cfg on install media.
218220
"boot/grub/grub.cfg",
219-
"boot/grub/i386-pc/",
221+
"boot/grub/i386-pc",
220222
"grub/grub.cfg",
223+
"boot/grub/x86_64-efi",
221224
# ---- Ubuntu / Kubuntu / Xubuntu / Mint (Casper live system) ----
222225
"casper/filesystem.squashfs",
223226
"casper/filesystem.manifest",
224227
"casper/vmlinuz",
228+
"casper/initrd",
225229
# ---- Debian / Kali / Tails / Parrot (live-boot) ----
226230
"live/filesystem.squashfs",
227231
"live/filesystem.manifest",
228232
"live/vmlinuz",
233+
"live/initrd.img",
229234
# ---- Ubuntu / Debian installer marker ----
230235
".disk/info",
231236
# ---- Arch Linux (specific sub-paths, not the broad "arch/" directory) ----
232237
"arch/pkglist.x86_64.txt",
233238
"arch/boot/x86_64/vmlinuz-linux",
234239
# ---- Fedora / RHEL / CentOS installer (Anaconda) ----
235240
"images/pxeboot/vmlinuz",
241+
"images/pxeboot/initrd.img",
236242
".discinfo",
237-
# ---- Generic kernel presence under known Linux-only directories ----
238-
"boot/vmlinuz",
239-
"boot/bzimage",
240243
]
241244

242245

@@ -290,11 +293,12 @@ def detect_iso_type(iso_path: str) -> IsoType:
290293
log.info("ISO detection: found Windows marker %r -> Windows", marker)
291294
return IsoType.WINDOWS
292295

293-
# Linux markers second — all verified non-overlapping with Windows
294-
for marker in _LINUX_FILE_MARKERS:
295-
if marker in listing:
296-
log.info("ISO detection: found Linux marker %r -> Linux", marker)
297-
return IsoType.LINUX
296+
# Linux markers second — count matches to be more conservative
297+
# Require at least 2 markers to avoid false positives from generic bootloader files
298+
linux_marker_count = sum(1 for marker in _LINUX_FILE_MARKERS if marker in listing)
299+
if linux_marker_count >= 2:
300+
log.info("ISO detection: found %d Linux markers -> Linux", linux_marker_count)
301+
return IsoType.LINUX
298302

299303
log.info("ISO detection: no definitive markers found -> Other")
300304
return IsoType.OTHER

0 commit comments

Comments
 (0)