#!/bin/bash cd "$(dirname "$(readlink -e "$0")")" exec 9> build-all-with-docker.lock if ! flock -n 9; then >&2 echo 'another build-all-with-docker still holds the lock' exit 1 fi if [ "x$1" = 'x--pull' ]; then shift if ! git pull --ff-only; then if ! git pull --rebase \ && git push; then >&2 echo 'cannot push/pull' exit 1 fi fi fi if [ -n "$(git status --porcelain)" ]; then >&2 echo 'git is not clean' exit 1 fi ids=() for pkg in */PKGBUILD; do cd "${pkg%/PKGBUILD}" ( ../addPkgbuildPatch add docker run --rm -v .:/build arch-build:latest docker run --rm -v .:/build arch32-i486-build docker run --rm -v .:/build arch32-i686-build docker run --rm -v .:/build arch32-pentium4-build docker run --rm -v .:/build artix-build:latest ../addPkgbuildPatch del [ -n "$(git status --porcelain -- PKGBUILD)" ] && ../commit-package -a && git push ) & ids[${#ids[@]}]=$! cd .. done while [ "${#ids[@]}" -gt 0 ]; do sleep 10 ids=( $( ls /proc \ | grep -xFf <(printf '%s\n' "${ids[@]}") \ | tee /dev/stderr ) ) date done