-
Notifications
You must be signed in to change notification settings - Fork 48
/
mkdmg.sh
executable file
·38 lines (27 loc) · 1.16 KB
/
mkdmg.sh
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
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh
set -e
VOLNAME="Audiobook Binder"
APPNAME=AudiobookBinder
INSTALL_TARGET="AudioBookBinder.app"
INSTALL_SUBTARGET="abbinder"
TARGET_BUILD_DIR=build/Release
VERSION=`grep -A 1 CFBundleShortVersionString AudioBookBinder-Info.plist | tail -1 | sed 's/[^0-9]*>//' | sed 's/<.*//'`
rm -Rf build
xcodebuild -configuration Release -alltargets
if [ -e "/Volumes/$VOLNAME" ]; then
echo "Detaching old $VOLNAME"
hdiutil detach "/Volumes/$VOLNAME"
fi
rm -f "$TARGET_BUILD_DIR/$VOLNAME.dmg" "$TARGET_BUILD_DIR/${VOLNAME}_big.dmg"
# create/attach dmg for distribution
echo "Creating blank DMG"
hdiutil create -size 15000k -volname "$VOLNAME" -attach -fs HFS+ "$TARGET_BUILD_DIR/${VOLNAME}_big.dmg"
cp -R "$TARGET_BUILD_DIR/$INSTALL_TARGET" "/Volumes/$VOLNAME/"
cp "$TARGET_BUILD_DIR/$INSTALL_SUBTARGET" "/Volumes/$VOLNAME/$INSTALL_TARGET/Contents/MacOS/"
cp -R README "Chapters - HowTo.webloc" "/Volumes/$VOLNAME/"
ls -la "/Volumes/$VOLNAME/"
hdiutil detach "/Volumes/$VOLNAME"
echo "Compresing disk image"
rm -f "$APPNAME-$VERSION.dmg"
hdiutil convert -format UDZO -o "$APPNAME-$VERSION.dmg" "$TARGET_BUILD_DIR/${VOLNAME}_big.dmg"
rm -f "$TARGET_BUILD_DIR/${VOLNAME}_big.dmg"