fix docker volume read/write permission
This commit is contained in:
parent
daa3813fe2
commit
b21d9e3343
@ -1,9 +1,12 @@
|
||||
#!/bin/sh
|
||||
set -e -u
|
||||
|
||||
HOME=/home/builder
|
||||
IMAGE_NAME=termux/package-builder
|
||||
CONTAINER_NAME=termux-package-builder
|
||||
|
||||
[ `id -u` -eq 0 ] && USER=root || USER=builder
|
||||
|
||||
echo "Running container '$CONTAINER_NAME' from image '$IMAGE_NAME'..."
|
||||
|
||||
docker start $CONTAINER_NAME > /dev/null 2> /dev/null || {
|
||||
@ -14,12 +17,17 @@ docker start $CONTAINER_NAME > /dev/null 2> /dev/null || {
|
||||
--volume $PWD:/home/builder/termux-packages \
|
||||
--tty \
|
||||
$IMAGE_NAME
|
||||
|
||||
echo "Changed builder uid/gid..."
|
||||
docker exec $CONTAINER_NAME chown -R `id -u` /data >& /dev/null
|
||||
docker exec $CONTAINER_NAME usermod -u `id -u` builder >& /dev/null
|
||||
docker exec $CONTAINER_NAME groupmod -g `id -g` builder >& /dev/null
|
||||
}
|
||||
|
||||
if [ "$#" -eq "0" ]; then
|
||||
docker exec --interactive --tty --user builder $CONTAINER_NAME bash
|
||||
docker exec --interactive --tty --user $USER $CONTAINER_NAME bash
|
||||
else
|
||||
docker exec --interactive --tty --user builder $CONTAINER_NAME $@
|
||||
docker exec --interactive --tty --user $USER $CONTAINER_NAME $@
|
||||
fi
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user