forked from AlloyTeam/Rythem
-
Notifications
You must be signed in to change notification settings - Fork 1
/
publish
executable file
·59 lines (46 loc) · 1.36 KB
/
publish
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
#!/bin/sh
# generate dmg pkg
macdeployqt Rythem.app -dmg
# convert to read-write image
rm Rythem-rw.dmg
hdiutil convert Rythem.dmg -format UDRW -o Rythem-rw.dmg
# open read-write image
tmp=`hdiutil attach -readwrite -noverify -noautoopen Rythem-rw.dmg`;
echo "tmp = $tmp"
# get the opened image's device path and file path
dev=`echo "$tmp" | awk 'END{print $1}'`
# targetDir should be "/Volumne/Rythem 1" or "/Volumn/Rythem"
# if target Dir is number, it should be "/Volumne/Rythem 1"
targetDir=`echo "$tmp" | awk 'END{
match($NF,/^[0-9]+$/)
if( RLENGTH -eq -1 ){
print $NF;
}else{
print $(NF-1),$NF;
}
}'`
echo $targetDir
# save current directory and jump to opened image file path
tmpDir=`pwd`
# make background
# todo http://stackoverflow.com/questions/96882/how-do-i-create-a-nice-looking-dmg-for-mac-os-x-using-command-line-tools
cd "$targetDir"
# make introduce file
echo "copying readme.md"
cp $1/readme.md ./
# link /Applications to the image
echo "linking to Applications"
ln -s /Applications Applications
# make icon
echo "copying icns"
cp $1/Rythem2.icns ./.VolumeIcon.icns
# back
cd $tmpDir
hdiutil detach -force $dev
rm -f Rythem-release.dmg
hdiutil convert Rythem-rw.dmg -format UDZO -o Rythem-release.dmg
mv -f Rythem-release.dmg ~/
rm $2/Rythem-rw.dmg
rm $2/Rythem.dmg
# remove
rm -rf Rythem.app