|
|
@ -2,6 +2,10 @@ |
|
|
|
set -o errtrace |
|
|
|
set -o errtrace |
|
|
|
|
|
|
|
|
|
|
|
# build and test everything in a fresh docker installation |
|
|
|
# build and test everything in a fresh docker installation |
|
|
|
|
|
|
|
myarch=$(dpkg --print-architecture) |
|
|
|
|
|
|
|
if test "${arch}" = "amd64"; then |
|
|
|
|
|
|
|
myarch="amd64|i386" |
|
|
|
|
|
|
|
fi |
|
|
|
mode="apt" |
|
|
|
mode="apt" |
|
|
|
img="ubuntu:latest" |
|
|
|
img="ubuntu:latest" |
|
|
|
repos=() |
|
|
|
repos=() |
|
|
@ -11,6 +15,7 @@ dirs=("-v $(pwd):/workdir") |
|
|
|
packages=() |
|
|
|
packages=() |
|
|
|
targets="all check distcheck" |
|
|
|
targets="all check distcheck" |
|
|
|
commands=() |
|
|
|
commands=() |
|
|
|
|
|
|
|
arch=$(dpkg --print-architecture) |
|
|
|
wait=0 |
|
|
|
wait=0 |
|
|
|
if test -e ./build-in-docker.conf; then |
|
|
|
if test -e ./build-in-docker.conf; then |
|
|
|
# you can preconfigure the variables in file build-in-docker.conf |
|
|
|
# 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 " -h, --help show this help" |
|
|
|
echo " -m, --mode <type> mode: apt or yum, default: ${mode}" |
|
|
|
echo " -m, --mode <type> mode: apt or yum, default: ${mode}" |
|
|
|
echo " -i, --image <image> use given docker image instead of ${img}" |
|
|
|
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 " -t, --targets targets specify build targets, default: ${targets}" |
|
|
|
echo " -r, --repo <url> add given apt repository" |
|
|
|
echo " -r, --repo <url> add given apt repository" |
|
|
|
echo " -k, --key <url> add public key from url" |
|
|
|
echo " -k, --key <url> add public key from url" |
|
|
@ -78,6 +84,9 @@ while test $# -gt 0; do |
|
|
|
(-i|--image) shift; |
|
|
|
(-i|--image) shift; |
|
|
|
img="$1" |
|
|
|
img="$1" |
|
|
|
;; |
|
|
|
;; |
|
|
|
|
|
|
|
(-a|--arch) shift; |
|
|
|
|
|
|
|
arch="$1" |
|
|
|
|
|
|
|
;; |
|
|
|
(-t|--targets) shift; |
|
|
|
(-t|--targets) shift; |
|
|
|
targets="$1" |
|
|
|
targets="$1" |
|
|
|
;; |
|
|
|
;; |
|
|
@ -183,8 +192,12 @@ function ifthenelse() { |
|
|
|
set -x |
|
|
|
set -x |
|
|
|
|
|
|
|
|
|
|
|
docker pull $img |
|
|
|
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 |
|
|
|
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 |
|
|
|
case $mode in |
|
|
|
(apt) |
|
|
|
(apt) |
|
|
|
OPTIONS='-o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew -y --force-yes --no-install-suggests --no-install-recommends' |
|
|
|
OPTIONS='-o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew -y --force-yes --no-install-suggests --no-install-recommends' |
|
|
|