I suggest to modify the CD detect script in initrd, it has no effect on the existing install methods, but with this modification the user will be able to put more installer to the same USB device and after booting from the USB device he can choose in grub2 menu the one what he want to install.
i suggest to add the following inside the initrd (install/initrd.gz) to file var/lib/dpkg/info/cdrom-detect.postinst right after the installer logs that it's searching for the installation media:
if db_get cdrom-detect/custom-usb && [ "$RET" = true ] && db_get cdrom-detect/uuid && db_get cdrom-detect/fs && db_get cdrom-detect/path; then
if mount -t $fs -o ro,exec $device /media/custom_USB && mount --bind /media/custom_USB/$path /cdrom 2>/dev/null; then
if [ -e /cdrom/.disk/info ]; then
log "CD-ROM mount suceeded: directory on custom USB drive"
mounted=1
db_set cdrom-detect/cdrom_device $device
db_set cdrom-detect/cdrom_fs $fs
break
else
log "CD-ROM mount failed: directory on custom USB drive"
umount /cdrom 2>/dev/null || true
umount /media/custom_USB 2>/dev/null || true
rmdir /media/custom_USB
fi
else
log "Mount of the directory on custom USB drive failed."
fi
fi
In this case the installer will mount that directory what contains the content of the unpacked ISO if the kernel got the neccessary parameters from grub2.
Example for the grub2 config entry:
menuentry "Ubuntu 10.04.4 Alternate 64-bit"
linux /boot/ubuntu/ubuntu-10.04.4-alternate-amd64/install/vmlinuz root=UUID=2338807b-3bb0-4372-b00d-a4b59dcc6d25 file=/cdrom/preseed/ubuntu.seed cdrom-detect/custom-usb=true cdrom-detect/uuid=2338807b-3bb0-4372-b00d-a4b59dcc6d25 cdrom-detect/fs=ext2 cdrom-detect/path=boot/ubuntu/ubuntu-10.04.4-alternate-amd64 quiet --
initrd /boot/ubuntu/ubuntu-10.04.4-alternate-amd64/install/initrd.gz
cdrom-detect/custom-usb should be true.
cdrom-detect/uuid should be the UUID of the partition what contains the unpacked ISO.
cdrom-detect/fs should be the file system type of the partition what contains the unpacked ISO.
cdrom-detect/path should be relative path (from the USB flash device) what contains the unpacked ISO.
The advantages of this method:
- User will be able to choose the installer what he wants to start from a single USB flash drive (or external HDD)
- It doesn't affect the existing installation methods
- no other software is needed in initrd (like awk what has other dependecies)
- The installer is portable, only grub2 config needs to be rewritten if the user re-format the USB device or copy the installer to another device
- it increases the installer by less than 1 kB
I don't see any disadvantage for this method.
Before this post I already uploaded this idea to Hungarian Ubuntu blog, you can see the formatted codes there:
http://ubuntu.hu/node/29874