#!/bin/sh
#
# build fat16 image for scaleo flash module
#

ISO=/flu/archiv/bootdisks/grml/grml-small_2010.12.iso
FAT=/tmp/ScaleoFlashGrmlSmall2010.12.fat16


ISOMNT=/mnt/0
FATMNT=/mnt/1
DATE=`date +%Y-%m-%d`

dd if=/dev/zero of=$FAT bs=1k count=250368
mkfs.vfat -v -F 16 -n ScaleoGrmlSmall $FAT
syslinux $FAT

mount -o loop,ro $ISO $ISOMNT
mount -o loop $FAT $FATMNT

cp -a $ISOMNT/* $FATMNT
cp -a $ISOMNT/boot/grmlsmall/* $FATMNT
cat << EOI > $FATMNT/syslinux.cfg
# automatically created by $0 on $DATE
default	grml
label	grml
  kernel linux26
  append initrd=initrd.gz boot=live bootid=grmlsmall201012 apm=power-off vga=791 quiet nomce lang=de ssh=grml noautoconfig noprompt
EOI

umount $ISOMNT
umount $FATMNT

gzip --best $FAT

