From 1448117754225ab2f9e1c22689132a2090dcefd9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Diemer?= <stephane.diemer@ubicast.eu>
Date: Thu, 2 Feb 2017 14:24:38 +0100
Subject: [PATCH] Changed APT setup.

---
 .../3.Initialize_APT/0_setup.sh               | 52 ++++++++-----------
 1 file changed, 22 insertions(+), 30 deletions(-)

diff --git a/3.New_server_deployment/3.Initialize_APT/0_setup.sh b/3.New_server_deployment/3.Initialize_APT/0_setup.sh
index 0c0d3a2a..1365dfdf 100755
--- a/3.New_server_deployment/3.Initialize_APT/0_setup.sh
+++ b/3.New_server_deployment/3.Initialize_APT/0_setup.sh
@@ -1,24 +1,8 @@
 #!/bin/bash
 source /root/envsetup/global-conf.sh
 
-# migrate to Ubuntu 16.04 / apply sources.list
-if ( rgrep '14.04' /etc/lsb-release >/dev/null ); then
-	echo "Upgrading to Ubuntu 16.04."
-	apt-get update
-	apt-get dist-upgrade -y
-	cp sources16.list /etc/apt/sources.list
-	apt-get update
-	DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get dist-upgrade -o Dpkg::Options::="--force-confold" --force-yes -y
-	apt-get install -f -y
-	apt-get dist-upgrade -y
-else
-	echo "Updating Ubuntu 16.04 sources.list."
-	cp sources16.list /etc/apt/sources.list
-fi
-
-# update
-apt-get update
-apt-get install -y apt-transport-https
+# resolvconf
+apt-get purge -y resolvconf
 
 # modify sources.list to use ubicast cache
 if ( ! test -z ${APT_CACHE_HOST} ); then
@@ -36,8 +20,8 @@ if ( ! test -z ${SKYREACH_API_KEY} ); then
 fi
 
 # APT proxy
-if [ ${PROXY} = "1" ]; then
-	if [ ${PROXY_AUTHENTICATION} = "1" ]; then
+if [ "${PROXY}" = "1" ]; then
+	if [ "${PROXY_AUTHENTICATION}" = "1" ]; then
 		# general settings
 		echo "Proxy: http://${PROXY_USER}:${PROXY_PWD}@${PROXY_HTTP}:${PROXY_PORT}" >> /etc/apt-cacher-ng/acng.conf
 	else
@@ -46,7 +30,25 @@ if [ ${PROXY} = "1" ]; then
 	fi
 fi
 
+# update
 apt-get update
+apt-get install -y apt-transport-https
+apt-get dist-upgrade -y
+
+# migrate to Ubuntu 16.04 / apply sources.list
+if ( rgrep '14.04' /etc/lsb-release >/dev/null ); then
+	echo "Upgrading to Ubuntu 16.04."
+	cp sources16.list /etc/apt/sources.list
+	apt-get update
+	DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get dist-upgrade -o Dpkg::Options::="--force-confold" --force-yes -y
+	apt-get install -f -y
+	apt-get dist-upgrade -y
+else
+	echo "Updating Ubuntu 16.04 sources.list file."
+	cp sources16.list /etc/apt/sources.list
+	apt-get update
+	apt-get dist-upgrade -y
+fi
 
 # unattended-upgrades
 echo "Installing and configuring unattended-upgrades."
@@ -54,13 +56,3 @@ apt-get install -y unattended-upgrades
 sed -i 's@//Unattended-Upgrade::Mail "root";@Unattended-Upgrade::Mail "root";@' /etc/apt/apt.conf.d/50unattended-upgrades
 sed -i 's@//*.*"vim";@"mysql-server";@' /etc/apt/apt.conf.d/50unattended-upgrades
 sed -i 's@//*.*"libc6";@"mysql-client";@' /etc/apt/apt.conf.d/50unattended-upgrades
-# configure frequence
-cat > /etc/apt/apt.conf.d/10periodic << EOF
-APT::Periodic::Update-Package-Lists "1";
-APT::Periodic::Download-Upgradeable-Packages "1";
-APT::Periodic::AutocleanInterval "7";
-APT::Periodic::Unattended-Upgrade "1";
-EOF
-
-# resolvconf
-apt-get purge -y resolvconf
-- 
GitLab