-
Notifications
You must be signed in to change notification settings - Fork 25
/
make_dmg
executable file
·91 lines (79 loc) · 2.05 KB
/
make_dmg
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
#!/bin/sh
#
OSX_DIR="`pwd`/osx_resources"
OSX_TMP_INSTALL="$OSX_DIR/install"
VERSION=`cat version.txt`
VERSION_MAJOR=`cut -f 1 -d . version.txt`
VERSION_MINOR=`cut -f 2 -d . version.txt`
case `uname -p` in
powerpc)
ARCH=ppc;;
*)
ARCH=x86;;
esac
OMAKE_BASE=OMake-$VERSION-$ARCH
usage () {
echo "Usage: $0 ( all | install | pkg | dmg | clean | upload )"
echo " '$0 all' is equivalent to"
echo " '$0 install; $0 pkg; $0 dmg'"
exit 1
}
mkinstall () {
set -x
sudo rm -rf $OSX_TMP_INSTALL || exit 1
INSTALL_ROOT=$OSX_TMP_INSTALL make install || exit 1
# Install the html docs -- there's no omake target for it yet
mkdir -p $OSX_TMP_INSTALL/usr/local/share/doc/omake
cp -r doc/html/ $OSX_TMP_INSTALL/usr/local/share/doc/omake
rm -rf `find $OSX_TMP_INSTALL/usr/local/share/doc/omake -name .svn`
sudo chown -R root:wheel $OSX_TMP_INSTALL/usr || exit 1
}
pkg () {
set -x
year=`date "+%Y"`
cat $OSX_DIR/Info.plist.in \
| sed "s/##Version##/$VERSION/g" \
| sed "s/##Year##/$year/g" \
| sed "s/##MajorVersion##/$VERSION_MAJOR/g" \
| sed "s/##MinorVersion##/$VERSION_MINOR/g" \
> $OSX_DIR/Info.plist
packagemaker -build -p $OMAKE_BASE.pkg \
-f $OSX_TMP_INSTALL/usr/local \
-i $OSX_DIR/Info.plist \
-d $OSX_DIR/Description.plist \
-r $OSX_DIR/installer_files
}
dmg () {
set -x
rm -f $OMAKE_BASE.dmg
hdiutil create -srcfolder ./$OMAKE_BASE.pkg $OMAKE_BASE.dmg
}
clean () {
cd $OSX_DIR
sudo rm -rf Info.plist $OMAKE_BASE.pkg $OMAKE_BASE.dmg install || exit 1
}
upload () {
set -x
scp $OMAKE_BASE.dmg n0bu.com:/home/mojave/public_html/download/omake/
}
if [ "$#" -lt "1" ]; then
usage
else
case $1 in
all)
mkinstall
pkg
dmg
;;
install)
mkinstall
;;
pkg|dmg|clean|upload)
$1
;;
*)
echo "No such target: $1"
usage
;;
esac
fi