From f066ff9a4d4b002aca58fedb830b0083d2612624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Tue, 31 May 2016 13:26:52 +0000 Subject: [PATCH] updated --- scripts/bootstrap-to-docker.sh | 107 +++++++++++++++++++++------------ scripts/setup-debootstrap.sh | 2 +- 2 files changed, 69 insertions(+), 40 deletions(-) diff --git a/scripts/bootstrap-to-docker.sh b/scripts/bootstrap-to-docker.sh index 42fef90..2f29fb9 100755 --- a/scripts/bootstrap-to-docker.sh +++ b/scripts/bootstrap-to-docker.sh @@ -12,56 +12,85 @@ if test -f /etc/setup-debootstrap.conf; then . /etc/setup-debootstrap.conf fi +tmpdir=${tmpdir:-"/var/tmp"} +docker_user=${docker_user:-${USER}} archs=${archs:-"i386 amd64"} -ubuntu=${ubuntu:-"wily vivid trusty precise"} -debian=${debian:-"jessie wheezy squeeze sid"} -distros="${ubuntu} ${debian}" -tmpdir=${tmpdir:-"/var/tmp"} -packages=(${packages:-"python-software-properties software-properties-common|software-properties-common|python-software-properties" "apt-transport-https dpkg-dev lsb-release"}) +ubuntu_qt5="xenial wily vivid trusty" +ubuntu_qt4="precise" +debian_qt5="jessie sid" +debian_qt4="wheezy" +debian_unsupported="buster stretch" # not in /usr/share/debootstrap/scripts + +ubuntu=("${ubuntu_qt5}" "${ubuntu_qt4}") +debian=("${debian_qt5}" "${debian_qt4}") +distros=(${distros:-"${ubuntu[@]}" "${debian[@]}"}) + +packages_qt5="qtbase5-dev qtbase5-dev-tools qtbase5-dev-tools libqt5webkit5-dev libqt5svg5-dev qt5-default qttools5-dev" +# |libqtcore4-qmake|libqt4-core +packages_qt4="qt4-qmake libqt4-dev" +# |software-properties-common|python-software-properties +packages_base="software-properties-common apt-transport-https dpkg-dev lsb-release debhelper git subversion pkg-config automake libtool autotools-dev doxygen graphviz mscgen libcppunit-dev xvfb nodejs" +package_not_in_xenial="" +package_not_in_xenial_qt5="" + +packages=(${packages:-"${packages_base} ${packages_qt5}" "${packages_base} ${packages_qt4}" "${packages_base} ${packages_qt5}" "${packages_base} ${packages_qt4}"}) + +if test -z "${index}" -a "${#distros[@]}" -ne "${#packages[@]}"; then + echo "**** ERROR: number of distribution lists doesn't match package lists" 1>&2 + echo " distribution lists: ${#distros[@]}" 1>&2 + echo " package lists: ${#packages[@]}" 1>&2 + exit 1 +fi -for arch in ${archs}; do - for distro in ${distros}; do - if test "${ubuntu//${distro}/}" != "${ubuntu}"; then +for ((i=0; i<${#distros[@]}; ++i)); do + package="${packages[${index:-$i}]}" + for distro in ${distros[$i]}; do + ubuntus="${ubuntu[@]}" + if test "${ubuntus//${distro}/}" != "${ubuntus}"; then type="ubuntu" else type="debian" fi - echo "******** process $type $distro $arch ********" 1>&2 - if test -d "${tmpdir}/${distro}-${arch}"; then - echo " ++++ already exists ${tmpdir}/${distro}-${arch}" 1>&2 - else - echo " ---- install ${tmpdir}/${distro}-${arch}" 1>&2 - sudo debootstrap --arch="$arch" "$distro" "${tmpdir}/${distro}-${arch}" - fi - echo " ---- prevent packages in ${tmpdir}/${distro}-${arch}" 1>&2 - for f in "libpam-systemd:amd64" "policykit*" "colord"; do - sudo chroot "${tmpdir}/${distro}-${arch}" cat >> /etc/apt/preferences <&2 + if test -d "${tmpdir}/${distro}-${arch}"; then + echo " ++++ already exists ${tmpdir}/${distro}-${arch}" 1>&2 + else + echo " ---- install ${tmpdir}/${distro}-${arch}" 1>&2 + sudo debootstrap --arch="$arch" "$distro" "${tmpdir}/${distro}-${arch}" + fi + echo " ---- prevent packages in ${tmpdir}/${distro}-${arch}" 1>&2 + for f in "dbus" "libpam-systemd*" "packagekit*" "policykit*" "colord"; do + sudo chroot "${tmpdir}/${distro}-${arch}" <> /etc/apt/preferences <&2 - sudo chroot "${tmpdir}/${distro}-${arch}" apt-get update - sudo chroot "${tmpdir}/${distro}-${arch}" apt-get -y upgrade - sudo chroot "${tmpdir}/${distro}-${arch}" apt-get -y dist-upgrade - for package in "${packages[@]}"; do - echo " ---- install ${package//|/ or } to ${tmpdir}/${distro}-${arch}" 1>&2 - IFS='|' read -r -a pkgs <<< "$package" - success=0 - for pkg in "${pkgs[@]}"; do - if sudo chroot "${tmpdir}/${distro}-${arch}" apt-get install -y ${pkg}; then - success=1; - break; - fi +EOF2 +fi +EOF1 done - test $success -eq 1 + echo " ---- upgrade ${tmpdir}/${distro}-${arch}" 1>&2 + sudo chroot "${tmpdir}/${distro}-${arch}" apt-get update + sudo chroot "${tmpdir}/${distro}-${arch}" apt-get -y upgrade + sudo chroot "${tmpdir}/${distro}-${arch}" apt-get install -y python-software-properties software-properties-common || \ + sudo chroot "${tmpdir}/${distro}-${arch}" apt-get install -y software-properties-common + if test "${distro}" != "jessie" -a "${distro}" != "sid"; then + sudo chroot "${tmpdir}/${distro}-${arch}" add-apt-repository universe || \ + sudo chroot "${tmpdir}/${distro}-${arch}" add-apt-repository "deb http://archive.ubuntu.com/ubuntu ${distro} universe" + fi + sudo chroot "${tmpdir}/${distro}-${arch}" apt-get update + sudo chroot "${tmpdir}/${distro}-${arch}" apt-get -y dist-upgrade + echo " ---- install ${package} to ${tmpdir}/${distro}-${arch}" 1>&2 + sudo chroot "${tmpdir}/${distro}-${arch}" apt-get install -y ${package} + echo " ---- import ${tmpdir}/${distro}-${arch} to ${docker_user}/${type}:${distro}-${arch}" 1>&2 + cd "${tmpdir}/${distro}-${arch}" + sudo tar c . | docker import - "${docker_user}/${type}:${distro}-${arch}" + echo " ---- push ${tmpdir}/${distro}-${arch} to ${docker_user}/${type}:${distro}-${arch}" 1>&2 + docker push "${docker_user}/${type}:${distro}-${arch}" done - echo " ---- import ${tmpdir}/${distro}-${arch} to ${docker_user}/${type}:${distro}-${arch}" 1>&2 - cd "${tmpdir}/${distro}-${arch}" - sudo tar c . | docker import - "${docker_user}/${type}:${distro}-${arch}" - echo " ---- push ${tmpdir}/${distro}-${arch} to ${docker_user}/${type}:${distro}-${arch}" 1>&2 - docker push "${docker_user}/${type}:${distro}-${arch}" done done diff --git a/scripts/setup-debootstrap.sh b/scripts/setup-debootstrap.sh index cfb7ffb..a5c2f2a 100755 --- a/scripts/setup-debootstrap.sh +++ b/scripts/setup-debootstrap.sh @@ -6,7 +6,7 @@ fi archs=${archs:-"i386 amd64"} -distros=${distros:-"wily vivid trusty precise buster stretch jessie wheezy squeeze sid"} +distros=${distros:-"xenial wily vivid trusty precise buster stretch jessie wheezy squeeze sid"} user=${user:-"${USER},jenkins"} for arch in ${archs}; do