summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuild-docker.sh16
1 files changed, 11 insertions, 5 deletions
diff --git a/build-docker.sh b/build-docker.sh
index a44b33f..1b9a7b4 100755
--- a/build-docker.sh
+++ b/build-docker.sh
@@ -4,10 +4,15 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
BUILD_OPTS="$*"
-DOCKER="docker"
-
-if ! ${DOCKER} ps >/dev/null 2>&1; then
- DOCKER="sudo docker"
+# Allow user to override docker command
+DOCKER=${DOCKER:-docker}
+
+# Ensure that default docker command is not set up in rootless mode
+if \
+ ! ${DOCKER} ps >/dev/null 2>&1 || \
+ ${DOCKER} info 2>/dev/null | grep -q rootless \
+; then
+ DOCKER="sudo ${DOCKER}"
fi
if ! ${DOCKER} ps >/dev/null; then
echo "error connecting to docker:"
@@ -112,8 +117,9 @@ else
wait "$!"
fi
+# Ensure that deploy/ is always owned by calling user
echo "copying results from deploy/"
-${DOCKER} cp "${CONTAINER_NAME}":/pi-gen/deploy .
+${DOCKER} cp "${CONTAINER_NAME}":/pi-gen/deploy - | tar -xf -
ls -lah deploy
# cleanup