From 716d31d5877dc5d7f4f0182d7a9aaabca825231e Mon Sep 17 00:00:00 2001
From: Chris Lamb <chris@chris-lamb.co.uk>
Date: Tue, 15 Jan 2008 02:41:10 +0000
Subject: Don't put more than one glob on a 'for' line, unless they are
 guaranteed to succeed, otherwise the second one is not expanded and "*.deb"
 (for example) is used literally.

This patch expands (haha) each "for" loop into it's own.
---
 helpers/lh_binary_debian-installer | 64 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 61 insertions(+), 3 deletions(-)

diff --git a/helpers/lh_binary_debian-installer b/helpers/lh_binary_debian-installer
index 056d89d..0bf778c 100755
--- a/helpers/lh_binary_debian-installer
+++ b/helpers/lh_binary_debian-installer
@@ -227,10 +227,39 @@ if [ "${LH_DEBIAN_INSTALLER}" != "netboot" ]; then
 	mv chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status
 fi
 
+if ls binary.deb/archives/*.deb > /dev/null 2>&1
+then
+	for FILE in binary.deb/archives/*.deb
+	do
+		SOURCE="$(dpkg -f ${FILE} Source | awk '{ print $1 }')"
+
+		if [ -z "${SOURCE}" ]
+		then
+			SOURCE="$(basename ${FILE} | awk -F_ '{ print $1 }')"
+		fi
+
+		case "${SOURCE}" in
+			lib?*)
+				LETTER="$(echo ${SOURCE} | sed 's/\(....\).*/\1/')"
+				;;
+
+			*)
+				LETTER="$(echo ${SOURCE} | sed 's/\(.\).*/\1/')"
+				;;
+		esac
+
+		# Install directory
+		mkdir -p binary/pool/main/"${LETTER}"/"${SOURCE}"
+
+		# Move files
+		cp "${FILE}" binary/pool/main/"${LETTER}"/"${SOURCE}"
+	done
+fi
+
 # Including base debian packages
 if [ -d cache/packages_bootstrap ]
 then
-	for FILE in cache/packages_bootstrap/*.deb binary.deb/archives/*.deb
+	for FILE in cache/packages_bootstrap/*.deb
 	do
 		SOURCE="$(dpkg -f ${FILE} Source | awk '{ print $1 }')"
 
@@ -261,9 +290,38 @@ else
 fi
 
 # Including local debs
-if ls ../config/binary_local-debs/*.deb > /dev/null 2>&1
+if ls ../config/binary_local-debs/*_"${LH_ARCHITECTURE}".deb > /dev/null 2>&1
+then
+	for FILE in ../config/binary_local-debs/*_"${LH_ARCHITECTURE}".deb
+	do
+		SOURCE="$(dpkg -f ${FILE} Source | awk '{ print $1 }')"
+
+		if [ -z "${SOURCE}" ]
+		then
+			SOURCE="$(basename ${FILE} | awk -F_ '{ print $1 }')"
+		fi
+
+		case "${SOURCE}" in
+			lib?*)
+				LETTER="$(echo ${SOURCE} | sed 's/\(....\).*/\1/')"
+				;;
+
+			*)
+				LETTER="$(echo ${SOURCE} | sed 's/\(.\).*/\1/')"
+				;;
+		esac
+
+		# Install directory
+		mkdir -p binary/pool/main/"${LETTER}"/"${SOURCE}"
+
+		# Move files
+		cp "${FILE}" binary/pool/main/"${LETTER}"/"${SOURCE}"
+	done
+fi
+
+if ls ../config/binary_local-debs/*_all.deb > /dev/null 2>&1
 then
-	for FILE in ../config/binary_local-debs/*_"${LH_ARCHITECTURE}".deb ../config/binary_local-debs/*_all.deb
+	for FILE in ../config/binary_local-debs/*_all.deb
 	do
 		SOURCE="$(dpkg -f ${FILE} Source | awk '{ print $1 }')"
 
-- 
cgit v1.0