summaryrefslogtreecommitdiff
path: root/scripts/prepare_build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/prepare_build.sh')
-rwxr-xr-xscripts/prepare_build.sh28
1 files changed, 21 insertions, 7 deletions
diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh
index b6f076a90c3..4a7ee7dbb64 100755
--- a/scripts/prepare_build.sh
+++ b/scripts/prepare_build.sh
@@ -1,16 +1,30 @@
#!/bin/bash
+retry() {
+ for i in $(seq 1 3); do
+ if eval "$@"; then
+ return 0
+ fi
+ sleep 3s
+ echo "Retrying..."
+ done
+ return 1
+}
+
if [ -f /.dockerinit ]; then
mkdir -p vendor
- if [ ! -e vendor/phantomjs_1.9.8-0jessie_amd64.deb ]; then
+
+ # Install phantomjs package
+ pushd vendor
+ if [ ! -e phantomjs_1.9.8-0jessie_amd64.deb ]; then
wget -q https://gitlab.com/axil/phantomjs-debian/raw/master/phantomjs_1.9.8-0jessie_amd64.deb
- mv phantomjs_1.9.8-0jessie_amd64.deb vendor/
fi
- dpkg -i vendor/phantomjs_1.9.8-0jessie_amd64.deb
+ dpkg -i phantomjs_1.9.8-0jessie_amd64.deb
+ popd
- apt-get update -qq
- apt-get -o dir::cache::archives="vendor/apt" install -y -qq --force-yes \
- libicu-dev libkrb5-dev cmake nodejs postgresql-client mysql-client unzip
+ # Try to install packages
+ retry 'apt-get update -yqqq; apt-get -o dir::cache::archives="vendor/apt" install -y -qq --force-yes \
+ libicu-dev libkrb5-dev cmake nodejs postgresql-client mysql-client unzip'
cp config/database.yml.mysql config/database.yml
sed -i 's/username:.*/username: root/g' config/database.yml
@@ -20,7 +34,7 @@ if [ -f /.dockerinit ]; then
cp config/resque.yml.example config/resque.yml
sed -i 's/localhost/redis/g' config/resque.yml
- export FLAGS=(--path vendor)
+ export FLAGS=(--path vendor --retry 3)
else
export PATH=$HOME/bin:/usr/local/bin:/usr/bin:/bin
cp config/database.yml.mysql config/database.yml