3 # Posted to the projectbuilder-users list by Mike Ferris
4 # Modified for vlc by Jon Lech Johansen
9 # Requires at least three args
10 if [ $# -lt 3 ] ; then
11 echo "usage: $0 size name file ..." 1>&2
21 if [ $
((${imgSize} < 5)) != 0 ] ; then
25 # Create the image and format it
26 rm -f "${imgName}.dmg"
27 echo; echo "Creating ${imgSize} MB disk image named ${imgName}"
28 hdiutil create
"${imgName}.dmg" -megabytes "${imgSize}" -layout NONE
-quiet
29 dev
=`hdid -nomount "${imgName}.dmg" | grep '/dev/disk[0-9]*' | cut -d " " -f 1`
30 /sbin
/newfs_hfs
-w -v "${imgName}" -b 4096 "${dev}" > /dev
/null
31 hdiutil eject
"${dev}" -quiet
33 # Mount the image and copy stuff
34 dev
=`hdid "${imgName}.dmg" | grep '/dev/disk[0-9]*' | cut -d " " -f 1`
36 echo "Copying contents to ${imgName}:"
37 while [ $# -gt 0 ] ; do
39 /Developer
/Tools
/CpMac
-r "${1}" "/Volumes/${imgName}"
43 hdiutil eject
"${dev}" -quiet
46 echo "Compressing ${imgName} disk image"
47 mv "${imgName}.dmg" "${imgName}.orig.dmg"
48 hdiutil convert
"${imgName}.orig.dmg" -format UDZO
-o "${imgName}" -quiet
49 rm "${imgName}.orig.dmg"
52 echo; echo "Disk image creation completed:"
53 ls -la "${imgName}.dmg"; echo