Show More
@@ -1,19 +1,35 b'' | |||||
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 | ||||
|
21 | # Construct a container and leave its name in $CONTAINER for future use. | |||
|
22 | function initcontainer() { | |||
|
23 | [ "$1" ] || { echo "Error: platform name must be specified"; exit 1; } | |||
|
24 | ||||
|
25 | DFILE="$ROOTDIR/contrib/docker/$1" | |||
|
26 | [ -f "$DFILE" ] || { echo "Error: docker file $DFILE not found"; exit 1; } | |||
|
27 | ||||
|
28 | CONTAINER="hg-dockerrpm-$1" | |||
|
29 | DBUILDUSER=build | |||
|
30 | ( | |||
|
31 | cat $DFILE | |||
|
32 | echo RUN groupadd $DBUILDUSER -g `id -g` | |||
|
33 | echo RUN useradd $DBUILDUSER -u `id -u` -g $DBUILDUSER | |||
|
34 | ) | $DOCKER build --tag $CONTAINER - | |||
|
35 | } |
@@ -1,48 +1,37 b'' | |||||
1 | #!/bin/bash -e |
|
1 | #!/bin/bash -e | |
2 |
|
2 | |||
3 | . $(dirname $0)/dockerlib.sh |
|
3 | . $(dirname $0)/dockerlib.sh | |
4 |
|
4 | |||
5 | BUILDDIR=$(dirname $0) |
|
5 | BUILDDIR=$(dirname $0) | |
6 | ROOTDIR=$(cd $BUILDDIR/..; pwd) |
|
6 | export ROOTDIR=$(cd $BUILDDIR/..; pwd) | |
7 |
|
7 | |||
8 | checkdocker |
|
8 | checkdocker | |
9 |
|
9 | |||
10 | PLATFORM="$1" |
|
10 | PLATFORM="$1" | |
11 | [ "$PLATFORM" ] || { echo "Error: platform name must be specified"; exit 1; } |
|
|||
12 | shift # extra params are passed to buildrpm |
|
11 | shift # extra params are passed to buildrpm | |
13 |
|
12 | |||
14 | DFILE="$ROOTDIR/contrib/docker/$PLATFORM" |
|
13 | initcontainer $PLATFORM | |
15 | [ -f "$DFILE" ] || { echo "Error: docker file $DFILE not found"; exit 1; } |
|
|||
16 |
|
||||
17 | CONTAINER="hg-dockerrpm-$PLATFORM" |
|
|||
18 |
|
||||
19 | DBUILDUSER=build |
|
|||
20 | ( |
|
|||
21 | cat $DFILE |
|
|||
22 | echo RUN groupadd $DBUILDUSER -g `id -g` |
|
|||
23 | echo RUN useradd $DBUILDUSER -u `id -u` -g $DBUILDUSER |
|
|||
24 | ) | $DOCKER build --tag $CONTAINER - |
|
|||
25 |
|
14 | |||
26 | RPMBUILDDIR=$ROOTDIR/packages/$PLATFORM |
|
15 | RPMBUILDDIR=$ROOTDIR/packages/$PLATFORM | |
27 | contrib/buildrpm --rpmbuilddir $RPMBUILDDIR --prepare $* |
|
16 | contrib/buildrpm --rpmbuilddir $RPMBUILDDIR --prepare $* | |
28 |
|
17 | |||
29 | DSHARED=/mnt/shared |
|
18 | DSHARED=/mnt/shared | |
30 | $DOCKER run -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \ |
|
19 | $DOCKER run -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \ | |
31 | rpmbuild --define "_topdir $DSHARED" -ba $DSHARED/SPECS/mercurial.spec --clean |
|
20 | rpmbuild --define "_topdir $DSHARED" -ba $DSHARED/SPECS/mercurial.spec --clean | |
32 |
|
21 | |||
33 | $DOCKER run -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \ |
|
22 | $DOCKER run -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \ | |
34 | createrepo $DSHARED |
|
23 | createrepo $DSHARED | |
35 |
|
24 | |||
36 | cat << EOF > $RPMBUILDDIR/mercurial.repo |
|
25 | cat << EOF > $RPMBUILDDIR/mercurial.repo | |
37 | # Place this file in /etc/yum.repos.d/mercurial.repo |
|
26 | # Place this file in /etc/yum.repos.d/mercurial.repo | |
38 | [mercurial] |
|
27 | [mercurial] | |
39 | name=Mercurial packages for $PLATFORM |
|
28 | name=Mercurial packages for $PLATFORM | |
40 | # baseurl=file://$RPMBUILDDIR/ |
|
29 | # baseurl=file://$RPMBUILDDIR/ | |
41 | baseurl=http://hg.example.com/build/$PLATFORM/ |
|
30 | baseurl=http://hg.example.com/build/$PLATFORM/ | |
42 | skip_if_unavailable=True |
|
31 | skip_if_unavailable=True | |
43 | gpgcheck=0 |
|
32 | gpgcheck=0 | |
44 | enabled=1 |
|
33 | enabled=1 | |
45 | EOF |
|
34 | EOF | |
46 |
|
35 | |||
47 | echo |
|
36 | echo | |
48 | echo "Build complete - results can be found in $RPMBUILDDIR" |
|
37 | echo "Build complete - results can be found in $RPMBUILDDIR" |
General Comments 0
You need to be logged in to leave comments.
Login now