From f40a15b788d02a3d5a0072a44ec40ba7f1500f9b Mon Sep 17 00:00:00 2001
From: Michael Prokop <mprokop@sipwise.com>
Date: Tue, 10 Mar 2015 10:22:38 +0100
Subject: [PATCH] MT#7335 Disable security mirror when installing jessie

Noticed in failing Jenkins job
https://jenkins.mgm.sipwise.com/job/daily-build-install-vm/7470/
being downstream of https://jenkins.mgm.sipwise.com/job/build-trunk-systemd-vms:

| W: Failed to fetch http://debian.sipwise.com/debian-security/dists/jessie-security/non-free/binary-amd64/Packages  404  Not Found [IP: 77.244.249.93 80]

Debian/jessie gets security support once it's released as stable,
until then we've to ignore the (unavailable) debian-security mirror.

This fixes behaviour which got broken in git commit 05c83c88.

Change-Id: Icb5d9974b50119254f4ba0fa5b60b18a38dcb21c
---
 deployment.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/deployment.sh b/deployment.sh
index 592be90..de55747 100755
--- a/deployment.sh
+++ b/deployment.sh
@@ -1128,7 +1128,6 @@ fi
 # to avoid conflicts with apt-pinning, preferring deb.sipwise.com
 # over official Debian
 MIRROR="http://${DEBIAN_REPO_HOST}/debian/"
-SEC_MIRROR="http://${DEBIAN_REPO_HOST}/debian-security/"
 KEYRING='/etc/apt/trusted.gpg.d/sipwise.gpg'
 
 set_deploy_status "debootstrap"
@@ -1140,12 +1139,13 @@ cat > /etc/debootstrap/etc/apt/sources.list << EOF
 deb ${MIRROR} ${DEBIAN_RELEASE} main contrib non-free
 EOF
 
-# drop this once Debian/jessie has security support
-if [ -n "$SEC_MIRROR" ] ; then
-  echo "deb ${SEC_MIRROR} ${DEBIAN_RELEASE}-security main contrib non-free" >> /etc/debootstrap/etc/apt/sources.list
+# drop this once Debian/jessie has security support (AKA released as stable)
+if [ "$DEBIAN_RELEASE" = "jessie" ] ; then
+  echo  "Warning: not enabling security repository for $DEBIAN_RELEASE"
+  logit "Warning: not enabling security repository for $DEBIAN_RELEASE"
 else
-  echo  "Warning: security mirror variable SEC_MIRROR is unset, not enabling security repository for $DEBIAN_RELEASE"
-  logit "Warning: security mirror variable SEC_MIRROR is unset, not enabling security repository for $DEBIAN_RELEASE"
+  SEC_MIRROR="http://${DEBIAN_REPO_HOST}/debian-security/"
+  echo "deb ${SEC_MIRROR} ${DEBIAN_RELEASE}-security main contrib non-free" >> /etc/debootstrap/etc/apt/sources.list
 fi
 
 echo "deb ${MIRROR} ${DEBIAN_RELEASE}-updates main contrib non-free" >> /etc/debootstrap/etc/apt/sources.list