diff options
author | Andrew Grimberg <agrimberg@linuxfoundation.org> | 2017-02-15 07:02:53 -0800 |
---|---|---|
committer | Andrew Grimberg <agrimberg@linuxfoundation.org> | 2017-02-15 07:02:53 -0800 |
commit | 3d86863d482a342355f647e38520884b0d6bc0e8 (patch) | |
tree | 950d307adbb80f2476dda6ae796b8695b2c9c37a /packer/provision | |
parent | 8b18a2562ee7a85eab134e1ded54f6478ae6433d (diff) |
Update baseline to match recent changes
Add in more fixes to keep Ubuntu systems from doing auto-updates as well
as to shim apt-get to wait on currently running apt processes
Change-Id: Ibb670b9b6170ca4b82ba25fb851a984eb3857439
Signed-off-by: Andrew Grimberg <agrimberg@linuxfoundation.org>
Diffstat (limited to 'packer/provision')
-rw-r--r-- | packer/provision/baseline.sh | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/packer/provision/baseline.sh b/packer/provision/baseline.sh index 68a16226f..99e7460cf 100644 --- a/packer/provision/baseline.sh +++ b/packer/provision/baseline.sh @@ -115,6 +115,31 @@ Dpkg::Options { EOF + # Wrap apt-get to wait for the lock to become available for operation + # http://askubuntu.com/questions/132059/how-to-make-a-package-manager-wait-if-another-instance-of-apt-is-running + cat << 'EOF' >> /usr/local/bin/apt-get +#!/bin/bash + +i=0 +tput sc +while fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do + case $(($i % 4)) in + 0 ) j="-" ;; + 1 ) j="\\" ;; + 2 ) j="|" ;; + 3 ) j="/" ;; + esac + tput rc + echo -en "\r[$j] Waiting for other software managers to finish..." + sleep 0.5 + ((i=i+1)) +done + +/usr/bin/apt-get "$@" + +EOF + chmod +x /usr/local/bin/apt-get + echo "---> Updating operating system" apt-get update apt-get upgrade @@ -137,9 +162,23 @@ EOF # make sure that we still default to openjdk 7 update-alternatives --set java /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java update-alternatives --set javac /usr/lib/jvm/java-7-openjdk-amd64/bin/javac + + # disable auto-update service? + if [ -f /etc/cron.daily/apt ] + then + rm -rf /etc/cron.daily/apt + fi ;; 16.04) apt-get install openjdk-8-jdk + + # force auto-update services off and mask them so they can't + # be started + for i in apt-daily.{service,timer} + do + systemctl disable ${i} + systemctl mask ${i} + done ;; *) echo "---> Unknown Ubuntu version $FACTER_OSVER" @@ -155,8 +194,8 @@ EOF # disable unattended upgrades & daily updates echo '---> Disabling automatic daily upgrades' - sed -ine 's/"1"/"0"/g' /etc/apt/apt.conf.d/10periodic - echo 'APT::Periodic::Unattended-Upgrade "0";' >> /etc/apt/apt.conf.d/10periodic + grep -lR 'APT::Periodic' /etc/apt/apt.conf.d/ | perl -pi -e 's/"1"/"0"/g' + } all_systems() { |