#! /bin/sh -x

# This script requires your OS' standard genisoimage package (for mkzftree)
# and a very recent version of mkisofs (provided here).  Your OS' standard
# mkisofs will almost certainly not suffice to make an EFI-bootable CD.

export PATH=/bin:/usr/bin

tar -cf - repc_cd | tar -C /tmp -xf -
rm -f /tmp/repc_cd/install.img
dd if=/srv/releases/repc-4.8.0.img of=/tmp/repc_cd/boot/repcupgr.img \
	bs=1048576 count=64 status=noxfer
mkzftree -F /srv/releases/repc-4.8.0.img /tmp/repc_cd/install.img
$(readlink -f $PWD)/mkisofs -o /tmp/tlxos_repc_installer-4.8.0.iso \
	-r -hide-rr-moved -p 'ThinLinX Pty Ltd' -V 'RePC_480' -z -b \
	boot/isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 \
	-boot-info-table -c boot.cat /tmp/repc_cd
# -eltorito-alt-boot \
#	-eltorito-platform 0xEF -eltorito-boot boot/repcupgr.img \
#	-no-emul-boot /tmp/repc_cd
#xorrisofs -o /tmp/tlxos_repc_installer-4.6.1.iso \
#	-isohybrid-mbr $(readlink -f $PWD)/isohdpfx.bin \
#	-r -hide-rr-moved -p 'ThinLinX Pty Ltd' -V 'RePC_461' -z -b \
#	boot/isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 \
#	-boot-info-table -c boot.cat -eltorito-alt-boot \
#	-e boot/repcupgr.img -no-emul-boot -isohybrid-gpt-basdat \
#	/tmp/repc_cd
#rm -r /tmp/repc_cd
