* Got rid of int_types.h and did a few changes Ipkiss will need. Hope I
[vlc.git] / macosx-dmg
blob03245752f7b606bd22a69919fda56f3364e978cf
1 #!/bin/sh
3 # Posted to the projectbuilder-users list by Mike Ferris
4 # Modified for vlc by Jon Lech Johansen
7 set -e
9 # Requires at least three args
10 if [ $# -lt 3 ] ; then
11 echo "usage: $0 size name file ..." 1>&2
12 exit 1
15 # Grab size and name
16 imgSize=$1
17 shift
18 imgName=$1
19 shift
21 if [ $((${imgSize} < 5)) != 0 ] ; then
22 imgSize=5;
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
38 echo " ${1}"
39 /Developer/Tools/CpMac -r "${1}" "/Volumes/${imgName}"
40 shift
41 done
43 hdiutil eject "${dev}" -quiet
45 # Compress the image
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"
51 # Done
52 echo; echo "Disk image creation completed:"
53 ls -la "${imgName}.dmg"; echo