forked from andoma/movian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mkdmg
executable file
·26 lines (24 loc) · 689 Bytes
/
mkdmg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh
if [ $# != 4 ]; then
echo "Usage: $0 srcdir volname iconfile dmgfile"
exit
fi
SRCDIR=$1
VOLNAME=$2
ICONFILE=$3
DMGFILE=$4
xcode=`xcode-select -print-path`
rm -f $DMGFILE
hdiutil create -format UDRW -volname $VOLNAME -srcfolder $SRCDIR $DMGFILE
rm -rf tmpmnt
mkdir -p tmpmnt
hdiutil attach $DMGFILE -readwrite -mountroot tmpmnt
ln -s /Applications tmpmnt/$VOLNAME/Applications
cp $ICONFILE tmpmnt/$VOLNAME/.VolumeIcon.icns
${xcode}/Tools/SetFile -c icnC tmpmnt/$VOLNAME/.VolumeIcon.icns
${xcode}/Tools/SetFile -a C tmpmnt/$VOLNAME
hdiutil detach tmpmnt/$VOLNAME
rm -rf tmpmnt
mv $DMGFILE $DMGFILE.UDRW
hdiutil convert $DMGFILE.UDRW -format UDBZ -o $DMGFILE
rm $DMGFILE.UDRW