|
|
|
@ -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 <<EOF |
|
|
|
|
for arch in ${archs}; do |
|
|
|
|
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 "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 |
|
|
|
|
Pin-Priority: -100 |
|
|
|
|
|
|
|
|
|
EOF |
|
|
|
|
done |
|
|
|
|
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 -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 |
|
|
|
|