| #!/bin/bash |
| |
| [ $# != 2 ] && echo missing parameters && exit 1 |
| |
| out=tmp/cd |
| grubcfg=$out/boot/grub/grub.cfg |
| |
| mkdir $out |
| |
| vmlinuzpath=$(xorriso -dev $1 -sh_style_result on -find / -type f -name vmlinuz 2>/dev/null | cut -f2- -d '/') |
| |
| if [ "vmlinuzpath" != "" ]; then |
| # Debian, newer Ubuntu |
| kpath=/`dirname $vmlinuzpath` |
| kname=vmlinuz |
| else |
| # Ubuntu |
| kpath="" |
| kname=linux |
| fi |
| |
| xorriso -dev $1 \ |
| -sh_style_result on \ |
| -osirrox on \ |
| -extract_single /boot/grub/grub.cfg $grubcfg |
| |
| chmod u+w $grubcfg |
| cat <<EOF >>$grubcfg |
| menuentry 'Install preseeded' --id preseed { |
| set background_color=black |
| linux $kpath/$kname auto=true priority=critical file=/cdrom/preseed.cfg --- quiet |
| initrd $kpath/initrd.gz |
| } |
| |
| default=preseed |
| timeout=5 |
| EOF |
| |
| xorriso -indev $1 \ |
| -outdev $2 \ |
| -map $grubcfg /boot/grub/grub.cfg \ |
| -map preseed.cfg /preseed.cfg \ |
| -boot_image any replay |
| |
| chmod -R a+rw $out |
| rm -rf $out |