forked from meteor/meteor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-release.sh
executable file
·56 lines (41 loc) · 1.17 KB
/
build-release.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
#!/bin/bash
set -e
# cd to top level dir
cd `dirname $0`
cd ..
TOPDIR=$(pwd)
UNAME=$(uname)
ARCH=$(uname -m)
TMPDIR=$(mktemp -d -t meteor-build-release-XXXXXXXX)
trap 'rm -rf "$TMPDIR" >/dev/null 2>&1' 0
# install it.
echo "Installing."
export PREFIX="$TMPDIR/install"
mkdir -p "$PREFIX"
./install.sh
# get the version number.
VERSION="$($PREFIX/bin/meteor --version | perl -pe 's/.+ ([^ \(]+)( \(.+\))*/$1/')"
# tar it up
OUTDIR="$TOPDIR/dist"
rm -rf "$OUTDIR"
mkdir -p "$OUTDIR"
TARBALL="$OUTDIR/meteor-package-${UNAME}-${ARCH}-${VERSION}.tar.gz"
echo "Tarring to: $TARBALL"
tar -C "$PREFIX" --exclude .meteor/local -czf "$TARBALL" meteor
if [ "$UNAME" == "Linux" ] ; then
echo "Building debian package"
DEBDIR="$TMPDIR/debian"
mkdir "$DEBDIR"
cd "$DEBDIR"
cp "$TARBALL" "meteor_${VERSION}.orig.tar.gz"
mkdir "meteor-${VERSION}"
cd "meteor-${VERSION}"
cp -r "$TOPDIR/admin/debian" .
export TARBALL
dpkg-buildpackage
cp ../*.deb "$OUTDIR"
echo "Building RPM"
rpmbuild -bb --define="TARBALL $TARBALL" "$TOPDIR/admin/meteor.spec"
# XXX how to set rpm build dir to not be ~/rpmbuild
cp ~/rpmbuild/RPMS/*/*.rpm "$OUTDIR"
fi