[PATCH 13 of 22] dockerrpm: check that docker is running correctly before building

Mads Kiilerich mads at kiilerich.com
Mon May 19 21:10:08 CDT 2014


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1400551681 -7200
#      Tue May 20 04:08:01 2014 +0200
# Node ID 2eb36c36ff30a18b6a7ecc76b0592699bd46635f
# Parent  75c1b9ca3644252245840f7276f8223803805a4e
dockerrpm: check that docker is running correctly before building

diff --git a/contrib/dockerrpm b/contrib/dockerrpm
--- a/contrib/dockerrpm
+++ b/contrib/dockerrpm
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -e
 
 BUILDDIR=$(dirname $0)
 ROOTDIR=$(cd $BUILDDIR/..; pwd)
@@ -9,6 +9,11 @@ elif which docker.io >> /dev/null ; then
   DOCKER=docker.io
 fi
 
+[ "$DOCKER" ] || { echo "Error: docker must be installed"; exit 1; }
+$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: docker server not found - check it is running and your permissions"; exit 1; }
+
 $DOCKER build --tag "hg-dockerrpm-$1" - < $BUILDDIR/docker/$1
 $DOCKER run --rm -v $ROOTDIR:/hg "hg-dockerrpm-$1" bash -c \
     "cp -a hg hg-build; cd hg-build; make clean local $1; cp build/$1/* /hg/build/$1/"


More information about the Mercurial-devel mailing list