From 7c6a41b5f14038e7eec27086f56ed4c27bc594ab Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Thu, 1 Oct 2015 09:17:46 +1000 Subject: [PATCH 01/48] Check for existence of ROOT_URL in the same way as MONGO_URL --- bin/release | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bin/release b/bin/release index 2520fc2..17f33e1 100755 --- a/bin/release +++ b/bin/release @@ -17,10 +17,12 @@ extract_mongo_url() { } extract_root_url() { - #echo "Pulling ROOT_URL from VCAP_APPLICATION" - DOMAIN=`echo $VCAP_APPLICATION | $jq '.uris[0]' | sed -e 's/^"//' -e 's/"$//'` - export ROOT_URL="http://$DOMAIN" - #echo "ROOT_URL: $ROOT_URL" + if [ -z "${ROOT_URL}" ]; then + #echo "Pulling ROOT_URL from VCAP_APPLICATION" + DOMAIN=`echo $VCAP_APPLICATION | $jq '.uris[0]' | sed -e 's/^"//' -e 's/"$//'` + export ROOT_URL="http://$DOMAIN" + #echo "ROOT_URL: $ROOT_URL" + fi } extract_mongo_url From d6fa1f3346bbd9b335de5a9c60eafe81dcb4f360 Mon Sep 17 00:00:00 2001 From: Ash Austin Date: Thu, 1 Oct 2015 16:03:25 +1000 Subject: [PATCH 02/48] Added logic to extract COUCHDB_URL from VCAP_SERVICES --- bin/release | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bin/release b/bin/release index 17f33e1..3d024af 100755 --- a/bin/release +++ b/bin/release @@ -25,8 +25,17 @@ extract_root_url() { fi } +extract_couchdb_url() { + if [ -z "${COUCHDB_URL}" ]; then + #echo "Pulling COUCHDB_URL from VCAP_SERVICES" + # Find the first service key that contains "cloudant", then grab the 'url' (or 'uri') key beneath it. + export COUCHDB_URL=`echo $VCAP_SERVICES | $jq 'to_entries|map(select(.key|contains("cloudant")))[0]|.value[0].credentials|if .url then .url else .uri end|. // empty'` + fi +} + extract_mongo_url extract_root_url +extract_couchdb_url cat <<-YAML --- From 7b9948e472eb87d933a0fb1fec747eaf2e52fa3a Mon Sep 17 00:00:00 2001 From: Ash Austin Date: Thu, 1 Oct 2015 16:30:37 +1000 Subject: [PATCH 03/48] Forgot to put the variable in the latest git push! n00b. --- bin/release | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/release b/bin/release index 3d024af..94d8511 100755 --- a/bin/release +++ b/bin/release @@ -40,5 +40,5 @@ extract_couchdb_url cat <<-YAML --- default_process_types: - web: MONGO_URL=$MONGO_URL ROOT_URL=$ROOT_URL vendor/node/bin/node deploy/bundle/main.js + web: MONGO_URL=$MONGO_URL COUCHDB_URL=$COUCHDB_URL ROOT_URL=$ROOT_URL vendor/node/bin/node deploy/bundle/main.js YAML From 52c8d0b0512abe3596e3e82fe6a5aed51996f7ab Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Mon, 5 Oct 2015 10:43:16 +1100 Subject: [PATCH 04/48] Try using profile.d --- bin/compile | 10 ++++++++++ bin/release | 35 +---------------------------------- profile/env.sh | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 34 deletions(-) create mode 100644 profile/env.sh diff --git a/bin/compile b/bin/compile index b2d63e9..de679bd 100755 --- a/bin/compile +++ b/bin/compile @@ -4,6 +4,7 @@ BUILD_DIR=$1 CACHE_DIR=$2 METEOR_HOME=$BUILD_DIR/.meteor/local PATH=$METEOR_HOME/usr/bin:$METEOR_HOME/usr/lib/meteor/bin:$PATH +BP_DIR=$(cd $(dirname ${0:-}); cd ..; pwd) indent() { c='s/^/ /' @@ -86,6 +87,15 @@ install_node install_meteor build +DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) + +cp $DIR/jq $BUILD_DIR/.vendor +chmod +x $BUILD_DIR/.vendor + +mkdir -p $BUILD_DIR/.profile.d + +cp $BP_DIR/* $BUILD_DIR/.profile.d + status "Checking for post_compile script" if [ -f $BUILD_DIR/bin/post_compile ] ; then status "Running post_compile hook" diff --git a/bin/release b/bin/release index 94d8511..c2556dd 100755 --- a/bin/release +++ b/bin/release @@ -2,43 +2,10 @@ BUILD_DIR=$1 -DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -jq=$DIR/jq -chmod +x $jq -extract_mongo_url() { - # Set if not already present. - if [ -z "${MONGO_URL}" ]; then - #echo "Pulling MONGO_URL from VCAP_SERVICES" - # Find the first service key that contains "mongo", then grab the 'url' (or 'uri') key beneath it. - export MONGO_URL=`echo $VCAP_SERVICES | $jq 'to_entries|map(select(.key|contains("mongo")))[0]|.value[0].credentials|if .url then .url else .uri end|. // empty'` - fi - #echo "MONGO_URL: $MONGO_URL" -} - -extract_root_url() { - if [ -z "${ROOT_URL}" ]; then - #echo "Pulling ROOT_URL from VCAP_APPLICATION" - DOMAIN=`echo $VCAP_APPLICATION | $jq '.uris[0]' | sed -e 's/^"//' -e 's/"$//'` - export ROOT_URL="http://$DOMAIN" - #echo "ROOT_URL: $ROOT_URL" - fi -} - -extract_couchdb_url() { - if [ -z "${COUCHDB_URL}" ]; then - #echo "Pulling COUCHDB_URL from VCAP_SERVICES" - # Find the first service key that contains "cloudant", then grab the 'url' (or 'uri') key beneath it. - export COUCHDB_URL=`echo $VCAP_SERVICES | $jq 'to_entries|map(select(.key|contains("cloudant")))[0]|.value[0].credentials|if .url then .url else .uri end|. // empty'` - fi -} - -extract_mongo_url -extract_root_url -extract_couchdb_url cat <<-YAML --- default_process_types: - web: MONGO_URL=$MONGO_URL COUCHDB_URL=$COUCHDB_URL ROOT_URL=$ROOT_URL vendor/node/bin/node deploy/bundle/main.js + web: vendor/node/bin/node deploy/bundle/main.js YAML diff --git a/profile/env.sh b/profile/env.sh new file mode 100644 index 0000000..da4cc2e --- /dev/null +++ b/profile/env.sh @@ -0,0 +1,32 @@ +jq=$HOME/.vendor/jq + +extract_mongo_url() { + # Set if not already present. + if [ -z "${MONGO_URL}" ]; then + #echo "Pulling MONGO_URL from VCAP_SERVICES" + # Find the first service key that contains "mongo", then grab the 'url' (or 'uri') key beneath it. + export MONGO_URL=`echo $VCAP_SERVICES | $jq 'to_entries|map(select(.key|contains("mongo")))[0]|.value[0].credentials|if .url then .url else .uri end|. // empty'` + fi + #echo "MONGO_URL: $MONGO_URL" +} + +extract_root_url() { + if [ -z "${ROOT_URL}" ]; then + #echo "Pulling ROOT_URL from VCAP_APPLICATION" + DOMAIN=`echo $VCAP_APPLICATION | $jq '.uris[0]' | sed -e 's/^"//' -e 's/"$//'` + export ROOT_URL="http://$DOMAIN" + #echo "ROOT_URL: $ROOT_URL" + fi +} + +extract_couchdb_url() { + if [ -z "${COUCHDB_URL}" ]; then + #echo "Pulling COUCHDB_URL from VCAP_SERVICES" + # Find the first service key that contains "cloudant", then grab the 'url' (or 'uri') key beneath it. + export COUCHDB_URL=`echo $VCAP_SERVICES | $jq 'to_entries|map(select(.key|contains("cloudant")))[0]|.value[0].credentials|if .url then .url else .uri end|. // empty'` + fi +} + +extract_mongo_url +extract_root_url +extract_couchdb_url \ No newline at end of file From c44641b6c46adb4ef5f117acef9e65623e34ca76 Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Mon, 5 Oct 2015 10:57:54 +1100 Subject: [PATCH 05/48] Wrong directory --- bin/compile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/compile b/bin/compile index de679bd..90588b7 100755 --- a/bin/compile +++ b/bin/compile @@ -94,7 +94,7 @@ chmod +x $BUILD_DIR/.vendor mkdir -p $BUILD_DIR/.profile.d -cp $BP_DIR/* $BUILD_DIR/.profile.d +cp $BP_DIR/profile/* $BUILD_DIR/.profile.d status "Checking for post_compile script" if [ -f $BUILD_DIR/bin/post_compile ] ; then From 519c1ab99a13d32d32b019028b966ed4b029ccf9 Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Mon, 5 Oct 2015 12:11:15 +1100 Subject: [PATCH 06/48] chmod not on the app --- bin/compile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/compile b/bin/compile index 90588b7..b6fc4fe 100755 --- a/bin/compile +++ b/bin/compile @@ -90,7 +90,7 @@ build DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) cp $DIR/jq $BUILD_DIR/.vendor -chmod +x $BUILD_DIR/.vendor +chmod +x $BUILD_DIR/.vendor/jq mkdir -p $BUILD_DIR/.profile.d From c5a55da8495829a4ecc93759b2a0bc38b832daea Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Mon, 5 Oct 2015 13:41:01 +1100 Subject: [PATCH 07/48] Try different path to jq --- bin/compile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bin/compile b/bin/compile index b6fc4fe..e93a5df 100755 --- a/bin/compile +++ b/bin/compile @@ -87,9 +87,7 @@ install_node install_meteor build -DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) - -cp $DIR/jq $BUILD_DIR/.vendor +cp $BP_DIR/bin/jq $BUILD_DIR/.vendor chmod +x $BUILD_DIR/.vendor/jq mkdir -p $BUILD_DIR/.profile.d From 7c5783f6e3f3dd88dfcda1ce324dfb2054df9a37 Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Mon, 5 Oct 2015 14:59:13 +1100 Subject: [PATCH 08/48] /20 --- bin/compile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/compile b/bin/compile index e93a5df..a07e05c 100755 --- a/bin/compile +++ b/bin/compile @@ -87,12 +87,12 @@ install_node install_meteor build -cp $BP_DIR/bin/jq $BUILD_DIR/.vendor +cp $BP_DIR/bin/jq $BUILD_DIR/.vendor/ chmod +x $BUILD_DIR/.vendor/jq mkdir -p $BUILD_DIR/.profile.d -cp $BP_DIR/profile/* $BUILD_DIR/.profile.d +cp $BP_DIR/profile/* $BUILD_DIR/.profile.d/ status "Checking for post_compile script" if [ -f $BUILD_DIR/bin/post_compile ] ; then From 3bc95f488ad07a82265131c1a2aac0fbd275a54e Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Mon, 5 Oct 2015 15:09:01 +1100 Subject: [PATCH 09/48] jq 2 jq --- bin/compile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/compile b/bin/compile index a07e05c..8b6cd79 100755 --- a/bin/compile +++ b/bin/compile @@ -87,7 +87,7 @@ install_node install_meteor build -cp $BP_DIR/bin/jq $BUILD_DIR/.vendor/ +cp $BP_DIR/bin/jq $BUILD_DIR/.vendor/jq chmod +x $BUILD_DIR/.vendor/jq mkdir -p $BUILD_DIR/.profile.d From f593192142aaa4af52f832bc34c82d6f96f31bb4 Mon Sep 17 00:00:00 2001 From: Ash Austin Date: Mon, 5 Oct 2015 15:29:08 +1100 Subject: [PATCH 10/48] Trying with sudo perms to see if it works, added some echo to try and understand the file structure --- bin/compile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bin/compile b/bin/compile index 8b6cd79..9f07df7 100755 --- a/bin/compile +++ b/bin/compile @@ -87,12 +87,16 @@ install_node install_meteor build -cp $BP_DIR/bin/jq $BUILD_DIR/.vendor/jq -chmod +x $BUILD_DIR/.vendor/jq +echo BP_DIR= $BP_DIR +echo BUILD_DIR= $BUILD_DIR +echo CACHE_DIR= $CACHE_DIR -mkdir -p $BUILD_DIR/.profile.d +sudo p $BP_DIR/bin/jq $BUILD_DIR/.vendor/jq +sudo chmod +x $BUILD_DIR/.vendor/jq -cp $BP_DIR/profile/* $BUILD_DIR/.profile.d/ +sudo mkdir -p $BUILD_DIR/.profile.d + +sudo cp $BP_DIR/profile/* $BUILD_DIR/.profile.d/ status "Checking for post_compile script" if [ -f $BUILD_DIR/bin/post_compile ] ; then From 1c09d36953752f1f2b0dcc823a58e8646fd1ef6f Mon Sep 17 00:00:00 2001 From: Ash Austin Date: Mon, 5 Oct 2015 15:47:00 +1100 Subject: [PATCH 11/48] Echoing out whats in the directories --- bin/compile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bin/compile b/bin/compile index 9f07df7..f40c72c 100755 --- a/bin/compile +++ b/bin/compile @@ -90,13 +90,16 @@ build echo BP_DIR= $BP_DIR echo BUILD_DIR= $BUILD_DIR echo CACHE_DIR= $CACHE_DIR +ls -lah $BP_DIR +ls -lah $BUILD_DIR -sudo p $BP_DIR/bin/jq $BUILD_DIR/.vendor/jq -sudo chmod +x $BUILD_DIR/.vendor/jq -sudo mkdir -p $BUILD_DIR/.profile.d +cp $BP_DIR/bin/jq $BUILD_DIR/.vendor/jq +chmod +x $BUILD_DIR/.vendor/jq -sudo cp $BP_DIR/profile/* $BUILD_DIR/.profile.d/ +mkdir -p $BUILD_DIR/.profile.d + +cp $BP_DIR/profile/* $BUILD_DIR/.profile.d/ status "Checking for post_compile script" if [ -f $BUILD_DIR/bin/post_compile ] ; then From e9cd380a098eccc0e52f3a2b96a62bb68fdd323a Mon Sep 17 00:00:00 2001 From: Ash Austin Date: Mon, 5 Oct 2015 15:58:21 +1100 Subject: [PATCH 12/48] trying to get this path thing sorted --- bin/compile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/compile b/bin/compile index f40c72c..68300d1 100755 --- a/bin/compile +++ b/bin/compile @@ -87,11 +87,15 @@ install_node install_meteor build +#make the .vendor directory since there was no node installer +mkdir -p $BUILD_DIR/.vendor + echo BP_DIR= $BP_DIR echo BUILD_DIR= $BUILD_DIR echo CACHE_DIR= $CACHE_DIR ls -lah $BP_DIR ls -lah $BUILD_DIR +ls-lah $BUILD_DIR/vendor cp $BP_DIR/bin/jq $BUILD_DIR/.vendor/jq From 090b1d41d57a59e1eb0b23771ceaf4ffc6acca66 Mon Sep 17 00:00:00 2001 From: Ash Austin Date: Mon, 5 Oct 2015 16:11:52 +1100 Subject: [PATCH 13/48] following the bouncing ball --- bin/compile | 8 -------- profile/env.sh | 6 +++++- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/bin/compile b/bin/compile index 68300d1..9f44eb5 100755 --- a/bin/compile +++ b/bin/compile @@ -90,14 +90,6 @@ build #make the .vendor directory since there was no node installer mkdir -p $BUILD_DIR/.vendor -echo BP_DIR= $BP_DIR -echo BUILD_DIR= $BUILD_DIR -echo CACHE_DIR= $CACHE_DIR -ls -lah $BP_DIR -ls -lah $BUILD_DIR -ls-lah $BUILD_DIR/vendor - - cp $BP_DIR/bin/jq $BUILD_DIR/.vendor/jq chmod +x $BUILD_DIR/.vendor/jq diff --git a/profile/env.sh b/profile/env.sh index da4cc2e..cb041df 100644 --- a/profile/env.sh +++ b/profile/env.sh @@ -29,4 +29,8 @@ extract_couchdb_url() { extract_mongo_url extract_root_url -extract_couchdb_url \ No newline at end of file +extract_couchdb_url + +echo $VCAP_SERVICES +echo $MONGO_URL +echo $ROOT_URL \ No newline at end of file From d39724b52b8a73c901ae8adaf195acbf34c620e0 Mon Sep 17 00:00:00 2001 From: Ash Austin Date: Mon, 5 Oct 2015 16:21:03 +1100 Subject: [PATCH 14/48] bouncing bouncing ... --- bin/compile | 2 ++ profile/env.sh | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/compile b/bin/compile index 9f44eb5..5a3b2bc 100755 --- a/bin/compile +++ b/bin/compile @@ -97,6 +97,8 @@ mkdir -p $BUILD_DIR/.profile.d cp $BP_DIR/profile/* $BUILD_DIR/.profile.d/ +ls -lah $BUILD_DIR + status "Checking for post_compile script" if [ -f $BUILD_DIR/bin/post_compile ] ; then status "Running post_compile hook" diff --git a/profile/env.sh b/profile/env.sh index cb041df..3c79d88 100644 --- a/profile/env.sh +++ b/profile/env.sh @@ -5,7 +5,7 @@ extract_mongo_url() { if [ -z "${MONGO_URL}" ]; then #echo "Pulling MONGO_URL from VCAP_SERVICES" # Find the first service key that contains "mongo", then grab the 'url' (or 'uri') key beneath it. - export MONGO_URL=`echo $VCAP_SERVICES | $jq 'to_entries|map(select(.key|contains("mongo")))[0]|.value[0].credentials|if .url then .url else .uri end|. // empty'` + export MONGO_URL=`echo $VCAP_SERVICES | $jq 'to_entries|map(select(.key|contains("mongo")))[0]|.value[0].credentials|if .url then .url else .uri end|. // empty' | sed -e 's/^"//' -e 's/"$//'` fi #echo "MONGO_URL: $MONGO_URL" } @@ -23,7 +23,7 @@ extract_couchdb_url() { if [ -z "${COUCHDB_URL}" ]; then #echo "Pulling COUCHDB_URL from VCAP_SERVICES" # Find the first service key that contains "cloudant", then grab the 'url' (or 'uri') key beneath it. - export COUCHDB_URL=`echo $VCAP_SERVICES | $jq 'to_entries|map(select(.key|contains("cloudant")))[0]|.value[0].credentials|if .url then .url else .uri end|. // empty'` + export COUCHDB_URL=`echo $VCAP_SERVICES | $jq 'to_entries|map(select(.key|contains("cloudant")))[0]|.value[0].credentials|if .url then .url else .uri end|. // empty' | sed -e 's/^"//' -e 's/"$//'` fi } From bb798ae6cb50f44e841ff62c279eac37a5ec4696 Mon Sep 17 00:00:00 2001 From: Ash Austin Date: Mon, 5 Oct 2015 16:34:22 +1100 Subject: [PATCH 15/48] Cleaned up changes --- bin/compile | 4 ++-- profile/env.sh | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/bin/compile b/bin/compile index 5a3b2bc..e4efad4 100755 --- a/bin/compile +++ b/bin/compile @@ -90,14 +90,14 @@ build #make the .vendor directory since there was no node installer mkdir -p $BUILD_DIR/.vendor +#copy jq to be used at runtime cp $BP_DIR/bin/jq $BUILD_DIR/.vendor/jq chmod +x $BUILD_DIR/.vendor/jq +#copy the env.sh file to run on runtime mkdir -p $BUILD_DIR/.profile.d - cp $BP_DIR/profile/* $BUILD_DIR/.profile.d/ -ls -lah $BUILD_DIR status "Checking for post_compile script" if [ -f $BUILD_DIR/bin/post_compile ] ; then diff --git a/profile/env.sh b/profile/env.sh index 3c79d88..06ca5cd 100644 --- a/profile/env.sh +++ b/profile/env.sh @@ -30,7 +30,3 @@ extract_couchdb_url() { extract_mongo_url extract_root_url extract_couchdb_url - -echo $VCAP_SERVICES -echo $MONGO_URL -echo $ROOT_URL \ No newline at end of file From d2fc3125de9ef25123089161e52bcd1adb159071 Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Tue, 29 Mar 2016 15:04:03 +1100 Subject: [PATCH 16/48] Try with version detect --- bin/compile | 216 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 200 insertions(+), 16 deletions(-) diff --git a/bin/compile b/bin/compile index e4efad4..5c0544e 100755 --- a/bin/compile +++ b/bin/compile @@ -46,22 +46,206 @@ install_meteor() { return fi - # status "Install Meteor" - # export PATH=/usr/bin:$PATH # necessary for install script to run from URL - # curl https://install.meteor.com | sh - status "Downloading Meteor install script" - METEOR_INSTALL_SCRIPT=install_meteor.sh - curl https://install.meteor.com/ > $METEOR_INSTALL_SCRIPT - - status "Installing Meteor connected to $MONGO_URL" - sed -e '/^#!\/bin\/sh/ s/$/ -x/' \ - -e 's/set -/#set -/' \ - -e 's/curl --progress-bar --fail.*/curl "$TARBALL_URL" > meteor-bundle.tgz; tar -xzf meteor-bundle.tgz -C "$INSTALL_TMPDIR" -o/' \ - $METEOR_INSTALL_SCRIPT > install-meteor-verbose.sh - chmod +x install-meteor-verbose.sh - - status "Execute ./install-meteor-verbose.sh" - ./install-meteor-verbose.sh +# This always does a clean install of the latest version of Meteor into your +# ~/.meteor, replacing whatever is already there. (~/.meteor is only a cache of +# packages and package metadata; no personal persistent data is stored there.) + +RELEASE=$(cat $BUILD_DIR/.meteor/release | sed "s|METEOR@\(.*\)|\1|g") + + +# Now, on to the actual installer! + +## NOTE sh NOT bash. This script should be POSIX sh only, since we don't +## know what shell the user has. Debian uses 'dash' for 'sh', for +## example. + +PREFIX="/usr/local" + +set -e +set -u + +# Let's display everything on stderr. +exec 1>&2 + + +UNAME=$(uname) +# Check to see if it starts with MINGW. +if [ "$UNAME" ">" "MINGW" -a "$UNAME" "<" "MINGX" ] ; then + echo "To install Meteor on Windows, download the installer from:" + echo "https://install.meteor.com/windows" + exit 1 +fi +if [ "$UNAME" != "Linux" -a "$UNAME" != "Darwin" ] ; then + echo "Sorry, this OS is not supported yet via this installer." + echo "For more details on supported platforms, see https://www.meteor.com/install" + exit 1 +fi + + +if [ "$UNAME" = "Darwin" ] ; then + ### OSX ### + if [ "i386" != "$(uname -p)" -o "1" != "$(sysctl -n hw.cpu64bit_capable 2>/dev/null || echo 0)" ] ; then + # Can't just test uname -m = x86_64, because Snow Leopard can + # return other values. + echo "Only 64-bit Intel processors are supported at this time." + exit 1 + fi + + # Running a version of Meteor older than 0.6.0 (April 2013)? + if grep BUNDLE_VERSION /usr/local/bin/meteor >/dev/null 2>&1 ; then + echo "You appear to have a very old version of Meteor installed." + echo "Please remove it by running these commands:" + echo " $ sudo rm /usr/local/bin/meteor" + echo " $ sudo rm -rf /usr/local/meteor /usr/local/meteor.old" + echo "and then run the installer command again:" + echo " $ curl https://install.meteor.com/ | sh" + exit 1 + fi + + PLATFORM="os.osx.x86_64" +elif [ "$UNAME" = "Linux" ] ; then + ### Linux ### + LINUX_ARCH=$(uname -m) + if [ "${LINUX_ARCH}" = "i686" ] ; then + PLATFORM="os.linux.x86_32" + elif [ "${LINUX_ARCH}" = "x86_64" ] ; then + PLATFORM="os.linux.x86_64" + else + echo "Unusable architecture: ${LINUX_ARCH}" + echo "Meteor only supports i686 and x86_64 for now." + exit 1 + fi + + # Running a version of Meteor older than 0.6.0 (April 2013) on a dpkg system? + if dpkg -s meteor >/dev/null 2>&1 ; then + echo "You appear to have a very old version of Meteor installed." + echo "Please remove it by running these commands:" + echo " $ sudo dpkg -r meteor" + echo " $ hash -r" + echo "and then run the installer command again:" + echo " $ curl https://install.meteor.com/ | sh" + exit 1 + fi + + # Running a version of Meteor older than 0.6.0 (April 2013) on an rpm system? + if rpm -q meteor >/dev/null 2>&1 ; then + echo "You appear to have a very old version of Meteor installed." + echo "Please remove it by running these commands:" + echo " $ sudo rpm -e meteor" + echo " $ hash -r" + echo "and then run the installer command again:" + echo " $ curl https://install.meteor.com/ | sh" + exit 1 + fi +fi + +trap "echo Installation failed." EXIT + +# If you already have a tropohouse/warehouse, we do a clean install here: +if [ -e "$HOME/.meteor" ]; then + echo "Removing your existing Meteor installation." + rm -rf "$HOME/.meteor" +fi + +TARBALL_URL="https://d3sqy0vbqsdhku.cloudfront.net/packages-bootstrap/${RELEASE}/meteor-bootstrap-${PLATFORM}.tar.gz" + +INSTALL_TMPDIR="$HOME/.meteor-install-tmp" +rm -rf "$INSTALL_TMPDIR" +mkdir "$INSTALL_TMPDIR" +echo "Downloading Meteor distribution" +curl --progress-bar --fail "$TARBALL_URL" | tar -xzf - -C "$INSTALL_TMPDIR" -o +# bomb out if it didn't work, eg no net +test -x "${INSTALL_TMPDIR}/.meteor/meteor" +mv "${INSTALL_TMPDIR}/.meteor" "$HOME" +rm -rf "${INSTALL_TMPDIR}" +# just double-checking :) +test -x "$HOME/.meteor/meteor" + + + +echo +echo "Meteor ${RELEASE} has been installed in your home directory (~/.meteor)." + +METEOR_SYMLINK_TARGET="$(readlink "$HOME/.meteor/meteor")" +METEOR_TOOL_DIRECTORY="$(dirname "$METEOR_SYMLINK_TARGET")" +LAUNCHER="$HOME/.meteor/$METEOR_TOOL_DIRECTORY/scripts/admin/launch-meteor" + + + + +if cp "$LAUNCHER" "$PREFIX/bin/meteor" >/dev/null 2>&1; then + echo "Writing a launcher script to $PREFIX/bin/meteor for your convenience." + cat <<"EOF" + +To get started fast: + + $ meteor create ~/my_cool_app + $ cd ~/my_cool_app + $ meteor + +Or see the docs at: + + docs.meteor.com + +EOF +elif type sudo >/dev/null 2>&1; then + echo "Writing a launcher script to $PREFIX/bin/meteor for your convenience." + echo "This may prompt for your password." + + # New macs (10.9+) don't ship with /usr/local, however it is still in + # the default PATH. We still install there, we just need to create the + # directory first. + # XXX this means that we can run sudo too many times. we should never + # run it more than once if it fails the first time + if [ ! -d "$PREFIX/bin" ] ; then + sudo mkdir -m 755 "$PREFIX" || true + sudo mkdir -m 755 "$PREFIX/bin" || true + fi + + if sudo cp "$LAUNCHER" "$PREFIX/bin/meteor"; then + cat <<"EOF" + +To get started fast: + + $ meteor create ~/my_cool_app + $ cd ~/my_cool_app + $ meteor + +Or see the docs at: + + docs.meteor.com + +EOF + else + cat < Date: Tue, 29 Mar 2016 15:05:49 +1100 Subject: [PATCH 17/48] output release --- bin/compile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/compile b/bin/compile index 5c0544e..bfe5181 100755 --- a/bin/compile +++ b/bin/compile @@ -52,6 +52,8 @@ install_meteor() { RELEASE=$(cat $BUILD_DIR/.meteor/release | sed "s|METEOR@\(.*\)|\1|g") +status "release $RELEASE" + # Now, on to the actual installer! From bd93bd32cd177288c511e71aa293177a8b7acc41 Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Tue, 29 Mar 2016 15:07:39 +1100 Subject: [PATCH 18/48] output tarball_url --- bin/compile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/compile b/bin/compile index bfe5181..a15b6dc 100755 --- a/bin/compile +++ b/bin/compile @@ -52,9 +52,6 @@ install_meteor() { RELEASE=$(cat $BUILD_DIR/.meteor/release | sed "s|METEOR@\(.*\)|\1|g") -status "release $RELEASE" - - # Now, on to the actual installer! ## NOTE sh NOT bash. This script should be POSIX sh only, since we don't @@ -151,6 +148,8 @@ fi TARBALL_URL="https://d3sqy0vbqsdhku.cloudfront.net/packages-bootstrap/${RELEASE}/meteor-bootstrap-${PLATFORM}.tar.gz" +status "release $RELEASE url $TARBALL_URL" + INSTALL_TMPDIR="$HOME/.meteor-install-tmp" rm -rf "$INSTALL_TMPDIR" mkdir "$INSTALL_TMPDIR" From 8c7e011476dbddaa62770f2ed666284ddfac0b80 Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Tue, 29 Mar 2016 15:25:56 +1100 Subject: [PATCH 19/48] Do subs from original --- bin/compile | 80 +++-------------------------------------------------- 1 file changed, 4 insertions(+), 76 deletions(-) diff --git a/bin/compile b/bin/compile index a15b6dc..11bb6f6 100755 --- a/bin/compile +++ b/bin/compile @@ -52,6 +52,7 @@ install_meteor() { RELEASE=$(cat $BUILD_DIR/.meteor/release | sed "s|METEOR@\(.*\)|\1|g") + # Now, on to the actual installer! ## NOTE sh NOT bash. This script should be POSIX sh only, since we don't @@ -60,8 +61,8 @@ RELEASE=$(cat $BUILD_DIR/.meteor/release | sed "s|METEOR@\(.*\)|\1|g") PREFIX="/usr/local" -set -e -set -u +#set -e +#set -u # Let's display everything on stderr. exec 1>&2 @@ -148,13 +149,11 @@ fi TARBALL_URL="https://d3sqy0vbqsdhku.cloudfront.net/packages-bootstrap/${RELEASE}/meteor-bootstrap-${PLATFORM}.tar.gz" -status "release $RELEASE url $TARBALL_URL" - INSTALL_TMPDIR="$HOME/.meteor-install-tmp" rm -rf "$INSTALL_TMPDIR" mkdir "$INSTALL_TMPDIR" echo "Downloading Meteor distribution" -curl --progress-bar --fail "$TARBALL_URL" | tar -xzf - -C "$INSTALL_TMPDIR" -o +curl "$TARBALL_URL" > meteor-bundle.tgz; tar -xzf meteor-bundle.tgz -C "$INSTALL_TMPDIR" -o # bomb out if it didn't work, eg no net test -x "${INSTALL_TMPDIR}/.meteor/meteor" mv "${INSTALL_TMPDIR}/.meteor" "$HOME" @@ -176,77 +175,6 @@ LAUNCHER="$HOME/.meteor/$METEOR_TOOL_DIRECTORY/scripts/admin/launch-meteor" if cp "$LAUNCHER" "$PREFIX/bin/meteor" >/dev/null 2>&1; then echo "Writing a launcher script to $PREFIX/bin/meteor for your convenience." - cat <<"EOF" - -To get started fast: - - $ meteor create ~/my_cool_app - $ cd ~/my_cool_app - $ meteor - -Or see the docs at: - - docs.meteor.com - -EOF -elif type sudo >/dev/null 2>&1; then - echo "Writing a launcher script to $PREFIX/bin/meteor for your convenience." - echo "This may prompt for your password." - - # New macs (10.9+) don't ship with /usr/local, however it is still in - # the default PATH. We still install there, we just need to create the - # directory first. - # XXX this means that we can run sudo too many times. we should never - # run it more than once if it fails the first time - if [ ! -d "$PREFIX/bin" ] ; then - sudo mkdir -m 755 "$PREFIX" || true - sudo mkdir -m 755 "$PREFIX/bin" || true - fi - - if sudo cp "$LAUNCHER" "$PREFIX/bin/meteor"; then - cat <<"EOF" - -To get started fast: - - $ meteor create ~/my_cool_app - $ cd ~/my_cool_app - $ meteor - -Or see the docs at: - - docs.meteor.com - -EOF - else - cat < Date: Tue, 29 Mar 2016 15:58:06 +1100 Subject: [PATCH 20/48] Separate install-meteor-verbose.sh --- bin/compile | 136 ++------------------ bin/install-meteor-verbose.sh | 231 ++++++++++++++++++++++++++++++++++ 2 files changed, 238 insertions(+), 129 deletions(-) create mode 100644 bin/install-meteor-verbose.sh diff --git a/bin/compile b/bin/compile index 11bb6f6..ec73a8e 100755 --- a/bin/compile +++ b/bin/compile @@ -18,7 +18,7 @@ status() { echo "-----> $*" } -node_version=$(curl --silent --get https://semver.io/node/resolve/0.10.x) +node_version=$(curl --silent --get https://semver.io/node/resolve/4.4.x) install_node() { if [ -f "$BUILD_DIR/.vendor/node/bin/node" ] ; then @@ -46,135 +46,13 @@ install_meteor() { return fi -# This always does a clean install of the latest version of Meteor into your -# ~/.meteor, replacing whatever is already there. (~/.meteor is only a cache of -# packages and package metadata; no personal persistent data is stored there.) + # status "Install Meteor" + # export PATH=/usr/bin:$PATH # necessary for install script to run from URL + # curl https://install.meteor.com | sh + status "Downloading Meteor install script" -RELEASE=$(cat $BUILD_DIR/.meteor/release | sed "s|METEOR@\(.*\)|\1|g") - - -# Now, on to the actual installer! - -## NOTE sh NOT bash. This script should be POSIX sh only, since we don't -## know what shell the user has. Debian uses 'dash' for 'sh', for -## example. - -PREFIX="/usr/local" - -#set -e -#set -u - -# Let's display everything on stderr. -exec 1>&2 - - -UNAME=$(uname) -# Check to see if it starts with MINGW. -if [ "$UNAME" ">" "MINGW" -a "$UNAME" "<" "MINGX" ] ; then - echo "To install Meteor on Windows, download the installer from:" - echo "https://install.meteor.com/windows" - exit 1 -fi -if [ "$UNAME" != "Linux" -a "$UNAME" != "Darwin" ] ; then - echo "Sorry, this OS is not supported yet via this installer." - echo "For more details on supported platforms, see https://www.meteor.com/install" - exit 1 -fi - - -if [ "$UNAME" = "Darwin" ] ; then - ### OSX ### - if [ "i386" != "$(uname -p)" -o "1" != "$(sysctl -n hw.cpu64bit_capable 2>/dev/null || echo 0)" ] ; then - # Can't just test uname -m = x86_64, because Snow Leopard can - # return other values. - echo "Only 64-bit Intel processors are supported at this time." - exit 1 - fi - - # Running a version of Meteor older than 0.6.0 (April 2013)? - if grep BUNDLE_VERSION /usr/local/bin/meteor >/dev/null 2>&1 ; then - echo "You appear to have a very old version of Meteor installed." - echo "Please remove it by running these commands:" - echo " $ sudo rm /usr/local/bin/meteor" - echo " $ sudo rm -rf /usr/local/meteor /usr/local/meteor.old" - echo "and then run the installer command again:" - echo " $ curl https://install.meteor.com/ | sh" - exit 1 - fi - - PLATFORM="os.osx.x86_64" -elif [ "$UNAME" = "Linux" ] ; then - ### Linux ### - LINUX_ARCH=$(uname -m) - if [ "${LINUX_ARCH}" = "i686" ] ; then - PLATFORM="os.linux.x86_32" - elif [ "${LINUX_ARCH}" = "x86_64" ] ; then - PLATFORM="os.linux.x86_64" - else - echo "Unusable architecture: ${LINUX_ARCH}" - echo "Meteor only supports i686 and x86_64 for now." - exit 1 - fi - - # Running a version of Meteor older than 0.6.0 (April 2013) on a dpkg system? - if dpkg -s meteor >/dev/null 2>&1 ; then - echo "You appear to have a very old version of Meteor installed." - echo "Please remove it by running these commands:" - echo " $ sudo dpkg -r meteor" - echo " $ hash -r" - echo "and then run the installer command again:" - echo " $ curl https://install.meteor.com/ | sh" - exit 1 - fi - - # Running a version of Meteor older than 0.6.0 (April 2013) on an rpm system? - if rpm -q meteor >/dev/null 2>&1 ; then - echo "You appear to have a very old version of Meteor installed." - echo "Please remove it by running these commands:" - echo " $ sudo rpm -e meteor" - echo " $ hash -r" - echo "and then run the installer command again:" - echo " $ curl https://install.meteor.com/ | sh" - exit 1 - fi -fi - -trap "echo Installation failed." EXIT - -# If you already have a tropohouse/warehouse, we do a clean install here: -if [ -e "$HOME/.meteor" ]; then - echo "Removing your existing Meteor installation." - rm -rf "$HOME/.meteor" -fi - -TARBALL_URL="https://d3sqy0vbqsdhku.cloudfront.net/packages-bootstrap/${RELEASE}/meteor-bootstrap-${PLATFORM}.tar.gz" - -INSTALL_TMPDIR="$HOME/.meteor-install-tmp" -rm -rf "$INSTALL_TMPDIR" -mkdir "$INSTALL_TMPDIR" -echo "Downloading Meteor distribution" -curl "$TARBALL_URL" > meteor-bundle.tgz; tar -xzf meteor-bundle.tgz -C "$INSTALL_TMPDIR" -o -# bomb out if it didn't work, eg no net -test -x "${INSTALL_TMPDIR}/.meteor/meteor" -mv "${INSTALL_TMPDIR}/.meteor" "$HOME" -rm -rf "${INSTALL_TMPDIR}" -# just double-checking :) -test -x "$HOME/.meteor/meteor" - - - -echo -echo "Meteor ${RELEASE} has been installed in your home directory (~/.meteor)." - -METEOR_SYMLINK_TARGET="$(readlink "$HOME/.meteor/meteor")" -METEOR_TOOL_DIRECTORY="$(dirname "$METEOR_SYMLINK_TARGET")" -LAUNCHER="$HOME/.meteor/$METEOR_TOOL_DIRECTORY/scripts/admin/launch-meteor" - - - - -if cp "$LAUNCHER" "$PREFIX/bin/meteor" >/dev/null 2>&1; then - echo "Writing a launcher script to $PREFIX/bin/meteor for your convenience." + status "Execute ./install-meteor-verbose.sh" + ./install-meteor-verbose.sh status "Done" status "Updating PATH with Meteor" diff --git a/bin/install-meteor-verbose.sh b/bin/install-meteor-verbose.sh new file mode 100644 index 0000000..d0ad3b4 --- /dev/null +++ b/bin/install-meteor-verbose.sh @@ -0,0 +1,231 @@ +#!/bin/sh -x + +# This is the Meteor install script! +# +# Are you looking at this in your web browser, and would like to install Meteor? +# +# MAC AND LINUX: +# Just open up your terminal and type: +# +# curl https://install.meteor.com/ | sh +# +# Meteor currently supports: +# - Mac: OS X 10.7 and above +# - Linux: x86 and x86_64 systems +# +# WINDOWS: +# Download the Windows installer from https://install.meteor.com/windows +# +# Meteor currently supports Windows 7, Windows 8.1, Windows Server 2008, +# and Windows Server 2012. + +# We wrap this whole script in a function, so that we won't execute +# until the entire script is downloaded. +# That's good because it prevents our output overlapping with curl's. +# It also means that we can't run a partially downloaded script. +# We don't indent because it would be really confusing with the heredocs. +run_it () { + +# This always does a clean install of the latest version of Meteor into your +# ~/.meteor, replacing whatever is already there. (~/.meteor is only a cache of +# packages and package metadata; no personal persistent data is stored there.) + +RELEASE=$(cat .meteor/release | sed "s|METEOR@\(.*\)|\1|g") + + +# Now, on to the actual installer! + +## NOTE sh NOT bash. This script should be POSIX sh only, since we don't +## know what shell the user has. Debian uses 'dash' for 'sh', for +## example. + +PREFIX="/usr/local" + +#set -e +#set -u + +# Let's display everything on stderr. +exec 1>&2 + + +UNAME=$(uname) +# Check to see if it starts with MINGW. +if [ "$UNAME" ">" "MINGW" -a "$UNAME" "<" "MINGX" ] ; then + echo "To install Meteor on Windows, download the installer from:" + echo "https://install.meteor.com/windows" + exit 1 +fi +if [ "$UNAME" != "Linux" -a "$UNAME" != "Darwin" ] ; then + echo "Sorry, this OS is not supported yet via this installer." + echo "For more details on supported platforms, see https://www.meteor.com/install" + exit 1 +fi + + +if [ "$UNAME" = "Darwin" ] ; then + ### OSX ### + if [ "i386" != "$(uname -p)" -o "1" != "$(sysctl -n hw.cpu64bit_capable 2>/dev/null || echo 0)" ] ; then + # Can't just test uname -m = x86_64, because Snow Leopard can + # return other values. + echo "Only 64-bit Intel processors are supported at this time." + exit 1 + fi + + # Running a version of Meteor older than 0.6.0 (April 2013)? + if grep BUNDLE_VERSION /usr/local/bin/meteor >/dev/null 2>&1 ; then + echo "You appear to have a very old version of Meteor installed." + echo "Please remove it by running these commands:" + echo " $ sudo rm /usr/local/bin/meteor" + echo " $ sudo rm -rf /usr/local/meteor /usr/local/meteor.old" + echo "and then run the installer command again:" + echo " $ curl https://install.meteor.com/ | sh" + exit 1 + fi + + PLATFORM="os.osx.x86_64" +elif [ "$UNAME" = "Linux" ] ; then + ### Linux ### + LINUX_ARCH=$(uname -m) + if [ "${LINUX_ARCH}" = "i686" ] ; then + PLATFORM="os.linux.x86_32" + elif [ "${LINUX_ARCH}" = "x86_64" ] ; then + PLATFORM="os.linux.x86_64" + else + echo "Unusable architecture: ${LINUX_ARCH}" + echo "Meteor only supports i686 and x86_64 for now." + exit 1 + fi + + # Running a version of Meteor older than 0.6.0 (April 2013) on a dpkg system? + if dpkg -s meteor >/dev/null 2>&1 ; then + echo "You appear to have a very old version of Meteor installed." + echo "Please remove it by running these commands:" + echo " $ sudo dpkg -r meteor" + echo " $ hash -r" + echo "and then run the installer command again:" + echo " $ curl https://install.meteor.com/ | sh" + exit 1 + fi + + # Running a version of Meteor older than 0.6.0 (April 2013) on an rpm system? + if rpm -q meteor >/dev/null 2>&1 ; then + echo "You appear to have a very old version of Meteor installed." + echo "Please remove it by running these commands:" + echo " $ sudo rpm -e meteor" + echo " $ hash -r" + echo "and then run the installer command again:" + echo " $ curl https://install.meteor.com/ | sh" + exit 1 + fi +fi + +trap "echo Installation failed." EXIT + +# If you already have a tropohouse/warehouse, we do a clean install here: +if [ -e "$HOME/.meteor" ]; then + echo "Removing your existing Meteor installation." + rm -rf "$HOME/.meteor" +fi + +TARBALL_URL="https://d3sqy0vbqsdhku.cloudfront.net/packages-bootstrap/${RELEASE}/meteor-bootstrap-${PLATFORM}.tar.gz" + +INSTALL_TMPDIR="$HOME/.meteor-install-tmp" +rm -rf "$INSTALL_TMPDIR" +mkdir "$INSTALL_TMPDIR" +echo "Downloading Meteor distribution" +curl "$TARBALL_URL" > meteor-bundle.tgz; tar -xzf meteor-bundle.tgz -C "$INSTALL_TMPDIR" -o +# bomb out if it didn't work, eg no net +test -x "${INSTALL_TMPDIR}/.meteor/meteor" +mv "${INSTALL_TMPDIR}/.meteor" "$HOME" +rm -rf "${INSTALL_TMPDIR}" +# just double-checking :) +test -x "$HOME/.meteor/meteor" + + + +echo +echo "Meteor ${RELEASE} has been installed in your home directory (~/.meteor)." + +METEOR_SYMLINK_TARGET="$(readlink "$HOME/.meteor/meteor")" +METEOR_TOOL_DIRECTORY="$(dirname "$METEOR_SYMLINK_TARGET")" +LAUNCHER="$HOME/.meteor/$METEOR_TOOL_DIRECTORY/scripts/admin/launch-meteor" + + + + +if cp "$LAUNCHER" "$PREFIX/bin/meteor" >/dev/null 2>&1; then + echo "Writing a launcher script to $PREFIX/bin/meteor for your convenience." + cat <<"EOF" + +To get started fast: + + $ meteor create ~/my_cool_app + $ cd ~/my_cool_app + $ meteor + +Or see the docs at: + + docs.meteor.com + +EOF +elif type sudo >/dev/null 2>&1; then + echo "Writing a launcher script to $PREFIX/bin/meteor for your convenience." + echo "This may prompt for your password." + + # New macs (10.9+) don't ship with /usr/local, however it is still in + # the default PATH. We still install there, we just need to create the + # directory first. + # XXX this means that we can run sudo too many times. we should never + # run it more than once if it fails the first time + if [ ! -d "$PREFIX/bin" ] ; then + sudo mkdir -m 755 "$PREFIX" || true + sudo mkdir -m 755 "$PREFIX/bin" || true + fi + + if sudo cp "$LAUNCHER" "$PREFIX/bin/meteor"; then + cat <<"EOF" + +To get started fast: + + $ meteor create ~/my_cool_app + $ cd ~/my_cool_app + $ meteor + +Or see the docs at: + + docs.meteor.com + +EOF + else + cat < Date: Tue, 29 Mar 2016 16:01:12 +1100 Subject: [PATCH 21/48] Use BP_DIR --- bin/compile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/compile b/bin/compile index ec73a8e..d8b67c3 100755 --- a/bin/compile +++ b/bin/compile @@ -18,7 +18,7 @@ status() { echo "-----> $*" } -node_version=$(curl --silent --get https://semver.io/node/resolve/4.4.x) +node_version=$(curl --silent --get https://semver.io/node/resolve/0.10.x) install_node() { if [ -f "$BUILD_DIR/.vendor/node/bin/node" ] ; then @@ -52,7 +52,7 @@ install_meteor() { status "Downloading Meteor install script" status "Execute ./install-meteor-verbose.sh" - ./install-meteor-verbose.sh + $BP_DIR/bin/install-meteor-verbose.sh status "Done" status "Updating PATH with Meteor" From acd40bf28cb913a9033ee1807481af834f612c8d Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Tue, 29 Mar 2016 16:03:12 +1100 Subject: [PATCH 22/48] Change status --- bin/compile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/compile b/bin/compile index d8b67c3..b67af9f 100755 --- a/bin/compile +++ b/bin/compile @@ -51,7 +51,7 @@ install_meteor() { # curl https://install.meteor.com | sh status "Downloading Meteor install script" - status "Execute ./install-meteor-verbose.sh" + status "Execute $BP_DIR/bin/install-meteor-verbose.sh" $BP_DIR/bin/install-meteor-verbose.sh status "Done" From 376e00d009e36e251480e0d1d24c091245310903 Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Tue, 29 Mar 2016 16:04:57 +1100 Subject: [PATCH 23/48] chmod script --- bin/compile | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/compile b/bin/compile index b67af9f..205c6f1 100755 --- a/bin/compile +++ b/bin/compile @@ -52,6 +52,7 @@ install_meteor() { status "Downloading Meteor install script" status "Execute $BP_DIR/bin/install-meteor-verbose.sh" + chmod +x $BP_DIR/bin/install-meteor-verbose.sh $BP_DIR/bin/install-meteor-verbose.sh status "Done" From 857171fad2e44d9a4bf1354124a7ae2ecd09f342 Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Tue, 29 Mar 2016 16:07:06 +1100 Subject: [PATCH 24/48] Build_dir in install --- bin/install-meteor-verbose.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/install-meteor-verbose.sh b/bin/install-meteor-verbose.sh index d0ad3b4..fc7d539 100644 --- a/bin/install-meteor-verbose.sh +++ b/bin/install-meteor-verbose.sh @@ -30,7 +30,7 @@ run_it () { # ~/.meteor, replacing whatever is already there. (~/.meteor is only a cache of # packages and package metadata; no personal persistent data is stored there.) -RELEASE=$(cat .meteor/release | sed "s|METEOR@\(.*\)|\1|g") +RELEASE=$(cat $BUILD_DIR/.meteor/release | sed "s|METEOR@\(.*\)|\1|g") # Now, on to the actual installer! From 7ebaa7e31b0454ab4c33619fbe29bca814882b01 Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Tue, 29 Mar 2016 16:09:17 +1100 Subject: [PATCH 25/48] Pass build dir --- bin/compile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/compile b/bin/compile index 205c6f1..425674f 100755 --- a/bin/compile +++ b/bin/compile @@ -53,7 +53,7 @@ install_meteor() { status "Execute $BP_DIR/bin/install-meteor-verbose.sh" chmod +x $BP_DIR/bin/install-meteor-verbose.sh - $BP_DIR/bin/install-meteor-verbose.sh + $BP_DIR/bin/install-meteor-verbose.sh $BUILD_DIR status "Done" status "Updating PATH with Meteor" From c441372e5edc8825878899cd6071c37be110b6cb Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Tue, 29 Mar 2016 16:12:47 +1100 Subject: [PATCH 26/48] Use source --- bin/compile | 3 +-- bin/install-meteor-verbose.sh | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/compile b/bin/compile index 425674f..a095802 100755 --- a/bin/compile +++ b/bin/compile @@ -52,8 +52,7 @@ install_meteor() { status "Downloading Meteor install script" status "Execute $BP_DIR/bin/install-meteor-verbose.sh" - chmod +x $BP_DIR/bin/install-meteor-verbose.sh - $BP_DIR/bin/install-meteor-verbose.sh $BUILD_DIR + source $BP_DIR/bin/install-meteor-verbose.sh status "Done" status "Updating PATH with Meteor" diff --git a/bin/install-meteor-verbose.sh b/bin/install-meteor-verbose.sh index fc7d539..58cf593 100644 --- a/bin/install-meteor-verbose.sh +++ b/bin/install-meteor-verbose.sh @@ -24,6 +24,7 @@ # That's good because it prevents our output overlapping with curl's. # It also means that we can't run a partially downloaded script. # We don't indent because it would be really confusing with the heredocs. + run_it () { # This always does a clean install of the latest version of Meteor into your From f88aeacaade38672975c506d1b50fe1e553a81b4 Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Tue, 29 Mar 2016 16:14:35 +1100 Subject: [PATCH 27/48] Try and get status --- bin/install-meteor-verbose.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/install-meteor-verbose.sh b/bin/install-meteor-verbose.sh index 58cf593..2a54800 100644 --- a/bin/install-meteor-verbose.sh +++ b/bin/install-meteor-verbose.sh @@ -130,6 +130,8 @@ fi TARBALL_URL="https://d3sqy0vbqsdhku.cloudfront.net/packages-bootstrap/${RELEASE}/meteor-bootstrap-${PLATFORM}.tar.gz" +status "release $RELEASE $TARBALL_URL" + INSTALL_TMPDIR="$HOME/.meteor-install-tmp" rm -rf "$INSTALL_TMPDIR" mkdir "$INSTALL_TMPDIR" From 006d8a34d451083e3f4e48f4ec82eff2af62f0ff Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Tue, 29 Mar 2016 16:15:59 +1100 Subject: [PATCH 28/48] ? --- bin/install-meteor-verbose.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/install-meteor-verbose.sh b/bin/install-meteor-verbose.sh index 2a54800..97ceb93 100644 --- a/bin/install-meteor-verbose.sh +++ b/bin/install-meteor-verbose.sh @@ -130,7 +130,8 @@ fi TARBALL_URL="https://d3sqy0vbqsdhku.cloudfront.net/packages-bootstrap/${RELEASE}/meteor-bootstrap-${PLATFORM}.tar.gz" -status "release $RELEASE $TARBALL_URL" +status "release $RELEASE" +status $TARBALL_URL INSTALL_TMPDIR="$HOME/.meteor-install-tmp" rm -rf "$INSTALL_TMPDIR" From 91c990cc65f219be2cd3e0308905be0ffa520eaf Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Tue, 29 Mar 2016 16:18:17 +1100 Subject: [PATCH 29/48] Try hard code --- bin/install-meteor-verbose.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bin/install-meteor-verbose.sh b/bin/install-meteor-verbose.sh index 97ceb93..a8ad04b 100644 --- a/bin/install-meteor-verbose.sh +++ b/bin/install-meteor-verbose.sh @@ -31,7 +31,7 @@ run_it () { # ~/.meteor, replacing whatever is already there. (~/.meteor is only a cache of # packages and package metadata; no personal persistent data is stored there.) -RELEASE=$(cat $BUILD_DIR/.meteor/release | sed "s|METEOR@\(.*\)|\1|g") +RELEASE="1.2.1" # Now, on to the actual installer! @@ -130,9 +130,6 @@ fi TARBALL_URL="https://d3sqy0vbqsdhku.cloudfront.net/packages-bootstrap/${RELEASE}/meteor-bootstrap-${PLATFORM}.tar.gz" -status "release $RELEASE" -status $TARBALL_URL - INSTALL_TMPDIR="$HOME/.meteor-install-tmp" rm -rf "$INSTALL_TMPDIR" mkdir "$INSTALL_TMPDIR" From 914dfe2a3ec8ec8ed7e9bde6c01cf42ca5a23445 Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Tue, 29 Mar 2016 16:22:12 +1100 Subject: [PATCH 30/48] Try dynamic again --- bin/install-meteor-verbose.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/install-meteor-verbose.sh b/bin/install-meteor-verbose.sh index a8ad04b..88f8af8 100644 --- a/bin/install-meteor-verbose.sh +++ b/bin/install-meteor-verbose.sh @@ -31,7 +31,9 @@ run_it () { # ~/.meteor, replacing whatever is already there. (~/.meteor is only a cache of # packages and package metadata; no personal persistent data is stored there.) -RELEASE="1.2.1" +RELEASE=$(cat $BUILD_DIR/.meteor/release | sed "s|METEOR@\(.*\)|\1|g") + +status "a $RELEASE b" # Now, on to the actual installer! From c4033a4c5605022ed994a929e6309f3db54fe082 Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Tue, 29 Mar 2016 16:24:44 +1100 Subject: [PATCH 31/48] Try without g --- bin/install-meteor-verbose.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/install-meteor-verbose.sh b/bin/install-meteor-verbose.sh index 88f8af8..b60b092 100644 --- a/bin/install-meteor-verbose.sh +++ b/bin/install-meteor-verbose.sh @@ -31,7 +31,7 @@ run_it () { # ~/.meteor, replacing whatever is already there. (~/.meteor is only a cache of # packages and package metadata; no personal persistent data is stored there.) -RELEASE=$(cat $BUILD_DIR/.meteor/release | sed "s|METEOR@\(.*\)|\1|g") +RELEASE=$(cat $BUILD_DIR/.meteor/release | sed "s|METEOR@\(.*\)|\1|") status "a $RELEASE b" From d9f1f9193679143be08145b1e423c7cb1d93dec7 Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Tue, 29 Mar 2016 16:27:49 +1100 Subject: [PATCH 32/48] trim with xargs --- bin/install-meteor-verbose.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/install-meteor-verbose.sh b/bin/install-meteor-verbose.sh index b60b092..df7dee5 100644 --- a/bin/install-meteor-verbose.sh +++ b/bin/install-meteor-verbose.sh @@ -31,7 +31,7 @@ run_it () { # ~/.meteor, replacing whatever is already there. (~/.meteor is only a cache of # packages and package metadata; no personal persistent data is stored there.) -RELEASE=$(cat $BUILD_DIR/.meteor/release | sed "s|METEOR@\(.*\)|\1|") +RELEASE=$(cat $BUILD_DIR/.meteor/release | sed "s|METEOR@\(.*\)|\1|" | xargs) status "a $RELEASE b" From c84d30897442de06986533d3fdafca3888c4e247 Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Tue, 29 Mar 2016 16:37:25 +1100 Subject: [PATCH 33/48] Trim \r --- bin/install-meteor-verbose.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/install-meteor-verbose.sh b/bin/install-meteor-verbose.sh index df7dee5..2d024f3 100644 --- a/bin/install-meteor-verbose.sh +++ b/bin/install-meteor-verbose.sh @@ -31,7 +31,7 @@ run_it () { # ~/.meteor, replacing whatever is already there. (~/.meteor is only a cache of # packages and package metadata; no personal persistent data is stored there.) -RELEASE=$(cat $BUILD_DIR/.meteor/release | sed "s|METEOR@\(.*\)|\1|" | xargs) +RELEASE=$(cat $BUILD_DIR/.meteor/release | sed "s|METEOR@\(.*\)|\1|" | tr -d '\r') status "a $RELEASE b" From b6cad644d266ce0a23697ae08060e1d50c82a15c Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Tue, 29 Mar 2016 16:38:40 +1100 Subject: [PATCH 34/48] Remove release number status --- bin/install-meteor-verbose.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/bin/install-meteor-verbose.sh b/bin/install-meteor-verbose.sh index 2d024f3..641b968 100644 --- a/bin/install-meteor-verbose.sh +++ b/bin/install-meteor-verbose.sh @@ -33,9 +33,6 @@ run_it () { RELEASE=$(cat $BUILD_DIR/.meteor/release | sed "s|METEOR@\(.*\)|\1|" | tr -d '\r') -status "a $RELEASE b" - - # Now, on to the actual installer! ## NOTE sh NOT bash. This script should be POSIX sh only, since we don't From afec00017e7136e45a933442b821a0be26daaba8 Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Fri, 29 Apr 2016 09:27:21 +1000 Subject: [PATCH 35/48] Do npm install for meteor 1.3 --- bin/compile | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/bin/compile b/bin/compile index a095802..3ff9546 100755 --- a/bin/compile +++ b/bin/compile @@ -52,7 +52,7 @@ install_meteor() { status "Downloading Meteor install script" status "Execute $BP_DIR/bin/install-meteor-verbose.sh" - source $BP_DIR/bin/install-meteor-verbose.sh + source $BP_DIR/bin/install-meteor-verbose.sh status "Done" status "Updating PATH with Meteor" @@ -60,15 +60,19 @@ install_meteor() { } build() { - ( - cd $BUILD_DIR - status "Building meteor bundle" - meteor build --directory deploy --server http://localhost:3000 - cd deploy/bundle/programs/server - status "Installing npm dependencies" - npm install 2>&1 | indent - mv $BUILD_DIR/.vendor $BUILD_DIR/vendor - ) + cd $BUILD_DIR + + # If we use npm on root, run npm install. + if [[ -e ./package.json ]]; then + npm install + fi + + status "Building meteor bundle" + meteor build --directory deploy --server http://localhost:3000 + cd deploy/bundle/programs/server + status "Installing npm dependencies" + npm install 2>&1 | indent + mv $BUILD_DIR/.vendor $BUILD_DIR/vendor } [ ! -d $BUILD_DIR ] && mkdir $BUILD_DIR From 5fa91e48e66f51a53ff809e0878b2bf4eedb97e7 Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Mon, 8 Aug 2016 11:54:54 +1000 Subject: [PATCH 36/48] Update script to use cache etc like meteor-buildpack-horse --- bin/compile | 149 ++++++++++++++-------- bin/install-meteor-verbose.sh | 231 ---------------------------------- 2 files changed, 94 insertions(+), 286 deletions(-) delete mode 100644 bin/install-meteor-verbose.sh diff --git a/bin/compile b/bin/compile index 3ff9546..f0ef5bc 100755 --- a/bin/compile +++ b/bin/compile @@ -1,9 +1,10 @@ #!/bin/bash +set -e + BUILD_DIR=$1 CACHE_DIR=$2 METEOR_HOME=$BUILD_DIR/.meteor/local -PATH=$METEOR_HOME/usr/bin:$METEOR_HOME/usr/lib/meteor/bin:$PATH BP_DIR=$(cd $(dirname ${0:-}); cd ..; pwd) indent() { @@ -18,69 +19,102 @@ status() { echo "-----> $*" } -node_version=$(curl --silent --get https://semver.io/node/resolve/0.10.x) - -install_node() { - if [ -f "$BUILD_DIR/.vendor/node/bin/node" ] ; then - status "Skipping Node installation. Already installed." - return - fi - - # Download node from Heroku's S3 mirror of nodejs.org/dist - status "Downloading and installing node $node_version" - NODE_INSTALLER=node-installer.tar.gz - NODE_URL="http://s3pository.heroku.com/node/v$node_version/node-v$node_version-linux-x64.tar.gz" - curl $NODE_URL > $NODE_INSTALLER - tar xzf $NODE_INSTALLER -C $BUILD_DIR - - # Move node (and npm) into ./.vendor and make them executable - mkdir -p $BUILD_DIR/.vendor - mv $BUILD_DIR/node-v$node_version-linux-x64 $BUILD_DIR/.vendor/node - chmod +x $BUILD_DIR/.vendor/node/bin/* - PATH=$BUILD_DIR/.vendor/node/bin:$PATH -} +[ ! -d $BUILD_DIR ] && mkdir $BUILD_DIR +[ ! -d $CACHE_DIR ] && mkdir $CACHE_DIR -install_meteor() { - if [ -f "$METEOR_HOME/usr/bin/meteor" ] ; then - status "Skipping Meteor installation. Already installed." - return - fi +APP_RELEASE=`cat "$BUILD_DIR/.meteor/release" | sed -e 's/METEOR@//'` - # status "Install Meteor" - # export PATH=/usr/bin:$PATH # necessary for install script to run from URL - # curl https://install.meteor.com | sh - status "Downloading Meteor install script" +# Where we will install meteor. Has to be outside the APP_CHECKOUT_DIR. +METEOR_DIR="$CACHE_DIR/$APP_RELEASE" +# Where we'll put things we compile. +COMPILE_DIR_SUFFIX=".meteor/cf_build" +COMPILE_DIR="$APP_CHECKOUT_DIR"/"$COMPILE_DIR_SUFFIX" - status "Execute $BP_DIR/bin/install-meteor-verbose.sh" - source $BP_DIR/bin/install-meteor-verbose.sh - status "Done" +# Create directories as needed. +mkdir -p "$BUILD_DIR" "$METEOR_DIR" +mkdir -p "$COMPILE_DIR" "$COMPILE_DIR/bin" "$COMPILE_DIR/lib" - status "Updating PATH with Meteor" - PATH=$HOME/.meteor:$PATH -} +# +# Install meteor +# + +if [ ! -e "$METEOR_DIR/.meteor/meteor" ]; then + status "Installing meteor" + curl -sS "https://install.meteor.com/?release=$APP_RELEASE" | HOME="$METEOR_DIR" /bin/sh +fi -build() { - cd $BUILD_DIR +METEOR="$METEOR_DIR/.meteor/meteor" # The meteor binary. - # If we use npm on root, run npm install. - if [[ -e ./package.json ]]; then - npm install - fi +status "-----> Meteor version: `$METEOR --version`" - status "Building meteor bundle" - meteor build --directory deploy --server http://localhost:3000 - cd deploy/bundle/programs/server - status "Installing npm dependencies" - npm install 2>&1 | indent - mv $BUILD_DIR/.vendor $BUILD_DIR/vendor -} +# +# Build the meteor app! +# +cd "$BUILD_DIR" -[ ! -d $BUILD_DIR ] && mkdir $BUILD_DIR -[ ! -d $CACHE_DIR ] && mkdir $CACHE_DIR +# Determine if we have --server-only flag capability. Allow non-zero return from grep. +status "Checking if this meteor version supports --server-only" +set +e +HAS_SERVER_ONLY=`HOME=$METEOR_DIR $METEOR help build | grep -e '--server-only'` +set -e +if [ -n "$HAS_SERVER_ONLY" ] ; then + SERVER_ONLY_FLAG='--server-only' +else + SERVER_ONLY_FLAG="" +fi + +METEOR_NPM=`find $METEOR_DIR -wholename "*/dev_bundle/bin/npm"` +METEOR_NODE=`find $METEOR_DIR -wholename "*/dev_bundle/bin/node"` +# Trim whitespace +METEOR_NPM=`echo "$METEOR_NPM" | sed -e 's/[[:space:]]*$//'` +METEOR_NODE=`echo "$METEOR_NODE" | sed -e 's/[[:space:]]*$//'` +if [ -z "$METEOR_NPM" ] || [ -z "$METEOR_NODE" ] ; then + echo "FATAL: Can't find npm/node within meteor bundle. This is a bug. Please open an issue at https://github.com/AdmitHub/meteor-buildpack-horse."; + exit 1 +fi + +# Copy node into place for production. +NODE="$COMPILE_DIR"/bin/node +cp "$METEOR_NODE" "$NODE" +chmod a+x "$NODE" + +# Add npm and node path so that 1.4's npm-rebuild.js will function. +PATH="$METEOR_DIR/.meteor:`dirname $METEOR_NPM`:$COMPILE_DIR/bin:$PATH" + +status "Using node: `$NODE --version`" +status " and npm: `$METEOR_NPM --version`" + +# If we use npm on root, run npm install. Don't use `--production` here, as we +# may need devDependencies (e.g. webpack) in order to build the meteor app. +if [ -e "$APP_SOURCE_DIR"/package.json ]; then + $METEOR_NPM install +fi + +# Now on to bundling. Don't put the bundle in $APP_CHECKOUT_DIR during +# bundling, or it will recurse, trying to bundle up its own bundling. + +status "Building Meteor app" +BUNDLE_DEST=`mktemp -d "$BP_DIR/build-XXXX"` + +# The actual invocation of `meteor build`! +HOME=$METEOR_DIR $METEOR build --server http://localhost:3000 $SERVER_ONLY_FLAG --directory $BUNDLE_DEST + +status "Moving built slug to $COMPILE_DIR/app" +mv $BUNDLE_DEST/bundle "$COMPILE_DIR/app" +rmdir $BUNDLE_DEST + +# Run npm install on the built slug; only for `--production` dependencies. +status "Installing npm production dependencies on built slug" +if [ -e "$COMPILE_DIR"/app/programs/server/package.json ]; then + cd "$COMPILE_DIR"/app/programs/server + $METEOR_NPM install --production + cd "$APP_SOURCE_DIR" +fi -install_node -install_meteor -build +# +# Environment +# +# Add an export of PATH which includes our compile dir, etc. #make the .vendor directory since there was no node installer mkdir -p $BUILD_DIR/.vendor @@ -93,6 +127,11 @@ chmod +x $BUILD_DIR/.vendor/jq mkdir -p $BUILD_DIR/.profile.d cp $BP_DIR/profile/* $BUILD_DIR/.profile.d/ +cat > "$APP_CHECKOUT_DIR"/.profile.d/path.sh <&2 - - -UNAME=$(uname) -# Check to see if it starts with MINGW. -if [ "$UNAME" ">" "MINGW" -a "$UNAME" "<" "MINGX" ] ; then - echo "To install Meteor on Windows, download the installer from:" - echo "https://install.meteor.com/windows" - exit 1 -fi -if [ "$UNAME" != "Linux" -a "$UNAME" != "Darwin" ] ; then - echo "Sorry, this OS is not supported yet via this installer." - echo "For more details on supported platforms, see https://www.meteor.com/install" - exit 1 -fi - - -if [ "$UNAME" = "Darwin" ] ; then - ### OSX ### - if [ "i386" != "$(uname -p)" -o "1" != "$(sysctl -n hw.cpu64bit_capable 2>/dev/null || echo 0)" ] ; then - # Can't just test uname -m = x86_64, because Snow Leopard can - # return other values. - echo "Only 64-bit Intel processors are supported at this time." - exit 1 - fi - - # Running a version of Meteor older than 0.6.0 (April 2013)? - if grep BUNDLE_VERSION /usr/local/bin/meteor >/dev/null 2>&1 ; then - echo "You appear to have a very old version of Meteor installed." - echo "Please remove it by running these commands:" - echo " $ sudo rm /usr/local/bin/meteor" - echo " $ sudo rm -rf /usr/local/meteor /usr/local/meteor.old" - echo "and then run the installer command again:" - echo " $ curl https://install.meteor.com/ | sh" - exit 1 - fi - - PLATFORM="os.osx.x86_64" -elif [ "$UNAME" = "Linux" ] ; then - ### Linux ### - LINUX_ARCH=$(uname -m) - if [ "${LINUX_ARCH}" = "i686" ] ; then - PLATFORM="os.linux.x86_32" - elif [ "${LINUX_ARCH}" = "x86_64" ] ; then - PLATFORM="os.linux.x86_64" - else - echo "Unusable architecture: ${LINUX_ARCH}" - echo "Meteor only supports i686 and x86_64 for now." - exit 1 - fi - - # Running a version of Meteor older than 0.6.0 (April 2013) on a dpkg system? - if dpkg -s meteor >/dev/null 2>&1 ; then - echo "You appear to have a very old version of Meteor installed." - echo "Please remove it by running these commands:" - echo " $ sudo dpkg -r meteor" - echo " $ hash -r" - echo "and then run the installer command again:" - echo " $ curl https://install.meteor.com/ | sh" - exit 1 - fi - - # Running a version of Meteor older than 0.6.0 (April 2013) on an rpm system? - if rpm -q meteor >/dev/null 2>&1 ; then - echo "You appear to have a very old version of Meteor installed." - echo "Please remove it by running these commands:" - echo " $ sudo rpm -e meteor" - echo " $ hash -r" - echo "and then run the installer command again:" - echo " $ curl https://install.meteor.com/ | sh" - exit 1 - fi -fi - -trap "echo Installation failed." EXIT - -# If you already have a tropohouse/warehouse, we do a clean install here: -if [ -e "$HOME/.meteor" ]; then - echo "Removing your existing Meteor installation." - rm -rf "$HOME/.meteor" -fi - -TARBALL_URL="https://d3sqy0vbqsdhku.cloudfront.net/packages-bootstrap/${RELEASE}/meteor-bootstrap-${PLATFORM}.tar.gz" - -INSTALL_TMPDIR="$HOME/.meteor-install-tmp" -rm -rf "$INSTALL_TMPDIR" -mkdir "$INSTALL_TMPDIR" -echo "Downloading Meteor distribution" -curl "$TARBALL_URL" > meteor-bundle.tgz; tar -xzf meteor-bundle.tgz -C "$INSTALL_TMPDIR" -o -# bomb out if it didn't work, eg no net -test -x "${INSTALL_TMPDIR}/.meteor/meteor" -mv "${INSTALL_TMPDIR}/.meteor" "$HOME" -rm -rf "${INSTALL_TMPDIR}" -# just double-checking :) -test -x "$HOME/.meteor/meteor" - - - -echo -echo "Meteor ${RELEASE} has been installed in your home directory (~/.meteor)." - -METEOR_SYMLINK_TARGET="$(readlink "$HOME/.meteor/meteor")" -METEOR_TOOL_DIRECTORY="$(dirname "$METEOR_SYMLINK_TARGET")" -LAUNCHER="$HOME/.meteor/$METEOR_TOOL_DIRECTORY/scripts/admin/launch-meteor" - - - - -if cp "$LAUNCHER" "$PREFIX/bin/meteor" >/dev/null 2>&1; then - echo "Writing a launcher script to $PREFIX/bin/meteor for your convenience." - cat <<"EOF" - -To get started fast: - - $ meteor create ~/my_cool_app - $ cd ~/my_cool_app - $ meteor - -Or see the docs at: - - docs.meteor.com - -EOF -elif type sudo >/dev/null 2>&1; then - echo "Writing a launcher script to $PREFIX/bin/meteor for your convenience." - echo "This may prompt for your password." - - # New macs (10.9+) don't ship with /usr/local, however it is still in - # the default PATH. We still install there, we just need to create the - # directory first. - # XXX this means that we can run sudo too many times. we should never - # run it more than once if it fails the first time - if [ ! -d "$PREFIX/bin" ] ; then - sudo mkdir -m 755 "$PREFIX" || true - sudo mkdir -m 755 "$PREFIX/bin" || true - fi - - if sudo cp "$LAUNCHER" "$PREFIX/bin/meteor"; then - cat <<"EOF" - -To get started fast: - - $ meteor create ~/my_cool_app - $ cd ~/my_cool_app - $ meteor - -Or see the docs at: - - docs.meteor.com - -EOF - else - cat < Date: Mon, 8 Aug 2016 12:10:26 +1000 Subject: [PATCH 37/48] Path fixes --- bin/compile | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/bin/compile b/bin/compile index f0ef5bc..5928a40 100755 --- a/bin/compile +++ b/bin/compile @@ -19,16 +19,13 @@ status() { echo "-----> $*" } -[ ! -d $BUILD_DIR ] && mkdir $BUILD_DIR -[ ! -d $CACHE_DIR ] && mkdir $CACHE_DIR - APP_RELEASE=`cat "$BUILD_DIR/.meteor/release" | sed -e 's/METEOR@//'` # Where we will install meteor. Has to be outside the APP_CHECKOUT_DIR. METEOR_DIR="$CACHE_DIR/$APP_RELEASE" # Where we'll put things we compile. COMPILE_DIR_SUFFIX=".meteor/cf_build" -COMPILE_DIR="$APP_CHECKOUT_DIR"/"$COMPILE_DIR_SUFFIX" +COMPILE_DIR="$BUILD_DIR"/"$COMPILE_DIR_SUFFIX" # Create directories as needed. mkdir -p "$BUILD_DIR" "$METEOR_DIR" @@ -116,9 +113,6 @@ fi # # Add an export of PATH which includes our compile dir, etc. -#make the .vendor directory since there was no node installer -mkdir -p $BUILD_DIR/.vendor - #copy jq to be used at runtime cp $BP_DIR/bin/jq $BUILD_DIR/.vendor/jq chmod +x $BUILD_DIR/.vendor/jq From 10fd946fa30a97a6bdb28c00b47ddc67a5496248 Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Mon, 8 Aug 2016 12:16:05 +1000 Subject: [PATCH 38/48] wrong variable --- bin/compile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/compile b/bin/compile index 5928a40..6bf789b 100755 --- a/bin/compile +++ b/bin/compile @@ -83,7 +83,7 @@ status " and npm: `$METEOR_NPM --version`" # If we use npm on root, run npm install. Don't use `--production` here, as we # may need devDependencies (e.g. webpack) in order to build the meteor app. -if [ -e "$APP_SOURCE_DIR"/package.json ]; then +if [ -e "$BUILD_DIR"/package.json ]; then $METEOR_NPM install fi @@ -105,7 +105,7 @@ status "Installing npm production dependencies on built slug" if [ -e "$COMPILE_DIR"/app/programs/server/package.json ]; then cd "$COMPILE_DIR"/app/programs/server $METEOR_NPM install --production - cd "$APP_SOURCE_DIR" + cd "$BUILD_DIR" fi # From efc81b211bda6bee8622febdfe39e1bbf36bd759 Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Mon, 8 Aug 2016 12:25:43 +1000 Subject: [PATCH 39/48] jq failing --- bin/compile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/compile b/bin/compile index 6bf789b..b4a0b6e 100755 --- a/bin/compile +++ b/bin/compile @@ -19,6 +19,14 @@ status() { echo "-----> $*" } +#copy jq to be used at runtime +cp $BP_DIR/bin/jq $BUILD_DIR/.vendor/jq +chmod +x $BUILD_DIR/.vendor/jq + +#copy the env.sh file to run on runtime +mkdir -p $BUILD_DIR/.profile.d +cp $BP_DIR/profile/* $BUILD_DIR/.profile.d/ + APP_RELEASE=`cat "$BUILD_DIR/.meteor/release" | sed -e 's/METEOR@//'` # Where we will install meteor. Has to be outside the APP_CHECKOUT_DIR. @@ -113,14 +121,6 @@ fi # # Add an export of PATH which includes our compile dir, etc. -#copy jq to be used at runtime -cp $BP_DIR/bin/jq $BUILD_DIR/.vendor/jq -chmod +x $BUILD_DIR/.vendor/jq - -#copy the env.sh file to run on runtime -mkdir -p $BUILD_DIR/.profile.d -cp $BP_DIR/profile/* $BUILD_DIR/.profile.d/ - cat > "$APP_CHECKOUT_DIR"/.profile.d/path.sh < Date: Mon, 8 Aug 2016 12:30:16 +1000 Subject: [PATCH 40/48] Still need to create .vendor directory --- bin/compile | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/bin/compile b/bin/compile index b4a0b6e..1824437 100755 --- a/bin/compile +++ b/bin/compile @@ -19,14 +19,6 @@ status() { echo "-----> $*" } -#copy jq to be used at runtime -cp $BP_DIR/bin/jq $BUILD_DIR/.vendor/jq -chmod +x $BUILD_DIR/.vendor/jq - -#copy the env.sh file to run on runtime -mkdir -p $BUILD_DIR/.profile.d -cp $BP_DIR/profile/* $BUILD_DIR/.profile.d/ - APP_RELEASE=`cat "$BUILD_DIR/.meteor/release" | sed -e 's/METEOR@//'` # Where we will install meteor. Has to be outside the APP_CHECKOUT_DIR. @@ -120,6 +112,15 @@ fi # Environment # # Add an export of PATH which includes our compile dir, etc. +mkdir -p $BUILD_DIR/.vendor + +#copy jq to be used at runtime +cp $BP_DIR/bin/jq $BUILD_DIR/.vendor/jq +chmod +x $BUILD_DIR/.vendor/jq + +#copy the env.sh file to run on runtime +mkdir -p $BUILD_DIR/.profile.d +cp $BP_DIR/profile/* $BUILD_DIR/.profile.d/ cat > "$APP_CHECKOUT_DIR"/.profile.d/path.sh < Date: Mon, 8 Aug 2016 12:43:11 +1000 Subject: [PATCH 41/48] wrong path for path.sh --- bin/compile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/compile b/bin/compile index 1824437..90782ea 100755 --- a/bin/compile +++ b/bin/compile @@ -42,7 +42,7 @@ fi METEOR="$METEOR_DIR/.meteor/meteor" # The meteor binary. -status "-----> Meteor version: `$METEOR --version`" +status "Meteor version: `$METEOR --version`" # # Build the meteor app! @@ -122,7 +122,7 @@ chmod +x $BUILD_DIR/.vendor/jq mkdir -p $BUILD_DIR/.profile.d cp $BP_DIR/profile/* $BUILD_DIR/.profile.d/ -cat > "$APP_CHECKOUT_DIR"/.profile.d/path.sh < "$BUILD_DIR"/.profile.d/path.sh < Date: Mon, 8 Aug 2016 13:04:44 +1000 Subject: [PATCH 42/48] Echo found version --- bin/compile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/compile b/bin/compile index 90782ea..20154ec 100755 --- a/bin/compile +++ b/bin/compile @@ -31,6 +31,8 @@ COMPILE_DIR="$BUILD_DIR"/"$COMPILE_DIR_SUFFIX" mkdir -p "$BUILD_DIR" "$METEOR_DIR" mkdir -p "$COMPILE_DIR" "$COMPILE_DIR/bin" "$COMPILE_DIR/lib" +status "Found Meteor APP version $APP_RELEASE" + # # Install meteor # From 421a6ce9c6c11fcdcc6ceb97a3034b32d6171eac Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Mon, 8 Aug 2016 13:13:49 +1000 Subject: [PATCH 43/48] Need home path for meteor to work --- bin/compile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bin/compile b/bin/compile index 20154ec..20ab2eb 100755 --- a/bin/compile +++ b/bin/compile @@ -31,8 +31,6 @@ COMPILE_DIR="$BUILD_DIR"/"$COMPILE_DIR_SUFFIX" mkdir -p "$BUILD_DIR" "$METEOR_DIR" mkdir -p "$COMPILE_DIR" "$COMPILE_DIR/bin" "$COMPILE_DIR/lib" -status "Found Meteor APP version $APP_RELEASE" - # # Install meteor # @@ -44,7 +42,7 @@ fi METEOR="$METEOR_DIR/.meteor/meteor" # The meteor binary. -status "Meteor version: `$METEOR --version`" +status "Meteor version: `HOME=$METEOR_DIR $METEOR --version`" # # Build the meteor app! From 7414d342956cd1dbdaf0cecd3ead7abe8516ccf9 Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Thu, 11 Aug 2016 14:36:57 +1000 Subject: [PATCH 44/48] Code being copiled to different directory --- bin/release | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/release b/bin/release index c2556dd..5ffa95b 100755 --- a/bin/release +++ b/bin/release @@ -7,5 +7,5 @@ BUILD_DIR=$1 cat <<-YAML --- default_process_types: - web: vendor/node/bin/node deploy/bundle/main.js + web: .meteor/heroku_build/bin/node .meteor/cf_build/app/main.js YAML From 33868af72fb20b70489ef31fb4714ccef3b1cb74 Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Thu, 11 Aug 2016 14:42:24 +1000 Subject: [PATCH 45/48] Still wrong path for node --- bin/release | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/release b/bin/release index 5ffa95b..0253ee5 100755 --- a/bin/release +++ b/bin/release @@ -7,5 +7,5 @@ BUILD_DIR=$1 cat <<-YAML --- default_process_types: - web: .meteor/heroku_build/bin/node .meteor/cf_build/app/main.js + web: .meteor/cf_build/bin/node .meteor/cf_build/app/main.js YAML From 829f831613c55f6be2c891de9aecfd1cc12a9ff1 Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Tue, 13 Sep 2016 11:29:24 +1000 Subject: [PATCH 46/48] Remove -e --- bin/compile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/compile b/bin/compile index 20ab2eb..662eca3 100755 --- a/bin/compile +++ b/bin/compile @@ -1,6 +1,6 @@ #!/bin/bash -set -e +#set -e BUILD_DIR=$1 CACHE_DIR=$2 From 429d7df47c61d1cb608f5c4c82e8f4e17fe6aa1d Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Tue, 13 Sep 2016 11:46:27 +1000 Subject: [PATCH 47/48] Meteor debug build --- bin/compile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/compile b/bin/compile index 662eca3..a558653 100755 --- a/bin/compile +++ b/bin/compile @@ -1,6 +1,6 @@ #!/bin/bash -#set -e +set -e BUILD_DIR=$1 CACHE_DIR=$2 @@ -94,7 +94,7 @@ status "Building Meteor app" BUNDLE_DEST=`mktemp -d "$BP_DIR/build-XXXX"` # The actual invocation of `meteor build`! -HOME=$METEOR_DIR $METEOR build --server http://localhost:3000 $SERVER_ONLY_FLAG --directory $BUNDLE_DEST +METEOR_PROGRESS_DEBUG=1 HOME=$METEOR_DIR $METEOR build --server http://localhost:3000 $SERVER_ONLY_FLAG --directory $BUNDLE_DEST status "Moving built slug to $COMPILE_DIR/app" mv $BUNDLE_DEST/bundle "$COMPILE_DIR/app" From 4a945994856cff4b229f5997ae1c05d959d7b4c4 Mon Sep 17 00:00:00 2001 From: Cameron Crothers Date: Tue, 13 Sep 2016 13:54:29 +1000 Subject: [PATCH 48/48] Grab code from horse and try --production for npm --- bin/compile | 187 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 134 insertions(+), 53 deletions(-) diff --git a/bin/compile b/bin/compile index a558653..337cd67 100755 --- a/bin/compile +++ b/bin/compile @@ -1,56 +1,117 @@ -#!/bin/bash +#!/bin/sh +# +# Heroku buildpack for Bluemix +# + +# fail fast. set -e +# debug verbosely. +#set -x + +# Load config vars into environment (from https://devcenter.heroku.com/articles/buildpack-api) +export_env_dir() { + env_dir=$1 + whitelist_regex=${2:-''} + blacklist_regex=${3:-'^(PATH|GIT_DIR|CPATH|CPPATH|LD_PRELOAD|LIBRARY_PATH)$'} + if [ -d "$env_dir" ]; then + for e in $(ls $env_dir); do + echo "$e" | grep -E "$whitelist_regex" | grep -qvE "$blacklist_regex" && + export "$e=$(cat $env_dir/$e)" + : + done + fi +} + +export_env_dir $3 -BUILD_DIR=$1 +# Enable verbose debugging if configured to -- though this has to come after +# we've loaded environment configs. +if [ -n "${BUILDPACK_VERBOSE+1}" ]; then + set -x +fi + + +# Get the path to dir one above this file. +BUILDPACK_DIR=$(cd -P -- "$(dirname -- "$0")" && cd .. && pwd -P) +# Get the directory our app is checked out in (the "BUILD_DIR"), passed by Heroku +APP_CHECKOUT_DIR=$1 CACHE_DIR=$2 -METEOR_HOME=$BUILD_DIR/.meteor/local -BP_DIR=$(cd $(dirname ${0:-}); cd ..; pwd) - -indent() { - c='s/^/ /' - case $(uname) in - Darwin) sed -l "$c";; # mac/bsd sed: -l buffers on line boundaries - *) sed -u "$c";; # unix/gnu sed: -u unbuffered (arbitrary) chunks of data - esac -} +if [ -n "${BUILDPACK_CLEAR_CACHE+1}" ]; then + echo "----> Clearing cache dir." + rm -rf "$CACHE_DIR" +fi -status() { - echo "-----> $*" -} +# +# Find the meteor app ($APP_SOURCE_DIR). +# + +# Set meteor app dir's location to the root of the git repo, plus the value of +# METEOR_APP_DIR (which defaults empty). If you put the meteor app in src/ or +# some other subdirectory, define METEOR_APP_DIR. +APP_SOURCE_DIR="${APP_CHECKOUT_DIR}" +if [ -n "$METEOR_APP_DIR" ]; then + APP_SOURCE_DIR="${APP_SOURCE_DIR}/${METEOR_APP_DIR}" +fi + +# Try "$APP_SOURCE_DIR/app/" if meteor app isn't there (the "Iron scaffolding +# tool" default). +if [ ! -d "$APP_SOURCE_DIR/.meteor" ] && [ -d "$APP_SOURCE_DIR/app/.meteor" ]; then + APP_SOURCE_DIR="$APP_SOURCE_DIR/app/" +fi +if [ ! -d "$APP_SOURCE_DIR/.meteor" ]; then + echo "FATAL: Can't find meteor app. Set METEOR_APP_DIR to the relative location of the meteor app within your repository if it's not in the root or 'app/' subdirectory. (Tried ${APP_SOURCE_DIR})" + exit 1 +fi -APP_RELEASE=`cat "$BUILD_DIR/.meteor/release" | sed -e 's/METEOR@//'` +APP_RELEASE=`cat "$APP_SOURCE_DIR/.meteor/release" | sed -e 's/METEOR@//'` # Where we will install meteor. Has to be outside the APP_CHECKOUT_DIR. METEOR_DIR="$CACHE_DIR/$APP_RELEASE" # Where we'll put things we compile. -COMPILE_DIR_SUFFIX=".meteor/cf_build" -COMPILE_DIR="$BUILD_DIR"/"$COMPILE_DIR_SUFFIX" +COMPILE_DIR_SUFFIX=".meteor/heroku_build" +COMPILE_DIR="$APP_CHECKOUT_DIR"/"$COMPILE_DIR_SUFFIX" +# Try to minimize meteor's printing, unless we're running verbosely. +if [ -z "$BUILDPACK_VERBOSE" ]; then + METEOR_PRETTY_OUTPUT=0 +fi # Create directories as needed. -mkdir -p "$BUILD_DIR" "$METEOR_DIR" +mkdir -p "$APP_CHECKOUT_DIR" "$METEOR_DIR" mkdir -p "$COMPILE_DIR" "$COMPILE_DIR/bin" "$COMPILE_DIR/lib" +# Set a default ROOT_URL if one is not defined. Currently, HEROKU_APP_NAME is +# only available if you enable the labs addon "Heroku Dyno Metadata": +# https://devcenter.heroku.com/articles/dyno-metadata +# This logic is duplicated in extra/root_url.sh so that it repeats on dyno +# restart. +if [ -z "$ROOT_URL" ] && [ -n "$HEROKU_APP_NAME" ] ; then + export ROOT_URL="https://${HEROKU_APP_NAME}.herokuapp.com" +fi +if [ -z "$ROOT_URL" ] ; then + echo "FATAL: ROOT_URL is not defined." + exit 1 +fi + # # Install meteor # if [ ! -e "$METEOR_DIR/.meteor/meteor" ]; then - status "Installing meteor" + echo "-----> Installing meteor" curl -sS "https://install.meteor.com/?release=$APP_RELEASE" | HOME="$METEOR_DIR" /bin/sh fi - METEOR="$METEOR_DIR/.meteor/meteor" # The meteor binary. -status "Meteor version: `HOME=$METEOR_DIR $METEOR --version`" +echo "-----> Meteor version: `HOME=$METEOR_DIR $METEOR --version`" # # Build the meteor app! # -cd "$BUILD_DIR" +cd "$APP_SOURCE_DIR" # Determine if we have --server-only flag capability. Allow non-zero return from grep. -status "Checking if this meteor version supports --server-only" +echo "-----> Checking if this meteor version supports --server-only" set +e HAS_SERVER_ONLY=`HOME=$METEOR_DIR $METEOR help build | grep -e '--server-only'` set -e @@ -59,6 +120,19 @@ if [ -n "$HAS_SERVER_ONLY" ] ; then else SERVER_ONLY_FLAG="" fi +# Remove the Android platform if we don't support the --server-only flag. iOS +# platform gets ignored properly. +if [ -z "$SERVER_ONLY_FLAG" ]; then + echo "-----> Attempting to remove android platform." + HOME=$METEOR_DIR $METEOR remove-platform android || true + echo "-----> Moving on." +fi + +# Identify the npm/node to use. While we could use `meteor node` and `meteor +# npm` to execute these directly, to use them in prod, we'd need to copy the +# meteor world into the built slug, and that's too large (Issue #125). +# Instead, search for the binaries within meteor, and copy them into our built +# slug. METEOR_NPM=`find $METEOR_DIR -wholename "*/dev_bundle/bin/npm"` METEOR_NODE=`find $METEOR_DIR -wholename "*/dev_bundle/bin/node"` @@ -78,59 +152,66 @@ chmod a+x "$NODE" # Add npm and node path so that 1.4's npm-rebuild.js will function. PATH="$METEOR_DIR/.meteor:`dirname $METEOR_NPM`:$COMPILE_DIR/bin:$PATH" -status "Using node: `$NODE --version`" -status " and npm: `$METEOR_NPM --version`" +echo "-----> Using node: `$NODE --version`" +echo "-----> and npm: `$METEOR_NPM --version`" + +# If we use npm on root, run npm install. +if [ -e "$APP_SOURCE_DIR"/package.json ]; then + $METEOR_NPM install --production +fi -# If we use npm on root, run npm install. Don't use `--production` here, as we -# may need devDependencies (e.g. webpack) in order to build the meteor app. -if [ -e "$BUILD_DIR"/package.json ]; then - $METEOR_NPM install +# Related to https://github.com/meteor/meteor/issues/2796 and +# https://github.com/meteor/meteor/issues/2606. Some packages only build their +# assets at runtime, and thus they are not available for bundling unless meteor +# has been launched. To opt-in to this, set BUILDPACK_PRELAUNCH_METEOR=1. +if [ -n "${BUILDPACK_PRELAUNCH_METEOR+1}" ]; then + echo "-----> BUILDPACK_PRELAUNCH_METEOR: Pre-launching meteor to build packages assets" + # Remove the Android platform because it fails due to the Android tools not + # being installed, but leave the iOS platform because it's ignored. + HOME=$METEOR_DIR $METEOR remove-platform android || true + HOME=$METEOR_DIR timeout -s9 60 $METEOR --settings settings.json || true fi # Now on to bundling. Don't put the bundle in $APP_CHECKOUT_DIR during # bundling, or it will recurse, trying to bundle up its own bundling. -status "Building Meteor app" -BUNDLE_DEST=`mktemp -d "$BP_DIR/build-XXXX"` +echo "-----> Building Meteor app with ROOT_URL: $ROOT_URL" +BUNDLE_DEST=`mktemp -d "$BUILDPACK_DIR/build-XXXX"` # The actual invocation of `meteor build`! -METEOR_PROGRESS_DEBUG=1 HOME=$METEOR_DIR $METEOR build --server http://localhost:3000 $SERVER_ONLY_FLAG --directory $BUNDLE_DEST +HOME=$METEOR_DIR $METEOR build $BUILD_OPTIONS --server $ROOT_URL $SERVER_ONLY_FLAG --directory $BUNDLE_DEST -status "Moving built slug to $COMPILE_DIR/app" +echo "-----> Moving built slug to $COMPILE_DIR/app" mv $BUNDLE_DEST/bundle "$COMPILE_DIR/app" rmdir $BUNDLE_DEST # Run npm install on the built slug; only for `--production` dependencies. -status "Installing npm production dependencies on built slug" +echo "-----> Installing npm production dependencies on built slug" if [ -e "$COMPILE_DIR"/app/programs/server/package.json ]; then cd "$COMPILE_DIR"/app/programs/server $METEOR_NPM install --production - cd "$BUILD_DIR" + cd "$APP_SOURCE_DIR" fi # # Environment # # Add an export of PATH which includes our compile dir, etc. -mkdir -p $BUILD_DIR/.vendor - -#copy jq to be used at runtime -cp $BP_DIR/bin/jq $BUILD_DIR/.vendor/jq -chmod +x $BUILD_DIR/.vendor/jq - -#copy the env.sh file to run on runtime -mkdir -p $BUILD_DIR/.profile.d -cp $BP_DIR/profile/* $BUILD_DIR/.profile.d/ - -cat > "$BUILD_DIR"/.profile.d/path.sh < Adding PATH environment" +mkdir -p "$APP_CHECKOUT_DIR"/.profile.d +cat > "$APP_CHECKOUT_DIR"/.profile.d/path.sh < Running extras" +for file in `ls "$BUILDPACK_DIR"/extra | sort`; do + . "$BUILDPACK_DIR"/extra/$file +done