|
|
|
@ -10,8 +10,8 @@ mode="apt" |
|
|
|
|
img="ubuntu:latest" |
|
|
|
|
repos=() |
|
|
|
|
keys=() |
|
|
|
|
envs=() |
|
|
|
|
dirs=("-v $(pwd):/workdir") |
|
|
|
|
envs=("-e HOME=/home/$(id -un)" "-e TERM=xterm") |
|
|
|
|
dirs=("-v $(pwd):/workdir" "-v ${HOME}/.gnupg:/home/$(id -un)/.gnupg:ro") |
|
|
|
|
packages=() |
|
|
|
|
targets="all check distcheck" |
|
|
|
|
commands=() |
|
|
|
@ -30,7 +30,7 @@ while test $# -gt 0; do |
|
|
|
|
echo "OPTIONS:" |
|
|
|
|
echo |
|
|
|
|
echo " -h, --help show this help" |
|
|
|
|
echo " -m, --mode <type> mode: apt or yum, default: ${mode}" |
|
|
|
|
echo " -m, --mode <type> mode: apt, yum, dnf, 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}" |
|
|
|
@ -75,6 +75,7 @@ while test $# -gt 0; do |
|
|
|
|
case "$mode" in |
|
|
|
|
(apt) img="ubuntu:latest";; |
|
|
|
|
(yum) img="centos:latest";; |
|
|
|
|
(dnf) img="fedora:latest";; |
|
|
|
|
(*) |
|
|
|
|
echo "**** ERROR: unknown mode '$1', try --help" 1>&2 |
|
|
|
|
exit 1 |
|
|
|
@ -192,13 +193,18 @@ function ifthenelse() { |
|
|
|
|
set -x |
|
|
|
|
|
|
|
|
|
docker pull $img |
|
|
|
|
DOCKER_ID=$(docker create ${dirs[@]} ${envs[@]} -e HOME="${HOME}" -w /workdir $img sleep infinity) |
|
|
|
|
DOCKER_ID=$(docker create ${dirs[@]} ${envs[@]} -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}" |
|
|
|
|
docker exec ${DOCKER_ID} useradd -u$(id -u) -m -d"${HOME}" $(id -un) |
|
|
|
|
if docker exec ${DOCKER_ID} getent passwd > /dev/null 2>&1; then |
|
|
|
|
docker exec ${DOCKER_ID} groupadd -g $(id -g) build |
|
|
|
|
docker exec ${DOCKER_ID} useradd -g $(id -g) -u $(id -u) build |
|
|
|
|
else |
|
|
|
|
docker exec ${DOCKER_ID} useradd -m -u $(id -u) -g $(id -u) -d"${HOME}" build |
|
|
|
|
fi |
|
|
|
|
case $mode in |
|
|
|
|
(apt) |
|
|
|
|
OPTIONS='-o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew -y --force-yes --no-install-suggests --no-install-recommends' |
|
|
|
@ -240,11 +246,26 @@ EOF |
|
|
|
|
docker exec -i ${DOCKER_ID} bash -c 'cat >> /etc/yum.repos.d/wandisco-svn.repo' <<EOF |
|
|
|
|
enabled=1 |
|
|
|
|
gpgcheck=0 |
|
|
|
|
EOF |
|
|
|
|
fi |
|
|
|
|
docker exec ${DOCKER_ID} yum install -y rpm-build automake |
|
|
|
|
docker exec ${DOCKER_ID} ./resolve-rpmbuilddeps.sh || true |
|
|
|
|
;; |
|
|
|
|
(dnf) |
|
|
|
|
./bootstrap.sh -t dist |
|
|
|
|
if [[ "$img" =~ "centos" ]]; then |
|
|
|
|
docker exec ${DOCKER_ID} yum install -y redhat-lsb |
|
|
|
|
docker exec -i ${DOCKER_ID} bash -c 'cat > /etc/yum.repos.d/wandisco-svn.repo' <<EOF |
|
|
|
|
[WandiscoSVN] |
|
|
|
|
name=Wandisco SVN Repo |
|
|
|
|
EOF |
|
|
|
|
docker exec -i ${DOCKER_ID} bash -c 'echo "baseurl=http://opensource.wandisco.com/centos/$(lsb_release -sr | sed '"'"'s,[^0-9].*,,'"'"')/svn-'$(svn --version | head -1 | sed 's,[^0-9]*\([0-9]\+\.[0-9]\+\).*,\1,')'/RPMS/$(uname -i)/" >> /etc/yum.repos.d/wandisco-svn.repo' |
|
|
|
|
docker exec -i ${DOCKER_ID} bash -c 'cat >> /etc/yum.repos.d/wandisco-svn.repo' <<EOF |
|
|
|
|
enabled=1 |
|
|
|
|
gpgcheck=0 |
|
|
|
|
EOF |
|
|
|
|
fi |
|
|
|
|
docker exec ${DOCKER_ID} yum install -y rpm-build |
|
|
|
|
docker exec ${DOCKER_ID} groupadd -g $(id -g) build |
|
|
|
|
docker exec ${DOCKER_ID} useradd -g $(id -g) -u $(id -u) build |
|
|
|
|
docker exec ${DOCKER_ID} ./resolve-rpmbuilddeps.sh || true |
|
|
|
|
;; |
|
|
|
|
esac |
|
|
|
|