1
mirror of https://code.videolan.org/videolan/vlc synced 2024-10-03 01:31:53 +02:00
vlc/extras/MacOSX/macosx-dmg
Derk-Jan Hartman 866a814965 * moved macosx-dmg to extras/MacOSX/macosx-dmg
* added some macosx files to DIST that were probably missing in the tar ;)
2003-03-24 19:58:42 +00:00

54 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
#
# Posted to the projectbuilder-users list by Mike Ferris
# Modified for vlc by Jon Lech Johansen
#
set -e
# Requires at least three args
if [ $# -lt 3 ] ; then
echo "usage: $0 size name file ..." 1>&2
exit 1
fi
# Grab size and name
imgSize=$1
shift
imgName=$1
shift
if [ $((${imgSize} < 5)) != 0 ] ; then
imgSize=5;
fi
# Create the image and format it
rm -f "${imgName}.dmg"
echo; echo "Creating ${imgSize} MB disk image named ${imgName}"
hdiutil create "${imgName}.dmg" -megabytes "${imgSize}" -layout NONE -quiet
dev=`hdid -nomount "${imgName}.dmg" | grep '/dev/disk[0-9]*' | cut -d " " -f 1`
/sbin/newfs_hfs -w -v "${imgName}" -b 4096 "${dev}" > /dev/null
hdiutil eject "${dev}" -quiet
# Mount the image and copy stuff
dev=`hdid "${imgName}.dmg" | grep '/dev/disk[0-9]*' | cut -d " " -f 1`
echo "Copying contents to ${imgName}:"
while [ $# -gt 0 ] ; do
echo " ${1}"
/Developer/Tools/CpMac -r "${1}" "/Volumes/${imgName}"
shift
done
hdiutil eject "${dev}" -quiet
# Compress the image
echo "Compressing ${imgName} disk image"
mv "${imgName}.dmg" "${imgName}.orig.dmg"
hdiutil convert "${imgName}.orig.dmg" -format UDZO -o "${imgName}" -quiet
rm "${imgName}.orig.dmg"
# Done
echo; echo "Disk image creation completed:"
ls -la "${imgName}.dmg"; echo