| 1 | # PowerShell script to build Termux packages with Docker. |
| 2 | # |
| 3 | # Usage example: |
| 4 | # |
| 5 | # .\scripts\run-docker.ps1 ./build-package.sh -a arm libandroid-support |
| 6 | |
| 7 | Set-Variable -Name IMAGE_NAME -Value "termux/package-builder" |
| 8 | Set-Variable -Name CONTAINER_NAME -Value "termux-package-builder" |
| 9 | |
| 10 | Write-Output "Running container ${CONTAINER_NAME} from image ${IMAGE_NAME}..." |
| 11 | |
| 12 | docker start $CONTAINER_NAME 2>&1 | Out-Null |
| 13 | |
| 14 | if (-Not $?) { |
| 15 | Write-Output "Creating new container..." |
| 16 | docker run ` |
| 17 | --detach ` |
| 18 | --name $CONTAINER_NAME ` |
| 19 | --volume "${PWD}:/home/builder/termux-packages" ` |
| 20 | --tty ` |
| 21 | "$IMAGE_NAME" |
| 22 | } |
| 23 | |
| 24 | if ($args.Count -eq 0) { |
| 25 | docker exec --interactive --tty --user builder $CONTAINER_NAME bash |
| 26 | } else { |
| 27 | docker exec --interactive --tty --user builder $CONTAINER_NAME $args |
| 28 | } |