Disable auto updates on Ubuntu 13/5113/5
authorVanessa Rene Valderrama <vvalderrama@linuxfoundation.org>
Mon, 13 Feb 2017 17:39:10 +0000 (11:39 -0600)
committerVanessa Rene Valderrama <vvalderrama@linuxfoundation.org>
Mon, 13 Feb 2017 21:46:41 +0000 (15:46 -0600)
Modifying the disable auto updates on Ubuntu to use perl instead of sed
because the sed -ine is creating new files ending in ne.  Modifying
where the apt-get upgrade and updates occur to resolve dpkg/locks which
are causing VPP & NSH_SFC builds to fail.

Change-Id: I5a81d72df7b758bd8287c54909386114c33ed730
Signed-off-by: Vanessa Rene Valderrama <vvalderrama@linuxfoundation.org>
jenkins-scripts/basic_settings.sh
packer/provision/basebuild.sh
packer/provision/baseline.sh

index 5701d0b..09563cd 100755 (executable)
 
 case "$(facter operatingsystem)" in
   Ubuntu)
-    # catch extra auto-update scripts that were missed in packer
-    sed -ine 's/"1"/"0"/g' /etc/apt/apt.conf.d/10periodicne
-    sed -ine 's/"1"/"0"/g' /etc/apt/apt.conf.d/20auto-upgrades
-
-    apt-get update
     # make sure that the ca-certs are properly updated
     /usr/sbin/update-ca-certificates
 
@@ -24,6 +19,7 @@ case "$(facter operatingsystem)" in
 
     # Configure Ubuntu mirror
     perl -pi -e 'unless(m{(security|fd\.io)}){ s{://[^/]+/}{://ca.archive.ubuntu.com/} }' /etc/apt/sources.list
+    apt-get update
     ;;
   *)
     # Do nothing on other distros for now
