dockerlib: fix initcontainer for boot2docker users
This allows me to build rpm packages using boot2docker on my Mac. It's
probably a very fragile hack, but it seems to work well enough for now
that I felt it was worth sharing.
--- a/contrib/dockerlib.sh Wed May 06 10:45:51 2015 -0400
+++ b/contrib/dockerlib.sh Wed May 06 14:36:17 2015 -0400
@@ -29,7 +29,14 @@
DBUILDUSER=build
(
cat $DFILE
- echo RUN groupadd $DBUILDUSER -g `id -g`
- echo RUN useradd $DBUILDUSER -u `id -u` -g $DBUILDUSER
+ if [ $(uname) = "Darwin" ] ; then
+ # The builder is using boot2docker on OS X, so we're going to
+ # *guess* the uid of the user inside the VM that is actually
+ # running docker. This is *very likely* to fail at some point.
+ echo RUN useradd $DBUILDUSER -u 1000
+ else
+ echo RUN groupadd $DBUILDUSER -g `id -g`
+ echo RUN useradd $DBUILDUSER -u `id -u` -g $DBUILDUSER
+ fi
) | $DOCKER build --tag $CONTAINER -
}