Subject: Automatically setting-up backports repository when specifying lenny-backports as target distribution.

From: Daniel Baumann <[email-masked]>
Date: Tue, 12 Jan 2010 05:36:45 +0100

---
 helpers/lh_config | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/helpers/lh_config b/helpers/lh_config
index 3edd816..83a8242 100755
--- a/helpers/lh_config
+++ b/helpers/lh_config
@@ -381,7 +381,15 @@ Local_arguments ()
 
 			-d|--distribution)
 				LH_DISTRIBUTION="${2}"
+				BACKPORTS="false"
 				shift 2
+
+				case "${LH_DISTRIBUTION}" in
+					lenny-backports)
+						LH_DISTRIBUTION="lenny"
+						BACKPORTS="true"
+						;;
+				esac
 				;;
 
 			-m|--mirror-bootstrap)
@@ -1263,5 +1271,34 @@ then
 	fi
 fi
 
+if [ "${BACKPORTS}" = "true" ]
+then
+	# Adding sources.list entry
+
+cat > config/chroot_sources/${LH_DISTRIBUTION}-backports.chroot << EOF
+# Backports Maintainers
+deb http://backports.debian-maintainers.org/ ${LH_DISTRIBUTION}/backports main contrib non-free
+deb-src http://backports.debian-maintainers.org/ ${LH_DISTRIBUTION}/backports main contrib non-free
+EOF
+
+	cp config/chroot_sources/${LH_DISTRIBUTION}-backports.chroot config/chroot_sources/${LH_DISTRIBUTION}-backports.binary
+
+	# Adding apt preferences
+	if ! grep -qs "^Pin: release o=backports.debian-maintainerns.org" config/chroot_apt/preferences
+	then
+
+cat >> config/chroot_apt/preferences << EOF
+Package: *
+Pin: release o=backports.debian-maintainerns.org
+Pin-Priority: 999
+EOF
+
+	fi
+
+	# Addding archive signing key
+	wget -q http://backports.debian-maintainers.org/project/openpgp/archive-key.asc -O config/chroot_sources/${LH_DISTRIBUTION}-backports.chroot.gpg
+	cp config/chroot_sources/${LH_DISTRIBUTION}-backports.chroot.gpg config/chroot_sources/${LH_DISTRIBUTION}-backports.binary.gpg
+fi
+
 # Creating stage file
 Create_stagefile .stage/config
-- 
cgit v1.0