From 3c071f6ff60e6fd5afde17d113beb50f1e246422 Mon Sep 17 00:00:00 2001
From: Andreas Loibl <andreas@andreas-loibl.de>
Date: Fri, 9 Nov 2012 15:41:33 +0100
Subject: improved compat functions

---
 auto/config           | 12 ++----------
 auto/functions/compat | 28 ++++++++++++++++++++++------
 2 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/auto/config b/auto/config
index 74de21f..fc9de9c 100755
--- a/auto/config
+++ b/auto/config
@@ -39,17 +39,9 @@ lb config noauto \
 	--mirror-binary ${MIRROR_BINARY} \
 	--mirror-binary-security ${MIRROR_BINARY_SECURITY} \
 	--binary-indices true \
-	"${@}" || exit $?
-
-# hostname and username are configured in config/chroot_local-includes/etc/live/config.conf
-#lb config noauto \
-#	--hostname Kanotix \
-#	--username kanotix \
-
-# disable firmware packages (needed for newer lb versions)
-lb config noauto \
 	--firmware-binary false \
-	--firmware-chroot false
+	--firmware-chroot false \
+	"${@}" || exit $?
 
 . config/binary
 . config/bootstrap
diff --git a/auto/functions/compat b/auto/functions/compat
index c3c1c3b..e93c386 100644
--- a/auto/functions/compat
+++ b/auto/functions/compat
@@ -17,20 +17,34 @@ Compat_arguments ()
 		# ignore other unsupported arguments
 		--syslinux-*|--bootstrap-config|-e|--encryption|-l|--language) shift; continue;;
 		--binary-indices|--packages|--symlinks|--sysvinit|--tasks|--virtual-root-size) shift; continue;;
-		--packages-lists|--package-lists|-p) Compat_packagelists $1; shift; continue;;
+		--packages-lists|--package-lists|-p) shift; continue;;
 		esac
 		echo -n "$arg$IFS"
 	done
 }
 
+Compat_arguments_functions ()
+{
+	while [ "$#" -gt 0 ]
+	do
+		arg="$1"
+		shift
+		case "$arg" in
+		--packages-lists|--package-lists|-p) Compat_packagelists $1; shift; continue;;
+		esac
+	done
+}
+
 Compat_config ()
 {
-[ -e config/chroot ] && [ "$LB_ARCHIVES" ] && cat <<eof >> config/chroot
+if [ -e config/chroot ]; then
+cat <<eof >> config/chroot
 
 # Compat (Live-build 2 -> 3)
-LB_REPOSITORIES="$LB_ARCHIVES"
-LB_PACKAGES_LISTS="$LB_PACKAGE_LISTS"
 eof
+	[ "$LB_ARCHIVES" ] && echo "LB_REPOSITORIES=\"$LB_ARCHIVES\"" >> config/chroot
+	[ "$LB_PACKAGE_LISTS" ] && echo "LB_PACKAGE_LISTS=\"$LB_PACKAGE_LISTS\";LB_PACKAGES_LISTS=\"$LB_PACKAGE_LISTS\"" >> config/chroot
+fi
 [ -e config/bootstrap ] && [ "$LB_ARCHITECTURES" ] && cat <<eof >> config/bootstrap
 
 # Compat (Live-build 2 -> 3)
@@ -67,8 +81,8 @@ Compat_dir ()
 
 Compat_packagelists()
 {
-	LB_PACKAGE_LISTS="$1"
-	LB_PACKAGES_LISTS="$1"
+	LB_PACKAGE_LISTS="$@"
+	LB_PACKAGES_LISTS="$@"
 	mkdir -p config/package-lists
 	(
 		echo '# AUTOGENERATED from "lb config -p" option - DO NOT CHANGE'
@@ -102,6 +116,7 @@ case "$LB_VERSION" in
 			auto/config "$@"
 			exit $?
 		fi
+		Compat_arguments_functions "$@"
 		OIFS="$IFS"; IFS="$(printf \\a)"
 		set -- $(Compat_arguments "$@")
 		IFS="$OIFS"
@@ -111,6 +126,7 @@ case "$LB_VERSION" in
 		LB_PACKAGES_LISTS="$LB_PACKAGE_LISTS"
 		[ -z "$LB_ARCHITECTURES" ] && LB_ARCHITECTURES="$LB_ARCHITECTURE"
 		LB_ARCHITECTURE="$LB_ARCHITECTURES"
+		Compat_config || :
 		trap Compat_config EXIT
 		;;
 	chroot_apt)
-- 
cgit v1.0