|
|
@ -6,12 +6,12 @@ myarch=$(dpkg --print-architecture) |
|
|
|
if test "${arch}" = "amd64"; then |
|
|
|
if test "${arch}" = "amd64"; then |
|
|
|
myarch="amd64|i386" |
|
|
|
myarch="amd64|i386" |
|
|
|
fi |
|
|
|
fi |
|
|
|
mode="apt" |
|
|
|
mode="deb" |
|
|
|
img="ubuntu:latest" |
|
|
|
img="ubuntu:latest" |
|
|
|
repos=() |
|
|
|
repos=() |
|
|
|
keys=() |
|
|
|
keys=() |
|
|
|
envs=("-e DEBIAN_FRONTEND=noninteractive" "-e DEBCONF_NONINTERACTIVE_SEEN=true") |
|
|
|
envs=("-e HOME=/home/$(id -un)" "-e TERM=xterm" "-e DEBIAN_FRONTEND=noninteractive" "-e DEBCONF_NONINTERACTIVE_SEEN=true") |
|
|
|
dirs=("-v $(pwd):/workdir") |
|
|
|
dirs=("-v $(pwd):/workdir" "-v ${HOME}/.gnupg:/home/$(id -un)/.gnupg:ro") |
|
|
|
packages=() |
|
|
|
packages=() |
|
|
|
targets="all check distcheck" |
|
|
|
targets="all check distcheck" |
|
|
|
commands=() |
|
|
|
commands=() |
|
|
@ -30,7 +30,7 @@ while test $# -gt 0; do |
|
|
|
echo "OPTIONS:" |
|
|
|
echo "OPTIONS:" |
|
|
|
echo |
|
|
|
echo |
|
|
|
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: deb, rpm, 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 " -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}" |
|
|
@ -43,6 +43,8 @@ while test $# -gt 0; do |
|
|
|
echo " -w, --wait on error keep docker container and wait for enter" |
|
|
|
echo " -w, --wait on error keep docker container and wait for enter" |
|
|
|
echo |
|
|
|
echo |
|
|
|
echo " The option -i must be after -m, because mode sets a new default image" |
|
|
|
echo " The option -i must be after -m, because mode sets a new default image" |
|
|
|
|
|
|
|
echo " The option -m must be after -t, because mode may be auto detected from targets" |
|
|
|
|
|
|
|
echo " If target is either deb or rpm, mode is set to the same value" |
|
|
|
echo |
|
|
|
echo |
|
|
|
echo " The options -r -k -e -d -p -c can be repeated several times." |
|
|
|
echo " The options -r -k -e -d -p -c can be repeated several times." |
|
|
|
echo |
|
|
|
echo |
|
|
@ -73,8 +75,10 @@ while test $# -gt 0; do |
|
|
|
(-m|--mode) shift; |
|
|
|
(-m|--mode) shift; |
|
|
|
mode="$1" |
|
|
|
mode="$1" |
|
|
|
case "$mode" in |
|
|
|
case "$mode" in |
|
|
|
(apt) img="ubuntu:latest";; |
|
|
|
(deb|apt) img="ubuntu:latest";; |
|
|
|
|
|
|
|
(rpm|zypper) img="opensuse:latest";; |
|
|
|
(yum) img="centos:latest";; |
|
|
|
(yum) img="centos:latest";; |
|
|
|
|
|
|
|
(dnf) img="fedora:latest";; |
|
|
|
(*) |
|
|
|
(*) |
|
|
|
echo "**** ERROR: unknown mode '$1', try --help" 1>&2 |
|
|
|
echo "**** ERROR: unknown mode '$1', try --help" 1>&2 |
|
|
|
exit 1 |
|
|
|
exit 1 |
|
|
@ -87,8 +91,13 @@ while test $# -gt 0; do |
|
|
|
(-a|--arch) shift; |
|
|
|
(-a|--arch) shift; |
|
|
|
arch="$1" |
|
|
|
arch="$1" |
|
|
|
;; |
|
|
|
;; |
|
|
|
(-t|--targets) shift; |
|
|
|
(-t|--targets) shift |
|
|
|
targets="$1" |
|
|
|
targets="$1" |
|
|
|
|
|
|
|
if test "$1" = "deb" -o "$1" = "rpm"; then |
|
|
|
|
|
|
|
# set mode to same value |
|
|
|
|
|
|
|
set -- "-m" $@ |
|
|
|
|
|
|
|
continue |
|
|
|
|
|
|
|
fi |
|
|
|
;; |
|
|
|
;; |
|
|
|
(-r|--repo) shift; |
|
|
|
(-r|--repo) shift; |
|
|
|
repos+=("$1") |
|
|
|
repos+=("$1") |
|
|
@ -192,15 +201,20 @@ function ifthenelse() { |
|
|
|
set -x |
|
|
|
set -x |
|
|
|
|
|
|
|
|
|
|
|
docker pull $img |
|
|
|
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 |
|
|
|
trap 'traperror '"${DOCKER_ID}"' "$? ${PIPESTATUS[@]}" $LINENO $BASH_LINENO "$BASH_COMMAND" "${FUNCNAME[@]}" "${FUNCTION}"' SIGINT INT TERM EXIT |
|
|
|
if ! [[ $arch =~ $myarch ]]; then |
|
|
|
if ! [[ $arch =~ $myarch ]]; then |
|
|
|
docker cp "/usr/bin/qemu-${arch}-static" "${DOCKER_ID}:/usr/bin/qemu-${arch}-static" |
|
|
|
docker cp "/usr/bin/qemu-${arch}-static" "${DOCKER_ID}:/usr/bin/qemu-${arch}-static" |
|
|
|
fi |
|
|
|
fi |
|
|
|
docker start "${DOCKER_ID}" |
|
|
|
docker start "${DOCKER_ID}" |
|
|
|
docker exec ${DOCKER_ID} useradd -u$(id -u) -m -d"${HOME}" $(id -un) |
|
|
|
if ! docker exec ${DOCKER_ID} getent group $(id -g) > /dev/null 2>&1; then |
|
|
|
|
|
|
|
docker exec ${DOCKER_ID} groupadd -g $(id -g) $(id -gn) |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
if ! docker exec ${DOCKER_ID} getent passwd $(id -u) > /dev/null 2>&1; then |
|
|
|
|
|
|
|
docker exec ${DOCKER_ID} useradd -m -u $(id -u) -g $(id -u) -d"${HOME}" $(id -un) |
|
|
|
|
|
|
|
fi |
|
|
|
case $mode in |
|
|
|
case $mode in |
|
|
|
(apt) |
|
|
|
(deb|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' |
|
|
|
for f in 'libpam-systemd:amd64' 'policykit*' 'colord'; do |
|
|
|
for f in 'libpam-systemd:amd64' 'policykit*' 'colord'; do |
|
|
|
docker exec ${DOCKER_ID} bash -c "echo 'Package: $f' >> /etc/apt/preferences" |
|
|
|
docker exec ${DOCKER_ID} bash -c "echo 'Package: $f' >> /etc/apt/preferences" |
|
|
@ -228,8 +242,7 @@ case $mode in |
|
|
|
done |
|
|
|
done |
|
|
|
docker exec ${DOCKER_ID} ./resolve-debbuilddeps.sh |
|
|
|
docker exec ${DOCKER_ID} ./resolve-debbuilddeps.sh |
|
|
|
;; |
|
|
|
;; |
|
|
|
(yum) |
|
|
|
(rpm|yum|dnf|zypper) |
|
|
|
./bootstrap.sh -t dist |
|
|
|
|
|
|
|
if [[ "$img" =~ "centos" ]]; then |
|
|
|
if [[ "$img" =~ "centos" ]]; then |
|
|
|
docker exec ${DOCKER_ID} yum install -y redhat-lsb |
|
|
|
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 |
|
|
|
docker exec -i ${DOCKER_ID} bash -c 'cat > /etc/yum.repos.d/wandisco-svn.repo' <<EOF |
|
|
@ -242,10 +255,7 @@ enabled=1 |
|
|
|
gpgcheck=0 |
|
|
|
gpgcheck=0 |
|
|
|
EOF |
|
|
|
EOF |
|
|
|
fi |
|
|
|
fi |
|
|
|
docker exec ${DOCKER_ID} yum install -y rpm-build |
|
|
|
docker exec ${DOCKER_ID} ./resolve-rpmbuilddeps.sh |
|
|
|
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 |
|
|
|
esac |
|
|
|
docker exec -u $(id -u):$(id -g) ${DOCKER_ID} ./bootstrap.sh -t "${targets}" |
|
|
|
docker exec -u $(id -u):$(id -g) ${DOCKER_ID} ./bootstrap.sh -t "${targets}" |
|
|
|