Only switch docker user if it does not match current user
This commit is contained in:
parent
dc694deb8c
commit
353a1fc6ab
1 changed files with 8 additions and 1 deletions
9
build.sh
9
build.sh
|
@ -37,10 +37,17 @@ FF_CXXFLAGS="$(xargs <<< "$FF_CXXFLAGS")"
|
|||
FF_LDFLAGS="$(xargs <<< "$FF_LDFLAGS")"
|
||||
FF_LIBS="$(xargs <<< "$FF_LIBS")"
|
||||
|
||||
TESTFILE="uidtestfile"
|
||||
rm -f "$TESTFILE"
|
||||
docker run --rm -v "$PWD:/uidtestdir" "$IMAGE" /usr/bin/touch "/uidtestdir/$TESTFILE"
|
||||
DOCKERUID="$(stat -c "%u" "$TESTFILE")"
|
||||
rm -f "$TESTFILE"
|
||||
[[ "$DOCKERUID" != "$(id -u)" ]] && UIDARGS=( -u "$(id -u):$(id -g)" ) || UIDARGS=()
|
||||
|
||||
rm -rf ffbuild
|
||||
mkdir ffbuild
|
||||
|
||||
docker run --rm -i -u "$(id -u):$(id -g)" -v $PWD/ffbuild:/ffbuild "$IMAGE" bash -s <<EOF
|
||||
docker run --rm -i "${UIDARGS[@]}" -v $PWD/ffbuild:/ffbuild "$IMAGE" bash -s <<EOF
|
||||
set -xe
|
||||
cd /ffbuild
|
||||
rm -rf ffmpeg prefix
|
||||
|
|
Loading…
Reference in a new issue