chiark / gitweb /
buildserver: download apt package first to increase reliability
authorHans-Christoph Steiner <hans@eds.org>
Tue, 6 Sep 2016 12:33:13 +0000 (14:33 +0200)
committerHans-Christoph Steiner <hans@eds.org>
Mon, 12 Sep 2016 12:58:08 +0000 (14:58 +0200)
This does not have the careful result rechecking that chef has, when it
installs each package in the list one at a time.  So to help with failures
caused by a package failing to download, first try downloading all the
package, then run the install.  The install pass will try to download any
missing packages.

Really, this should use ansible or perhaps chef again since those include
lots of tricks around this stuff.

buildserver/provision-apt-get-install

index deeb0c66afa3e6f155a7fcd26f7650607e1e2cc7..099090501e00b2168f72bcefc8f4992fe3978d71 100644 (file)
@@ -8,6 +8,9 @@ debian_mirror=$1
 
 sed -i "s,http://ftp.uk.debian.org/debian/,${debian_mirror},g" /etc/apt/sources.list
 
+printf 'APT::Install-Recommends "0";\nAPT::Install-Suggests "0";\n' \
+       > /etc/apt/apt.conf.d/99no-install-recommends
+
 if grep --quiet jessie /etc/apt/sources.list; then
     echo "deb $debian_mirror jessie-backports main" > /etc/apt/sources.list.d/backports.list
 fi
@@ -15,6 +18,7 @@ fi
 dpkg --add-architecture i386
 
 apt-get -y update
+apt-get -y upgrade --download-only
 apt-get -y upgrade
 
 packages="
@@ -87,8 +91,8 @@ packages="
  zip
  zlib1g:i386
 "
-
-apt-get install --yes --no-install-recommends $packages
+apt-get install --yes $packages --download-only
+apt-get install --yes $packages
 
 highestjava=`update-java-alternatives --list | sort -n | tail -1 | cut -d ' ' -f 1`
 update-java-alternatives --set $highestjava