forked from aehlke/manabi-dict
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-dmg.sh
executable file
·78 lines (59 loc) · 1.79 KB
/
make-dmg.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh
# Makes the DMG with all the nice things already setup.
# Most of the Finder window twiddling is done by an applescript, this just does
# the DMG manipulations.
# This script should be run with the working directory as the top level (where
# the dist folder appears)
if [ ! -d "dist" ]
then
echo "This must be run in the same directory as 'dist'."
exit 1
fi
if [ -d "/Volumes/ManabiDictionary" ]
then
echo "You already have one ManabiDictionary mounted, unmount it first!"
exit 1
fi
echo --- Configuring 'dist' folder...
if [ ! -e "dist/Applications" ]
then
ln -s /Applications dist/Applications
fi
#if [ ! -d "dist/.background" ]
#then
# mkdir dist/.background
# cp ankiqt/mac/anki-logo-bg.png dist/.background
#fi
#if [ ! -f "dist/.DS_Store" ]
#then
# cp ankiqt/mac/dmg_ds_store dist/.DS_Store
#fi
echo --- Creating writable DMG...
hdiutil create -attach -ov -format UDRW -volname ManabiDictionary -srcfolder dist -o ManabiDictionary-rw.dmg
RESULT=$?
if [ $RESULT != 0 ]
then
echo "Creating RW DMG failed! ($RESULT)"
exit 1
fi
#echo --- Running applescript to configure view settings...
#osascript "ankiqt/mac/set-dmg-settings.scpt"
echo --- Unmounting and converting to RO DMG...
hdiutil detach "/Volumes/ManabiDictionary"
if [ -d "/Volumes/ManabiDictionary" ]
then
echo "+++ Waiting for drive to detach..."
sleep 5
hdiutil detach "/Volumes/ManabiDictionary"
fi
if [ -d "/Volumes/ManabiDictionary" ]
then
echo "!!! Warning: Drive didn't detach cleanly forcing it to detach.."
sleep 5
hdiutil detach -force "/Volumes/ManabiDictionary"
fi
echo --- Making final compressed DMG...
hdiutil convert "ManabiDictionary-rw.dmg" -ov -format UDZO -imagekey zlib-level=9 -o ManabiDictionary.dmg
RESULT=$?
rm ManabiDictionary-rw.dmg
exit $RESULT