#!/bin/sh
DIR=$1
SRC=$2
SCRIPT=$DIR/$3
\rm $SCRIPT 2> /dev/null

echo '#!/bin/sh' > $SCRIPT
echo 'vformat '$DIR'/fat32.img > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img '$DIR'/../os/bootsect/es.ldr > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img '$DIR'/es.img > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img '$DIR'/../cmd/squeak-3.7.1/squeak.elf > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img '$SRC'/../cmd/squeak-3.7.1/SqueakV3.sources > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img '$SRC'/../cmd/squeak-3.7.1/Squeak3.7-5989-full.changes > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img '$SRC'/../cmd/squeak-3.7.1/Squeak3.7-5989-full.image > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img '$DIR'/../esjs/esjs.elf > /dev/null' >> $SCRIPT

echo 'vcopy '$DIR'/fat32.img '$SRC'/../esjs/scripts/cat.js > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img '$SRC'/../esjs/scripts/cd.js > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img '$SRC'/../esjs/scripts/clear.js > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img '$SRC'/../esjs/scripts/date.js > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img '$SRC'/../esjs/scripts/echo.js > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img '$SRC'/../esjs/scripts/edit.js > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img '$SRC'/../esjs/scripts/figure.js > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img '$SRC'/../esjs/scripts/gradient.js > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img '$SRC'/../esjs/scripts/ls.js > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img '$SRC'/../esjs/scripts/rm.js > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img '$SRC'/../esjs/scripts/shell.js > /dev/null' >> $SCRIPT

echo 'vcopy '$DIR'/fat32.img '$DIR'/../cmd/hello.elf > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img '$DIR'/../cmd/eventManager.elf > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img '$DIR'/../cmd/console.elf > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img '$DIR'/../cmd/fontconfig.elf > /dev/null' >> $SCRIPT

echo 'vcopy '$DIR'/fat32.img '$SRC'/fonts.conf > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img '$SRC'/fonts.dtd > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img '$SRC'/40-generic.conf conf.d/ > /dev/null' >> $SCRIPT

echo 'vcopy '$DIR'/fat32.img /usr/share/fonts/japanese/TrueType/sazanami-mincho.ttf fonts/ > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img /usr/share/fonts/japanese/TrueType/sazanami-gothic.ttf fonts/ > /dev/null' >> $SCRIPT

echo 'vcopy '$DIR'/fat32.img /usr/share/fonts/liberation/LiberationMono-Bold.ttf fonts/ > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img /usr/share/fonts/liberation/LiberationMono-BoldItalic.ttf fonts/ > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img /usr/share/fonts/liberation/LiberationMono-Italic.ttf fonts/ > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img /usr/share/fonts/liberation/LiberationMono-Regular.ttf fonts/ > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img /usr/share/fonts/liberation/LiberationSans-Bold.ttf fonts/ > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img /usr/share/fonts/liberation/LiberationSans-BoldItalic.ttf fonts/ > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img /usr/share/fonts/liberation/LiberationSans-Italic.ttf fonts/ > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img /usr/share/fonts/liberation/LiberationSans-Regular.ttf fonts/ > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img /usr/share/fonts/liberation/LiberationSerif-Bold.ttf fonts/ > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img /usr/share/fonts/liberation/LiberationSerif-BoldItalic.ttf fonts/ > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img /usr/share/fonts/liberation/LiberationSerif-Italic.ttf fonts/ > /dev/null' >> $SCRIPT
echo 'vcopy '$DIR'/fat32.img /usr/share/fonts/liberation/LiberationSerif-Regular.ttf fonts/ > /dev/null' >> $SCRIPT

echo 'vcopy '$DIR'/fat32.img '$SRC'/1b68cf4fced22970e89022fed6868d03-x86.cache-2 > /dev/null' >> $SCRIPT

echo '' >> $SCRIPT
echo 'echo usage: qemu -hda '$DIR'/fat32.img -serial stdio -soundhw sb16 -net nic,vlan=0 -net tap,vlan=0,ifname=tap0,script=/etc/qemu-ifup' >> $SCRIPT
chmod u+x $SCRIPT
