Merge branch 'master' into 3016-pipeline-template-search-string
[arvados.git] / docker / build.sh
1 #! /bin/bash
2
3 # make sure Ruby 1.9.3 is installed before proceeding
4 if ! ruby -e 'exit RUBY_VERSION >= "1.9.3"' 2>/dev/null
5 then
6     echo "Installing Arvados requires at least Ruby 1.9.3."
7     echo "You may need to enter your password."
8     read -p "Press Ctrl-C to abort, or else press ENTER to install ruby1.9.3 and continue. " unused
9
10     sudo apt-get update
11     sudo apt-get -y install ruby1.9.3
12 fi
13
14 function usage {
15     echo >&2
16     echo >&2 "usage: $0 [options]"
17     echo >&2
18     echo >&2 "Calling $0 without arguments will build all Arvados docker images"
19     echo >&2
20     echo >&2 "$0 options:"
21     echo >&2 "  -h, --help   Print this help text"
22     echo >&2 "  clean        Clear all build information"
23     echo >&2 "  realclean    clean and remove all Arvados Docker images except arvados/debian"
24     echo >&2 "  deepclean    realclean and remove arvados/debian, crosbymichael/skydns and "
25     echo >&2 "               crosbymichael/skydns Docker images"
26     echo >&2
27 }
28
29 if [ "$1" = '-h' ] || [ "$1" = '--help' ]; then
30   usage
31   exit 1
32 fi
33
34 build_tools/build.rb
35
36 if [[ "$?" == "0" ]]; then
37     DOCKER=`which docker.io`
38
39     if [[ "$DOCKER" == "" ]]; then
40       DOCKER=`which docker`
41     fi
42
43     DOCKER=$DOCKER /usr/bin/make -f build_tools/Makefile $*
44 fi