master
Marc Wäckerlin 9 years ago
parent 8e1c3f5192
commit f066ff9a4d
  1. 107
      scripts/bootstrap-to-docker.sh
  2. 2
      scripts/setup-debootstrap.sh

@ -12,56 +12,85 @@ if test -f /etc/setup-debootstrap.conf; then
. /etc/setup-debootstrap.conf . /etc/setup-debootstrap.conf
fi fi
tmpdir=${tmpdir:-"/var/tmp"}
docker_user=${docker_user:-${USER}}
archs=${archs:-"i386 amd64"} archs=${archs:-"i386 amd64"}
ubuntu=${ubuntu:-"wily vivid trusty precise"} ubuntu_qt5="xenial wily vivid trusty"
debian=${debian:-"jessie wheezy squeeze sid"} ubuntu_qt4="precise"
distros="${ubuntu} ${debian}" debian_qt5="jessie sid"
tmpdir=${tmpdir:-"/var/tmp"} debian_qt4="wheezy"
packages=(${packages:-"python-software-properties software-properties-common|software-properties-common|python-software-properties" "apt-transport-https dpkg-dev lsb-release"}) 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 ((i=0; i<${#distros[@]}; ++i)); do
for distro in ${distros}; do package="${packages[${index:-$i}]}"
if test "${ubuntu//${distro}/}" != "${ubuntu}"; then for distro in ${distros[$i]}; do
ubuntus="${ubuntu[@]}"
if test "${ubuntus//${distro}/}" != "${ubuntus}"; then
type="ubuntu" type="ubuntu"
else else
type="debian" type="debian"
fi fi
echo "******** process $type $distro $arch ********" 1>&2 for arch in ${archs}; do
if test -d "${tmpdir}/${distro}-${arch}"; then echo "******** process $type $distro $arch ********" 1>&2
echo " ++++ already exists ${tmpdir}/${distro}-${arch}" 1>&2 if test -d "${tmpdir}/${distro}-${arch}"; then
else echo " ++++ already exists ${tmpdir}/${distro}-${arch}" 1>&2
echo " ---- install ${tmpdir}/${distro}-${arch}" 1>&2 else
sudo debootstrap --arch="$arch" "$distro" "${tmpdir}/${distro}-${arch}" echo " ---- install ${tmpdir}/${distro}-${arch}" 1>&2
fi sudo debootstrap --arch="$arch" "$distro" "${tmpdir}/${distro}-${arch}"
echo " ---- prevent packages in ${tmpdir}/${distro}-${arch}" 1>&2 fi
for f in "libpam-systemd:amd64" "policykit*" "colord"; do echo " ---- prevent packages in ${tmpdir}/${distro}-${arch}" 1>&2
sudo chroot "${tmpdir}/${distro}-${arch}" cat >> /etc/apt/preferences <<EOF for f in "dbus" "libpam-systemd*" "packagekit*" "policykit*" "colord"; do
sudo chroot "${tmpdir}/${distro}-${arch}" <<EOF1
if ! grep -q "Package: $f" /etc/apt/preferences; then
cat >> /etc/apt/preferences <<EOF2
Package: $f Package: $f
Pin-Priority: -100 Pin-Priority: -100
EOF EOF2
done fi
echo " ---- upgrade ${tmpdir}/${distro}-${arch}" 1>&2 EOF1
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
done 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 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
done done

@ -6,7 +6,7 @@ fi
archs=${archs:-"i386 amd64"} 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"} user=${user:-"${USER},jenkins"}
for arch in ${archs}; do for arch in ${archs}; do

Loading…
Cancel
Save