2016-05-28 00:24:50 +02:00
|
|
|
#!/bin/sh
|
|
|
|
set -e -u
|
|
|
|
|
|
|
|
IMAGE_NAME=termux/package-builder
|
2016-06-04 00:41:30 +02:00
|
|
|
CONTAINER_NAME=termux-package-builder
|
2016-05-28 00:24:50 +02:00
|
|
|
|
2016-06-04 00:41:30 +02:00
|
|
|
echo "Running container '$CONTAINER_NAME' from image '$IMAGE_NAME'..."
|
|
|
|
|
|
|
|
docker start $CONTAINER_NAME > /dev/null 2> /dev/null || {
|
|
|
|
echo "Creating new container..."
|
|
|
|
docker run \
|
2017-02-04 23:22:56 +01:00
|
|
|
--detach \
|
|
|
|
--name $CONTAINER_NAME \
|
|
|
|
--volume $PWD:/home/builder/termux-packages \
|
|
|
|
--tty \
|
|
|
|
$IMAGE_NAME
|
2016-06-04 00:41:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if [ "$#" -eq "0" ]; then
|
2017-02-04 23:22:56 +01:00
|
|
|
docker exec --interactive --tty --user builder $CONTAINER_NAME bash
|
2016-06-04 00:41:30 +02:00
|
|
|
else
|
2017-02-04 23:22:56 +01:00
|
|
|
docker exec --interactive --tty --user builder $CONTAINER_NAME $@
|
2016-06-04 00:41:30 +02:00
|
|
|
fi
|
2016-05-28 00:24:50 +02:00
|
|
|
|
|
|
|
|