dockerrpm: better handling of specification of docker name
authorMads Kiilerich <madski@unity3d.com>
Fri, 30 May 2014 14:14:33 +0200
changeset 22439 d2a00ced3cce
parent 22438 f5abb231b80a
child 22440 cf7b5c011737
dockerrpm: better handling of specification of docker name
contrib/dockerrpm
--- a/contrib/dockerrpm	Fri May 30 14:14:33 2014 +0200
+++ b/contrib/dockerrpm	Fri May 30 14:14:33 2014 +0200
@@ -16,6 +16,14 @@
 $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; }
 
-$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 packages/$1/* /hg/packages/$1/"
+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"
+
+$DOCKER build --tag $CONTAINER - < $DFILE
+$DOCKER run --rm -v $ROOTDIR:/hg $CONTAINER bash -c \
+    "cp -a hg hg-build; cd hg-build; make clean local $PLATFORM; cp packages/$PLATFORM/* /hg/packages/$PLATFORM/"