-
Notifications
You must be signed in to change notification settings - Fork 3
/
package_extras.sh
executable file
·103 lines (80 loc) · 2.69 KB
/
package_extras.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
#package_extras.sh
set -x
set -e
FINAL_DMG=kicad.dmg
FINAL_DMG_DEST=../dmg
NOW=`date +%Y%m%d-%H%M%S`
REVNO=abc
EXTRAS=extras
PACKAGING_DIR=extras_packaging
TEMPLATE=kicad-extras-template.dmg
NEW_DMG=kicad-extras-template.uncompressed.dmg
MOUNTPOINT=mnt
if [ "$#" -eq 1 ]; then
REVNO=$1
elif [ -e notes/libs_revno ]; then
REVNO=`cat notes/libs_revno`
fi
if [ -z "$REVNO" ]; then
echo "First argument represents bzr revno, and must be completely numeric."
exit 1
fi
FINAL_DMG=kicad-extras.$NOW-c4osx.dmg
cd $PACKAGING_DIR
tar xf $TEMPLATE.tar.bz2
cp $TEMPLATE $NEW_DMG
if [ -e $MOUNTPOINT ]; then
rm -r $MOUNTPOINT
fi
mkdir -p $MOUNTPOINT
hdiutil attach $NEW_DMG -noautoopen -mountpoint $MOUNTPOINT
if [ -e $MOUNTPOINT/modules ]; then
rm -r $MOUNTPOINT/modules
fi
cp -r ../$EXTRAS/* $MOUNTPOINT/.
#support/modules is in the base package
#extras/modules is in the extras package
#packages3d is going to move, probably, after 4.0.0, but
#right now, due to OSX packaging stuff, we put it parallel to
#modules, not inside modules
#this causes a problem with defaults, and changing the default
#was ugly, so we're going to do something way, way uglier here
# we are going to make modules, and put a symlink to ../packages3d there
# and we are going to do it inside of extras/modules too.
cd $MOUNTPOINT/modules/
ln -s ../packages3d
cd -
#update background
cp background.png $MOUNTPOINT/.
#rehide background file
SetFile -a V $MOUNTPOINT/background.png
cp README.template $MOUNTPOINT/README.txt
#Update README
echo "" >> $MOUNTPOINT/README.txt
echo "About This Build" >> $MOUNTPOINT/README.txt
echo "================" >> $MOUNTPOINT/README.txt
echo "Packaged on $NOW" >> $MOUNTPOINT/README.txt
echo "Github libraries copied on: r$REVNO" >> $MOUNTPOINT/README.txt
if [ -f ../notes/build_revno ]; then
echo "Build script revision: r`cat ../notes/build_revno`" >> $MOUNTPOINT/README.txt
fi
if bzr revno; then
echo "Packaging script revision: r`bzr revno`" >> $MOUNTPOINT/README.txt
fi
hdiutil detach $MOUNTPOINT
rm -r $MOUNTPOINT
if [ -e $FINAL_DMG ] ; then
rm -r $FINAL_DMG
fi
#set it so it autoopens on download/mount
hdiutil attach $NEW_DMG -noautoopen -mountpoint /Volumes/KiCad\ Extras
bless /Volumes/KiCad\ Extras --openfolder /Volumes/KiCad\ Extras
hdiutil detach /Volumes/KiCad\ Extras
#compress it
#hdiutil convert $NEW_DMG -format UDBZ -imagekey -o $FINAL_DMG #bzip2 based is a little bit smaller, but opens much, much slower.
hdiutil convert $NEW_DMG -format UDZO -imagekey zlib-level=9 -o $FINAL_DMG #This used zlib, and bzip2 based (below) is slower but more compression
rm $NEW_DMG
rm $TEMPLATE #it comes from the tar bz2
mkdir -p $FINAL_DMG_DEST
mv $FINAL_DMG $FINAL_DMG_DEST/.