From 929d56a8a331ae4a44cece8a8b652048665c4b94 Mon Sep 17 00:00:00 2001 From: Nick Martin Date: Mon, 27 Feb 2012 22:54:54 -0800 Subject: [PATCH] Don't install to /usr/local when building, install to a tempdir instead. This means we can build as an unprivileged user on linux. --- admin/build-release.sh | 16 +++++++++++----- install.sh | 6 +++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/admin/build-release.sh b/admin/build-release.sh index ff565e701b..27d27a1202 100755 --- a/admin/build-release.sh +++ b/admin/build-release.sh @@ -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 diff --git a/install.sh b/install.sh index bded6a78da..0c94006a21 100755 --- a/install.sh +++ b/install.sh @@ -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"