From 432402e32ba6118886034150a41c9795e63bbb25 Mon Sep 17 00:00:00 2001
From: Daniel Baumann <daniel@debian.org>
Date: Wed, 28 Sep 2011 09:53:58 +0200
Subject: Renaming and reworking previous chroot_local-preseed into
 chroot_preseed, now looking for config/preseed/*.preseed{,.chroot} files.

---
 scripts/build/lb_chroot               |  2 +-
 scripts/build/lb_chroot_local-preseed | 65 ----------------------------------
 scripts/build/lb_chroot_preseed       | 66 +++++++++++++++++++++++++++++++++++
 scripts/build/lb_config               |  6 ++--
 4 files changed, 70 insertions(+), 69 deletions(-)
 delete mode 100755 scripts/build/lb_chroot_local-preseed
 create mode 100755 scripts/build/lb_chroot_preseed

diff --git a/scripts/build/lb_chroot b/scripts/build/lb_chroot
index 072cc9885..8f28c84e5 100755
--- a/scripts/build/lb_chroot
+++ b/scripts/build/lb_chroot
@@ -53,7 +53,7 @@ lb chroot_archives chroot install ${*}
 
 # Customizing chroot
 lb chroot_linux-image ${*}
-lb chroot_local-preseed ${*}
+lb chroot_preseed ${*}
 
 for _PASS in install live
 do
diff --git a/scripts/build/lb_chroot_local-preseed b/scripts/build/lb_chroot_local-preseed
deleted file mode 100755
index d37f5ebc7..000000000
--- a/scripts/build/lb_chroot_local-preseed
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/bin/sh
-
-## live-build(7) - System Build Scripts
-## Copyright (C) 2006-2011 Daniel Baumann <daniel@debian.org>
-##
-## live-build comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
-## This is free software, and you are welcome to redistribute it
-## under certain conditions; see COPYING for details.
-
-
-set -e
-
-# Including common functions
-. "${LB_BASE:-/usr/share/live/build}"/scripts/build.sh
-
-# Setting static variables
-DESCRIPTION="$(Echo 'execute local preseed in chroot')"
-HELP=""
-USAGE="${PROGRAM} [--force]"
-
-Arguments "${@}"
-
-# Reading configuration files
-Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
-Set_defaults
-
-Echo_message "Begin executing local preseeds..."
-
-# Requiring stage file
-Require_stagefile .stage/config .stage/bootstrap
-
-# Checking stage file
-Check_stagefile .stage/chroot_local-preseed
-
-# Checking lock file
-Check_lockfile .lock
-
-# Creating lock file
-Create_lockfile .lock
-
-if Find_files config/chroot_local-preseed/*
-then
-	# Check dependency
-	Check_package chroot/usr/bin/debconf-set-selections debconf
-
-	# Install dependency
-	Install_package
-
-	for PRESEED in config/chroot_local-preseed/*
-	do
-		# Copying local preseed
-		cp "${PRESEED}" chroot/root/preseed
-
-		Chroot chroot "debconf-set-selections /root/preseed"
-
-		# Removing local preseed file
-		rm -f chroot/root/preseed
-	done
-
-	# Remove dependency
-	Remove_package
-
-	# Creating stage file
-	Create_stagefile .stage/chroot_local-preseed
-fi
diff --git a/scripts/build/lb_chroot_preseed b/scripts/build/lb_chroot_preseed
new file mode 100755
index 000000000..baeced847
--- /dev/null
+++ b/scripts/build/lb_chroot_preseed
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+## live-build(7) - System Build Scripts
+## Copyright (C) 2006-2011 Daniel Baumann <daniel@debian.org>
+##
+## live-build comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
+## This is free software, and you are welcome to redistribute it
+## under certain conditions; see COPYING for details.
+
+
+set -e
+
+# Including common functions
+. "${LB_BASE:-/usr/share/live/build}"/scripts/build.sh
+
+# Setting static variables
+DESCRIPTION="$(Echo 'execute local preseed in chroot')"
+HELP=""
+USAGE="${PROGRAM} [--force]"
+
+Arguments "${@}"
+
+# Reading configuration files
+Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
+Set_defaults
+
+Echo_message "Begin executing local preseeds..."
+
+# Requiring stage file
+Require_stagefile .stage/config .stage/bootstrap
+
+# Checking stage file
+Check_stagefile .stage/chroot_preseed
+
+# Checking lock file
+Check_lockfile .lock
+
+# Creating lock file
+Create_lockfile .lock
+
+if ls config/preseed/*.preseed > /dev/null 2>&1 || \
+   ls config/preseed/*.preseed.chroot > /dev/null 2>&1
+then
+	# Check dependency
+	Check_package chroot/usr/bin/debconf-set-selections debconf
+
+	# Install dependency
+	Install_package
+
+	for PRESEED in config/chroot_preseed/*.preseed config/chroot_preseed/*.preseed.chroot
+	do
+		# Copying local preseed
+		cp "${PRESEED}" chroot/root/preseed
+
+		Chroot chroot "debconf-set-selections /root/preseed"
+
+		# Removing local preseed file
+		rm -f chroot/root/preseed
+	done
+
+	# Remove dependency
+	Remove_package
+
+	# Creating stage file
+	Create_stagefile .stage/chroot_preseed
+fi
diff --git a/scripts/build/lb_config b/scripts/build/lb_config
index f015fe86e..acf854973 100755
--- a/scripts/build/lb_config
+++ b/scripts/build/lb_config
@@ -198,7 +198,7 @@ Local_arguments ()
 				Print_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
 
 				# Dump contents of directories that contain text files
-				for DIRECTORY in config/package-lists config/task-lists config/chroot_apt config/chroot_local-patches config/chroot_local-preseed config/binary_rootfs
+				for DIRECTORY in config/package-lists config/task-lists config/chroot_apt config/chroot_local-patches config/preseed config/binary_rootfs
 				do
 					if Find_files "${DIRECTORY}"
 					then
@@ -1172,7 +1172,7 @@ mkdir -p config/chroot_local-patches
 mkdir -p config/packages
 mkdir -p config/packages.chroot
 mkdir -p config/package-lists
-mkdir -p config/chroot_local-preseed
+mkdir -p config/preseed
 mkdir -p config/task-lists
 
 cat > config/chroot << EOF
@@ -1422,7 +1422,7 @@ then
 	then
 		Echo_warning "Please install 'debconf-utils' in order to use this feature."
 	else
-		debconf-get-selections | grep -v deinstall | cut -f1 > config/chroot_local-preseed/local-system
+		debconf-get-selections | grep -v deinstall | cut -f1 > config/preseed/local.preseed.chroot
 	fi
 fi
 
-- 
cgit v1.2.3