|
|
|
@ -2,6 +2,10 @@ |
|
|
|
|
set -o errtrace |
|
|
|
|
|
|
|
|
|
# build and test everything in a fresh docker installation |
|
|
|
|
myarch=$(dpkg --print-architecture) |
|
|
|
|
if test "${arch}" = "amd64"; then |
|
|
|
|
myarch="amd64|i386" |
|
|
|
|
fi |
|
|
|
|
mode="apt" |
|
|
|
|
img="ubuntu:latest" |
|
|
|
|
repos=() |
|
|
|
@ -11,6 +15,7 @@ dirs=("-v $(pwd):/workdir") |
|
|
|
|
packages=() |
|
|
|
|
targets="all check distcheck" |
|
|
|
|
commands=() |
|
|
|
|
arch=$(dpkg --print-architecture) |
|
|
|
|
wait=0 |
|
|
|
|
if test -e ./build-in-docker.conf; then |
|
|
|
|
# you can preconfigure the variables in file build-in-docker.conf |
|
|
|
@ -27,6 +32,7 @@ while test $# -gt 0; do |
|
|
|
|
echo " -h, --help show this help" |
|
|
|
|
echo " -m, --mode <type> mode: apt or yum, default: ${mode}" |
|
|
|
|
echo " -i, --image <image> use given docker image instead of ${img}" |
|
|
|
|
echo " -a, --arch <arch> build for given hardware architecture" |
|
|
|
|
echo " -t, --targets targets specify build targets, default: ${targets}" |
|
|
|
|
echo " -r, --repo <url> add given apt repository" |
|
|
|
|
echo " -k, --key <url> add public key from url" |
|
|
|
@ -78,6 +84,9 @@ while test $# -gt 0; do |
|
|
|
|
(-i|--image) shift; |
|
|
|
|
img="$1" |
|
|
|
|
;; |
|
|
|
|
(-a|--arch) shift; |
|
|
|
|
arch="$1" |
|
|
|
|
;; |
|
|
|
|
(-t|--targets) shift; |
|
|
|
|
targets="$1" |
|
|
|
|
;; |
|
|
|
@ -183,8 +192,12 @@ function ifthenelse() { |
|
|
|
|
set -x |
|
|
|
|
|
|
|
|
|
docker pull $img |
|
|
|
|
DOCKER_ID=$(docker run -d ${dirs[@]} ${envs[@]} -e HOME="${HOME}" -w /workdir $img sleep infinity) |
|
|
|
|
DOCKER_ID=$(docker create -d ${dirs[@]} ${envs[@]} -e HOME="${HOME}" -w /workdir $img sleep infinity) |
|
|
|
|
trap 'traperror '"${DOCKER_ID}"' "$? ${PIPESTATUS[@]}" $LINENO $BASH_LINENO "$BASH_COMMAND" "${FUNCNAME[@]}" "${FUNCTION}"' SIGINT INT TERM EXIT |
|
|
|
|
if ! [[ $arch =~ $myarch ]]; then |
|
|
|
|
docker cp "/usr/bin/qemu-${arch}-static" "${DOCKER_ID}:/usr/bin/qemu-${arch}-static" |
|
|
|
|
fi |
|
|
|
|
docker start "${DOCKER_ID}" |
|
|
|
|
case $mode in |
|
|
|
|
(apt) |
|
|
|
|
OPTIONS='-o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew -y --force-yes --no-install-suggests --no-install-recommends' |
|
|
|
|