add -r option to docker/build.sh for executing as root

This commit is contained in:
Joshua Warner 2014-12-05 13:25:10 -07:00
parent 0134a9e815
commit 29f32859da

View File

@ -8,6 +8,8 @@ if test $# -eq 0; then
exit 1
fi
THE_USER="-u $(id -u "${USER}")"
while test $# -gt 1 ; do
key="$1"
case $key in
@ -16,6 +18,10 @@ while test $# -gt 1 ; do
CONTAINER="$1"
shift
;;
-r|--root)
shift
THE_USER=
;;
--)
shift
break
@ -32,4 +38,4 @@ fi
DIR=$(cd $(dirname "$0") && cd .. && pwd)
docker run --rm -i -t -v "${DIR}":/var/avian -u $(id -u "${USER}") "${CONTAINER}" "${@}"
docker run --rm -i -t -v "${DIR}":/var/avian ${THE_USER} "${CONTAINER}" "${@}"