index 75eecc9..082cfcc 100644 (file)
@@ -80,6 +80,24 @@ rh_systems() {
 
 ubuntu_systems() {
 
+    # DEB add Toolchain repo
+    sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
+
+    #Configuring thirdparty Nexus repo
+    echo "deb [trusted=yes] https://nexus.fd.io/content/repositories/thirdparty ./" > /etc/apt/sources.list.d/FD.io.thirdparty.list
+
+    # DEB Install PPA packages
+    echo "---> Adding '$1' PPA $(date +'%Y%m%dT%H%M%S')"
+    dpkg -l software-properties-common > /dev/null 2>&1 || software-properties-common
+
+    listfile=$(perl -e "print(q{$1} =~ m{^ppa:(.+)/ppa})")-ppa-${CODENAME}.list
+      if [ ! -f /etc/apt/sources.list.d/${listfile} ]
+      then
+        do_retry sudo apt-add-repository -y $1
+      fi
+
+    apt-get update
+
     # DEB cloud packages
     echo "---> Installing cloud packages $(date +'%Y%m%dT%H%M%S')"
     CLOUD_PKGS="cloud-initramfs-dyn-netconf cloud-initramfs-growroot cloud-initramfs-rescuevol"
@@ -101,27 +119,15 @@ ubuntu_systems() {
     # DEB Install the correct version of toolchain packages
     echo "---> Installing latest toolchain packages from PPA $(date +'%Y%m%dT%H%M%S')"
 
-    # DEB Install PPA packages
-    echo "---> Adding '$1' PPA $(date +'%Y%m%dT%H%M%S')"
-    dpkg -l software-properties-common > /dev/null 2>&1 || software-properties-common
-
-    listfile=$(perl -e "print(q{$1} =~ m{^ppa:(.+)/ppa})")-ppa-${CODENAME}.list
-      if [ ! -f /etc/apt/sources.list.d/${listfile} ]
-      then
-        do_retry sudo apt-add-repository -y $1
-      fi
-
     #Retry to prevent timeout failure
-    echo "---> Updating package index $(date +'%Y%m%dT%H%M%S')"
-    do_retry sudo apt-get update
-    echo "<--- Updating package index $(date +'%Y%m%dT%H%M%S')"
-    echo "<--- Adding '$1' PPA $(date +'%Y%m%dT%H%M%S')"
+    #echo "---> Updating package index $(date +'%Y%m%dT%H%M%S')"
+    #do_retry sudo apt-get update
+    #echo "<--- Updating package index $(date +'%Y%m%dT%H%M%S')"
+    #echo "<--- Adding '$1' PPA $(date +'%Y%m%dT%H%M%S')"
 
     # DEB Install GCC packages
     echo "---> Installing GCC-5 packages $(date +'%Y%m%dT%H%M%S')"
     GCC_PKGS="cpp gcc g++ cmake lcov gcc-multilib"
-    sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
-    sudo apt-get update
     apt install -y ${GCC_PKGS}
 
     # DEB Install VPP packages to shorten build times
@@ -134,17 +140,12 @@ ubuntu_systems() {
     # DEB Install CSIT packages
     CSIT_PKGS="libxml2 libxml2-dev libxslt-dev zlib1g-dev bc unzip"
     apt install -y ${CSIT_PKGS}
-    pip install
 
     # DEB Install latest kernel and uio
     echo "---> Installing kernel image and header packages $(date +'%Y%m%dT%H%M%S')"
     DEB_PKGS="linux-image-extra-virtual linux-headers-virtual linux-headers-`uname -r`"
     apt install -y ${DEB_PKGS}
 
-    #Configuring thirdparty Nexus repo
-    echo "deb [trusted=yes] https://nexus.fd.io/content/repositories/thirdparty ./" > /etc/apt/sources.list.d/FD.io.thirdparty.list
-    apt-get update
-
     # DEB Install deb_dpdk packages to shorten build times
     ###REMOVED sphinx-rtd-theme
     echo "---> Installing deb_dpdk packages $(date +'%Y%m%dT%H%M%S')"
@@ -162,9 +163,6 @@ ubuntu_systems() {
     TOOL_PKGS="iproute2 ethtool vlan bridge-utils vim gdb lsb-release gdbserver"
     apt install -y ${TOOL_PKGS}
 
-    # DEB Clean up packages for a smaller image
-    apt-get update
-
     # DEB Updating CA certificates
     echo "---> Forcing CA certificate update $(date +'%Y%m%dT%H%M%S')"
       sudo update-ca-certificates -f > /dev/null 2>&1
index 6fcc1b0..0552525 100644 (file)
@@ -103,6 +103,15 @@ Dpkg::Options {
 
 EOF
 
+    # make jdk8 available
+    add-apt-repository -y ppa:openjdk-r/ppa > /dev/null
+    # We need to force openjdk-8-jdk to install
+    apt-get install -qq openjdk-8-jdk > /dev/null
+
+    # disable unattended upgrades & daily updates
+    echo '---> Disabling automatic daily upgrades'
+    grep -lR 'APT::Periodic' /etc/apt/apt.conf.d/ | perl -pi -e 's/"1"/"0"/g'
+
     echo "---> Updating operating system"
     apt-get update -qq > /dev/null
     apt-get upgrade -qq > /dev/null
@@ -115,12 +124,6 @@ EOF
     echo "---> Configuring OpenJDK"
     apt-get install -qq openjdk-7-jdk > /dev/null
 
-    # make jdk8 available
-    add-apt-repository -y ppa:openjdk-r/ppa > /dev/null
-    apt-get update -qq > /dev/null
-    # We need to force openjdk-8-jdk to install
-    apt-get install -qq openjdk-8-jdk > /dev/null
-
     # 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
@@ -129,10 +132,6 @@ EOF
     # stack commands to initialize Heat template based systems.
     apt-get install -qq jq > /dev/null
 
-    # 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
 }
 
 all_systems() {