2017-06-14 13:36:37 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-07-05 14:03:26 +02:00
|
|
|
if mount | grep -q "on / type aufs"; then
|
|
|
|
cat <<EOF >&2
|
|
|
|
WARNING: Generation of wic images will fail!
|
|
|
|
|
|
|
|
Your docker host setup uses broken aufs as storage driver. Adjust the docker
|
|
|
|
configuration to use a driver (overlay, overlay2, devicemapper). You may also
|
|
|
|
need to update the host distribution (e.g. Debian Jessie -> Stretch).
|
|
|
|
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
|
2017-06-19 09:28:34 +02:00
|
|
|
USER_ID=${USER_ID:-30000}
|
2017-06-14 13:36:37 +02:00
|
|
|
|
2017-07-20 18:13:14 +02:00
|
|
|
if [ $USER_ID == 0 ]; then
|
|
|
|
# We shall run everything as root
|
2017-11-21 18:21:40 +01:00
|
|
|
mkdir -p /builder
|
2017-06-14 13:36:37 +02:00
|
|
|
|
2017-07-20 18:13:14 +02:00
|
|
|
cd /builder
|
|
|
|
if [ -n "$1" ]; then
|
|
|
|
exec "$@"
|
|
|
|
else
|
|
|
|
exec bash
|
|
|
|
fi
|
2017-07-19 08:51:22 +02:00
|
|
|
else
|
2017-11-21 18:21:40 +01:00
|
|
|
if ! id $USER_ID >/dev/null 2>&1; then
|
|
|
|
# Create a non-root user that will perform the actual build
|
|
|
|
useradd --uid $USER_ID --create-home --home-dir /builder builder
|
|
|
|
fi
|
2017-07-20 18:13:14 +02:00
|
|
|
|
|
|
|
cd /builder
|
|
|
|
if [ -n "$1" ]; then
|
|
|
|
exec gosu builder "$@"
|
|
|
|
else
|
|
|
|
exec gosu builder bash
|
|
|
|
fi
|
2017-07-19 08:51:22 +02:00
|
|
|
fi
|