|
25 | 25 | # If no mechanism is detected, the user is warned that the ISO may not |
26 | 26 | # support booting from ISO file on USB, and is given alternative options: |
27 | 27 | # - Write ISO directly to USB with dd |
28 | | -# - Use Ventoy in USB emulation mode |
| 28 | +# - Write ISO directly to USB with dd |
29 | 29 | # - Boot from real DVD drive |
30 | 30 | # |
31 | 31 | set -e -o pipefail |
@@ -262,12 +262,30 @@ extract_boot_params_from_cfg() { |
262 | 262 | # ============================================================================ |
263 | 263 | # Main detection flow |
264 | 264 | # ============================================================================ |
265 | | -# Step 1: Scan initrd for supported boot mechanisms |
266 | | -# Step 2: If no boot method found, fall back to cfg file scanning |
| 265 | +# Step 1: Check if ISO is an installer (not bootable from USB file) |
| 266 | +# Step 2: Scan initrd for USB filesystem support and boot mechanisms |
267 | 267 | # Step 3: Check USB filesystem compatibility |
268 | 268 | # Step 4: If no known mechanism found, warn user with guidance |
269 | 269 | # ============================================================================ |
270 | 270 |
|
| 271 | +STATUS "Detecting ISO type..." |
| 272 | +if [ -d "/boot/install.amd" ] || [ -d "/boot/install" ]; then |
| 273 | + if [ -f "/boot/install.amd/vmlinuz" ] || [ -f "/boot/install/vmlinuz" ]; then |
| 274 | + WARN "This appears to be an installer ISO" |
| 275 | + WARN "Installer ISOs do not support booting from ISO file on USB" |
| 276 | + if [ -x /bin/whiptail ]; then |
| 277 | + if ! whiptail_warning --title 'INSTALLER ISO NOT SUPPORTED' --yesno \ |
| 278 | + "This ISO is an installer and does not support booting from ISO file on USB.\n\nInstaller ISOs only work when written directly to USB with dd or when used as a DVD.\n\nTo use this ISO:\n- Linux: sudo cp image.iso /dev/sdX\n- Windows/Mac: Use Rufus in DD mode\n\nDo you want to try anyway?" \ |
| 279 | + 0 80; then |
| 280 | + DIE "Installer ISO - write to USB with dd" |
| 281 | + fi |
| 282 | + else |
| 283 | + INPUT "Installer ISO - may not work from USB file. Try anyway? [y/N]:" -n 1 response |
| 284 | + [ "$response" != "y" ] && [ "$response" != "Y" ] && DIE "Installer ISO - write to USB with dd" |
| 285 | + fi |
| 286 | + fi |
| 287 | +fi |
| 288 | + |
271 | 289 | STATUS "Detecting USB filesystem and boot method support..." |
272 | 290 | SUPPORTED_FSES="" |
273 | 291 | SUPPORTED_BOOT="" |
@@ -312,7 +330,7 @@ if [ -z "$DETECTED_METHODS" ]; then |
312 | 330 | WARN "ISO may not boot from USB file: no supported boot method detected" |
313 | 331 | if [ -x /bin/whiptail ]; then |
314 | 332 | if ! whiptail_warning --title 'ISO BOOT NOT SUPPORTED' --yesno \ |
315 | | - "This ISO does not support booting from ISO file on USB.\n\nThe initrd does not include boot-from-ISO mechanisms (no live-boot, casper, fromiso, iso-scan, anaconda, or nixos support detected).\n\nTo use this ISO, write the hybrid image directly to a USB flash drive:\n\nLinux: sudo cp image.iso /dev/sdX (Be cautious!)\nWindows/Mac: Use Rufus, select DD mode (NOT ISO mode)\n\nWrite to whole-disk device (NOT a partition, e.g. /dev/sdX not /dev/sdX1),\nthen boot from USB device directly (not as ISO file).\n\nSee Debian wiki: https://wiki.debian.org/DebianInstall" \ |
| 333 | + "This ISO does not support booting from ISO file on USB.\n\nThe initrd does not include boot-from-ISO mechanisms (no live-boot, casper, fromiso, iso-scan, anaconda, or nixos support detected).\n\nTo use this ISO, write the hybrid image directly to a USB flash drive:\n\nLinux: sudo cp image.iso /dev/sdX (Be cautious!)\nWindows/Mac: Use Rufus, select DD mode (NOT ISO mode)\n\nWrite to whole-disk device (NOT a partition, e.g. /dev/sdX not /dev/sdX1),\nthen boot from USB device directly (not as ISO file)." \ |
316 | 334 | 0 80; then |
317 | 335 | DIE "ISO boot cancelled - initrd does not support USB file boot" |
318 | 336 | fi |
|
327 | 345 | # ============================================================================ |
328 | 346 | # Boot parameter injection |
329 | 347 | # ============================================================================ |
330 | | -# Inject all known boot-from-ISO parameters. The ISO's initrd will use |
| 348 | +# Inject minimal boot-from-ISO parameters. The ISO's initrd will use |
331 | 349 | # whichever parameters it understands and ignore the rest. |
332 | 350 | # |
333 | | -# Parameters injected (covering all major boot systems): |
334 | | -# - findiso, fromiso, iso-scan/filename: Dracut standard |
335 | | -# - img_dev, img_loop: additional Dracut variants |
336 | | -# - iso: alternative parameter |
337 | | -# - live-media, live-media-path: live-boot parameters |
338 | | -# - boot=live, boot=casper: casper/live-boot parameters |
| 351 | +# We inject iso-scan/filename as the primary parameter - this is |
| 352 | +# the most widely supported boot-from-ISO parameter across distros. |
| 353 | +# Other parameters (findiso, fromiso, img_dev, etc.) are injected |
| 354 | +# as fallback for distros that need them. |
339 | 355 | # ============================================================================ |
340 | 356 |
|
341 | 357 | ISO_DEV="/dev/disk/by-uuid/$DEV_UUID" |
342 | 358 | ISO_PATH_ABS="/$ISO_PATH" |
343 | 359 |
|
344 | | -base_params="findiso=$ISO_DEV/$ISO_PATH fromiso=$ISO_DEV/$ISO_PATH iso-scan/filename=$ISO_PATH_ABS img_dev=$ISO_DEV img_loop=$ISO_PATH iso=$DEV_UUID/$ISO_PATH" |
345 | | - |
346 | | -add_params="" |
347 | | -if echo "$DETECTED_METHODS" | grep -q "casper"; then |
348 | | - add_params="$add_params boot=casper live-media-path=casper" |
349 | | -fi |
350 | | -if echo "$DETECTED_METHODS" | grep -q "boot-live"; then |
351 | | - add_params="$add_params boot=live" |
352 | | -fi |
353 | | -if echo "$DETECTED_METHODS" | grep -q "live-media"; then |
354 | | - add_params="$add_params live-media=$ISO_DEV/$ISO_PATH" |
355 | | -fi |
356 | | - |
357 | | -ADD="$base_params $add_params" |
| 360 | +ADD="iso-scan/filename=$ISO_PATH_ABS findiso=$ISO_DEV/$ISO_PATH fromiso=$ISO_DEV/$ISO_PATH img_dev=$ISO_DEV img_loop=$ISO_PATH iso=$DEV_UUID/$ISO_PATH" |
358 | 361 | DEBUG "Injecting boot params: $ADD" |
359 | 362 | REMOVE="" |
360 | 363 |
|
|
0 commit comments