dockerrpm
35 lines
| 1.2 KiB
| text/plain
|
TextLexer
/ contrib / dockerrpm
Mads Kiilerich
|
r22438 | #!/bin/bash -e | ||
Matt Mackall
|
r21255 | |||
BUILDDIR=$(dirname $0) | ||||
ROOTDIR=$(cd $BUILDDIR/..; pwd) | ||||
Mads Kiilerich
|
r22438 | if which docker.io >> /dev/null 2>&1 ; then | ||
Matt Mackall
|
r21642 | DOCKER=docker.io | ||
Mads Kiilerich
|
r22438 | elif which docker >> /dev/null 2>&1 ; then | ||
Matt Mackall
|
r21255 | DOCKER=docker | ||
Mads Kiilerich
|
r22438 | else | ||
echo "Error: docker must be installed" | ||||
exit 1 | ||||
Matt Mackall
|
r21255 | fi | ||
Mads Kiilerich
|
r22438 | $DOCKER -h 2> /dev/null | grep -q Jansens && { echo "Error: $DOCKER is the Docking System Tray - install docker.io instead"; exit 1; } | ||
$DOCKER version | grep -q "^Client version:" || { echo "Error: unexpected output from \"$DOCKER version\""; exit 1; } | ||||
$DOCKER version | grep -q "^Server version:" || { echo "Error: could not get docker server version - check it is running and your permissions"; exit 1; } | ||||
Mads Kiilerich
|
r22439 | PLATFORM="$1" | ||
[ "$PLATFORM" ] || { echo "Error: platform name must be specified"; exit 1; } | ||||
DFILE="$ROOTDIR/contrib/docker/$PLATFORM" | ||||
[ -f "$DFILE" ] || { echo "Error: docker file $DFILE not found"; exit 1; } | ||||
CONTAINER="hg-dockerrpm-$PLATFORM" | ||||
Mads Kiilerich
|
r22440 | DBUILDUSER=build | ||
( | ||||
cat $DFILE | ||||
echo RUN groupadd $DBUILDUSER -g `id -g` | ||||
echo RUN useradd $DBUILDUSER -u `id -u` -g $DBUILDUSER | ||||
) | $DOCKER build --tag $CONTAINER - | ||||
$DOCKER run -u $DBUILDUSER --rm -v $ROOTDIR:/hg $CONTAINER bash -c \ | ||||
Mads Kiilerich
|
r22439 | "cp -a hg hg-build; cd hg-build; make clean local $PLATFORM; cp packages/$PLATFORM/* /hg/packages/$PLATFORM/" | ||