|
|
@ -2,10 +2,12 @@ |
|
|
|
set -e -u |
|
|
|
|
|
|
|
HOME=/home/builder |
|
|
|
REPOROOT="$(dirname $(readlink -f $0))/../" |
|
|
|
|
|
|
|
IMAGE_NAME=termux/package-builder |
|
|
|
CONTAINER_NAME=termux-package-builder |
|
|
|
|
|
|
|
[ `id -u` -eq 0 ] && USER=root || USER=builder |
|
|
|
[ $(id -u) -eq 0 ] && USER=root || USER=builder |
|
|
|
|
|
|
|
echo "Running container '$CONTAINER_NAME' from image '$IMAGE_NAME'..." |
|
|
|
|
|
|
@ -15,14 +17,17 @@ docker start $CONTAINER_NAME > /dev/null 2> /dev/null || { |
|
|
|
--detach \ |
|
|
|
--env HOME=$HOME \ |
|
|
|
--name $CONTAINER_NAME \ |
|
|
|
--volume $PWD:$HOME/termux-packages \ |
|
|
|
--volume $REPOROOT:$HOME/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 [ $(id -u) -ne 1000 ] |
|
|
|
then |
|
|
|
echo "Changed builder uid/gid... (this may take a while)" |
|
|
|
docker exec --tty $CONTAINER_NAME chown -R $(id -u) $HOME |
|
|
|
docker exec --tty $CONTAINER_NAME chown -R $(id -u) /data |
|
|
|
docker exec --tty $CONTAINER_NAME usermod -u $(id -u) builder |
|
|
|
docker exec --tty $CONTAINER_NAME groupmod -g $(id -g) builder |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
|
if [ "$#" -eq "0" ]; then |
|
|
|