#!/bin/sh
#
# Creates a compresses disk image from the current directory
# The resulting dmg file is placed in the parent directory
#
# This script first deletes any fasl files "*fsl"
#
# The volume name of the disk image is the final component
# of the current directory name.
# The file name is the same with ".dmg" appended.

DIRNAME=${PWD##*/}

find . -name "*fsl" -exec rm -f {} \;
hdiutil create -fs HFS+ -srcfolder . -volname ${DIRNAME} ../${DIRNAME}x.dmg
hdiutil convert ../${DIRNAME}x.dmg -format UDBZ -o ../${DIRNAME}.dmg
rm ../${DIRNAME}x.dmg
