|
|
@ -2,6 +2,7 @@ |
|
|
|
set -o errtrace |
|
|
|
set -o errtrace |
|
|
|
|
|
|
|
|
|
|
|
# build and test everything in a fresh docker installation |
|
|
|
# build and test everything in a fresh docker installation |
|
|
|
|
|
|
|
mode="apt" |
|
|
|
img="ubuntu:latest" |
|
|
|
img="ubuntu:latest" |
|
|
|
repos=() |
|
|
|
repos=() |
|
|
|
keys=() |
|
|
|
keys=() |
|
|
@ -24,6 +25,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 " -i, --image <image> use given docker image instead of ${img}" |
|
|
|
echo " -i, --image <image> use given docker image instead of ${img}" |
|
|
|
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" |
|
|
@ -34,6 +36,8 @@ while test $# -gt 0; do |
|
|
|
echo " -c, --cmd <command> execute commands as root in docker" |
|
|
|
echo " -c, --cmd <command> execute commands as root in docker" |
|
|
|
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 |
|
|
|
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 |
|
|
|
echo " The options -r -p -c allow an if-then-else contruct" |
|
|
|
echo " The options -r -p -c allow an if-then-else contruct" |
|
|
@ -60,6 +64,17 @@ while test $# -gt 0; do |
|
|
|
echo |
|
|
|
echo |
|
|
|
exit 0 |
|
|
|
exit 0 |
|
|
|
;; |
|
|
|
;; |
|
|
|
|
|
|
|
(-m|--mode) shift; |
|
|
|
|
|
|
|
mode="$1" |
|
|
|
|
|
|
|
case "$mode" in |
|
|
|
|
|
|
|
(apt) img="ubuntu:latest";; |
|
|
|
|
|
|
|
(yum) img="centos:latest";; |
|
|
|
|
|
|
|
(*) |
|
|
|
|
|
|
|
echo "**** ERROR: unknown mode '$1', try --help" 1>&2 |
|
|
|
|
|
|
|
exit 1 |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
esac |
|
|
|
|
|
|
|
;; |
|
|
|
(-i|--image) shift; |
|
|
|
(-i|--image) shift; |
|
|
|
img="$1" |
|
|
|
img="$1" |
|
|
|
;; |
|
|
|
;; |
|
|
@ -167,34 +182,56 @@ function ifthenelse() { |
|
|
|
|
|
|
|
|
|
|
|
set -x |
|
|
|
set -x |
|
|
|
|
|
|
|
|
|
|
|
OPTIONS='-o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew -y --force-yes --no-install-suggests --no-install-recommends' |
|
|
|
|
|
|
|
docker pull $img |
|
|
|
docker pull $img |
|
|
|
DOCKER_ID=$(docker run -d ${dirs[@]} ${envs[@]} -w /workdir $img sleep infinity) |
|
|
|
DOCKER_ID=$(docker run -d ${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 |
|
|
|
for f in 'libpam-systemd:amd64' 'policykit*' 'colord'; do |
|
|
|
case $mode in |
|
|
|
|
|
|
|
(apt) |
|
|
|
|
|
|
|
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 |
|
|
|
docker exec -it ${DOCKER_ID} bash -c "echo 'Package: $f' >> /etc/apt/preferences" |
|
|
|
docker exec -it ${DOCKER_ID} bash -c "echo 'Package: $f' >> /etc/apt/preferences" |
|
|
|
docker exec -it ${DOCKER_ID} bash -c "echo 'Pin-Priority: -100' >> /etc/apt/preferences" |
|
|
|
docker exec -it ${DOCKER_ID} bash -c "echo 'Pin-Priority: -100' >> /etc/apt/preferences" |
|
|
|
docker exec -it ${DOCKER_ID} bash -c "echo >> /etc/apt/preferences" |
|
|
|
docker exec -it ${DOCKER_ID} bash -c "echo >> /etc/apt/preferences" |
|
|
|
done |
|
|
|
done |
|
|
|
docker exec ${DOCKER_ID} apt-get update ${OPTIONS} |
|
|
|
docker exec ${DOCKER_ID} apt-get update ${OPTIONS} |
|
|
|
docker exec ${DOCKER_ID} apt-get upgrade ${OPTIONS} |
|
|
|
docker exec ${DOCKER_ID} apt-get upgrade ${OPTIONS} |
|
|
|
docker exec ${DOCKER_ID} apt-get install ${OPTIONS} python-software-properties software-properties-common apt-transport-https dpkg-dev lsb-release || \ |
|
|
|
docker exec ${DOCKER_ID} apt-get install ${OPTIONS} python-software-properties software-properties-common apt-transport-https dpkg-dev lsb-release || \ |
|
|
|
docker exec ${DOCKER_ID} apt-get install ${OPTIONS} software-properties-common apt-transport-https dpkg-dev lsb-release || \ |
|
|
|
docker exec ${DOCKER_ID} apt-get install ${OPTIONS} software-properties-common apt-transport-https dpkg-dev lsb-release || \ |
|
|
|
docker exec ${DOCKER_ID} apt-get install ${OPTIONS} python-software-properties apt-transport-https dpkg-dev lsb-release; |
|
|
|
docker exec ${DOCKER_ID} apt-get install ${OPTIONS} python-software-properties apt-transport-https dpkg-dev lsb-release; |
|
|
|
for repo in "${repos[@]}"; do |
|
|
|
for repo in "${repos[@]}"; do |
|
|
|
ifthenelse "${repo}" "apt-add-repository ARG" |
|
|
|
ifthenelse "${repo}" "apt-add-repository ARG" |
|
|
|
done |
|
|
|
done |
|
|
|
for key in "${keys[@]}"; do |
|
|
|
for key in "${keys[@]}"; do |
|
|
|
wget -O- "$key" \ |
|
|
|
wget -O- "$key" \ |
|
|
|
| docker exec -i ${DOCKER_ID} apt-key add - |
|
|
|
| docker exec -i ${DOCKER_ID} apt-key add - |
|
|
|
done |
|
|
|
done |
|
|
|
docker exec ${DOCKER_ID} apt-get update ${OPTIONS} |
|
|
|
docker exec ${DOCKER_ID} apt-get update ${OPTIONS} |
|
|
|
for package in "${packages[@]}"; do |
|
|
|
for package in "${packages[@]}"; do |
|
|
|
ifthenelse "${package}" "apt-get install ${OPTIONS} ARG" |
|
|
|
ifthenelse "${package}" "apt-get install ${OPTIONS} ARG" |
|
|
|
done |
|
|
|
done |
|
|
|
for command in "${commands[@]}"; do |
|
|
|
for command in "${commands[@]}"; do |
|
|
|
ifthenelse "${command}" "ARG" |
|
|
|
ifthenelse "${command}" "ARG" |
|
|
|
done |
|
|
|
done |
|
|
|
docker exec ${DOCKER_ID} ./resolve-debbuilddeps.sh |
|
|
|
docker exec ${DOCKER_ID} ./resolve-debbuilddeps.sh |
|
|
|
docker exec -u $(id -u) ${DOCKER_ID} test -d .svn && svn upgrade || true |
|
|
|
;; |
|
|
|
docker exec -u $(id -u) ${DOCKER_ID} ./bootstrap.sh -t "${targets}" |
|
|
|
(yum) |
|
|
|
|
|
|
|
./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 |
|
|
|
|
|
|
|
docker exec -u $(id -u):$(id -g) ${DOCKER_ID} ./bootstrap.sh -t "${targets}" |
|
|
|