#!/bin/sh -ex
# make-onecd-iso.sh

sysname=OneCDDebian
outputpath=/iso-output
mkdir -p ${outputpath}

mkdir -p /isolinux
cp -pf /vmlinuz /isolinux
cp -pf /initrd.img /isolinux
cp -pf /usr/lib/syslinux/isolinux.bin /isolinux

cat>/isolinux/isolinux.cfg<<EOT
default vmlinuz
append initrd=initrd.img root=/dev/hdc vga=0x317
prompt 1
say Welcome to ${sysname} linux.
say Select menu or override default boot option or wait 5 seconds.
say eg.) boot: vmlinuz root=/dev/hdb ramdisk_size=192M
say |
say Default boot option: "vmlinuz root=/dev/hdc 0x317"
say Default ramdisk size: 64M
say |
timeout 50
label hdc
  say hdc) Boot from /dev/hdc
  kernel vmlinuz
  append initrd=initrd.img root=/dev/hdc vga=0x317
label hda
  say hda) Boot from /dev/hda
  kernel vmlinuz
  append initrd=initrd.img root=/dev/hda vga=0x317
say |
EOT

mkisofs \
	-V "${sysname}" \
	-R \
	-x ${outputpath} -x /sys -x /proc -x /tmp  \
	-b isolinux/isolinux.bin  -o ${outputpath}/${sysname}.iso \
	-c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table /
