Show More
@@ -1,42 +1,42 | |||||
1 | #!/bin/sh -eu |
|
1 | #!/bin/sh -eu | |
2 |
|
2 | |||
3 | # This function exists to set up the DOCKER variable and verify that |
|
3 | # This function exists to set up the DOCKER variable and verify that | |
4 | # it's the binary we expect. It also verifies that the docker service |
|
4 | # it's the binary we expect. It also verifies that the docker service | |
5 | # is running on the system and we can talk to it. |
|
5 | # is running on the system and we can talk to it. | |
6 | function checkdocker() { |
|
6 | function checkdocker() { | |
7 | if which docker.io >> /dev/null 2>&1 ; then |
|
7 | if which docker.io >> /dev/null 2>&1 ; then | |
8 | DOCKER=docker.io |
|
8 | DOCKER=docker.io | |
9 | elif which docker >> /dev/null 2>&1 ; then |
|
9 | elif which docker >> /dev/null 2>&1 ; then | |
10 | DOCKER=docker |
|
10 | DOCKER=docker | |
11 | else |
|
11 | else | |
12 | echo "Error: docker must be installed" |
|
12 | echo "Error: docker must be installed" | |
13 | exit 1 |
|
13 | exit 1 | |
14 | fi |
|
14 | fi | |
15 |
|
15 | |||
16 | $DOCKER -h 2> /dev/null | grep -q Jansens && { echo "Error: $DOCKER is the Docking System Tray - install docker.io instead"; exit 1; } |
|
16 | $DOCKER -h 2> /dev/null | grep -q Jansens && { echo "Error: $DOCKER is the Docking System Tray - install docker.io instead"; exit 1; } | |
17 | $DOCKER version | grep -q "^Client version:" || { echo "Error: unexpected output from \"$DOCKER version\""; exit 1; } |
|
17 | $DOCKER version | grep -q "^Client version:" || { echo "Error: unexpected output from \"$DOCKER version\""; exit 1; } | |
18 | $DOCKER version | grep -q "^Server version:" || { echo "Error: could not get docker server version - check it is running and your permissions"; exit 1; } |
|
18 | $DOCKER version | grep -q "^Server version:" || { echo "Error: could not get docker server version - check it is running and your permissions"; exit 1; } | |
19 | } |
|
19 | } | |
20 |
|
20 | |||
21 | # Construct a container and leave its name in $CONTAINER for future use. |
|
21 | # Construct a container and leave its name in $CONTAINER for future use. | |
22 | function initcontainer() { |
|
22 | function initcontainer() { | |
23 | [ "$1" ] || { echo "Error: platform name must be specified"; exit 1; } |
|
23 | [ "$1" ] || { echo "Error: platform name must be specified"; exit 1; } | |
24 |
|
24 | |||
25 | DFILE="$ROOTDIR/contrib/docker/$1" |
|
25 | DFILE="$ROOTDIR/contrib/docker/$1" | |
26 | [ -f "$DFILE" ] || { echo "Error: docker file $DFILE not found"; exit 1; } |
|
26 | [ -f "$DFILE" ] || { echo "Error: docker file $DFILE not found"; exit 1; } | |
27 |
|
27 | |||
28 | CONTAINER="hg-dockerrpm-$1" |
|
28 | CONTAINER="hg-dockerrpm-$1" | |
29 | DBUILDUSER=build |
|
29 | DBUILDUSER=build | |
30 | ( |
|
30 | ( | |
31 | cat $DFILE |
|
31 | cat $DFILE | |
32 | if [ $(uname) = "Darwin" ] ; then |
|
32 | if [ $(uname) = "Darwin" ] ; then | |
33 | # The builder is using boot2docker on OS X, so we're going to |
|
33 | # The builder is using boot2docker on OS X, so we're going to | |
34 | # *guess* the uid of the user inside the VM that is actually |
|
34 | # *guess* the uid of the user inside the VM that is actually | |
35 | # running docker. This is *very likely* to fail at some point. |
|
35 | # running docker. This is *very likely* to fail at some point. | |
36 | echo RUN useradd $DBUILDUSER -u 1000 |
|
36 | echo RUN useradd $DBUILDUSER -u 1000 | |
37 | else |
|
37 | else | |
38 | echo RUN groupadd $DBUILDUSER -g `id -g` |
|
38 | echo RUN groupadd $DBUILDUSER -g `id -g` --non-unique | |
39 | echo RUN useradd $DBUILDUSER -u `id -u` -g $DBUILDUSER |
|
39 | echo RUN useradd $DBUILDUSER -u `id -u` -g $DBUILDUSER --non-unique | |
40 | fi |
|
40 | fi | |
41 | ) | $DOCKER build --tag $CONTAINER - |
|
41 | ) | $DOCKER build --tag $CONTAINER - | |
42 | } |
|
42 | } |
General Comments 0
You need to be logged in to leave comments.
Login now