Don't install to /usr/local when building, install to a tempdir instead.

This means we can build as an unprivileged user on linux.
This commit is contained in:
Nick Martin
2012-02-27 22:54:54 -08:00
parent e83acb4aa2
commit 929d56a8a3
2 changed files with 14 additions and 8 deletions

View File

@@ -10,24 +10,30 @@ TOPDIR=$(pwd)
UNAME=$(uname)
ARCH=$(uname -m)
echo "Installing."
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="$(/usr/local/bin/meteor --version | sed 's/.* //')"
VERSION="$($PREFIX/bin/meteor --version | sed 's/.* //')"
# tar it up
TARBALL=~/meteor-package-${UNAME}-${ARCH}-${VERSION}.tar.gz
echo "Tarring to: $TARBALL"
tar -C /usr/local --exclude .meteor/local -czf "$TARBALL" meteor
tar -C "$PREFIX" --exclude .meteor/local -czf "$TARBALL" meteor
if [ "$UNAME" == "Linux" ] ; then
echo "Building debian package"
DEBDIR=$(mktemp -d)
DEBDIR="TMPDIR/debian"
mkdir "$DEBDIR"
cd "$DEBDIR"
cp "$TARBALL" "meteor_${VERSION}.orig.tar.gz"
mkdir "meteor-${VERSION}"
@@ -41,10 +47,10 @@ if [ "$UNAME" == "Linux" ] ; then
echo "Building RPM"
# XXX how to set rpm build dir to not be ~/rpmbuild
rpmbuild -bb --define="TARBALL $TARBALL" "$TOPDIR/admin/meteor.spec"
# XXX
cp ~/rpmbuild/RPMS/*/*.rpm ~
fi

View File

@@ -34,6 +34,6 @@ cp meteor "$TARGET_DIR/bin"
CPR app "$TARGET_DIR"
CPR packages "$TARGET_DIR"
mkdir -p /usr/local/bin
rm -f /usr/local/bin/meteor
ln -s "$TARGET_DIR/bin/meteor" /usr/local/bin/meteor
mkdir -p "$PARENT/bin"
rm -f "$PARENT/bin/meteor"
ln -s "$TARGET_DIR/bin/meteor" "$PARENT/bin/meteor"