Index: build/config/common
===================================================================
--- build/config/common	(revision 46995)
+++ build/config/common	(working copy)
@@ -22,10 +22,6 @@
 # It will be loaded by the initrd-preseed udeb.
 PRESEED = 
 
-# Right now we want all d-i development and daily builds to use udebs from
-# unstable, so load the unstable.cfg. This is disabled for official builds.
-PRESEED_SUITE ?= unstable.cfg
-
 # The library reducer to use. Can be mklibs.sh or mklibs.py.
 MKLIBS = mklibs 
 
@@ -34,22 +30,26 @@
 # this. You can use copy:/ to use a local mirror
 #MIRROR = http://www.us.debian.org/debian
 
-# Define here if debian-installer should be built with modules from
-# stable, testing or unstable.
-SUITE ?= unstable
-
-# Archive components from which to fetch debian-installer modules.
-UDEB_COMPONENTS ?= main/debian-installer
-
 # Options to pass to dpkg when it is unpacking the udebs to create the
 # image. None should be needed, but --force-overwrite might need to be
 # enabled from time to time if udebs have conflicting files.
 DPKG_UNPACK_OPTIONS = --force-overwrite
 
+# The codename for the version of Debian that should be installed by default.
+DEBIAN_RELEASE = lenny
+
 # The version of Debian targeted by the installation images.
 #DEBIAN_VERSION = 4.0
 DEBIAN_VERSION = lenny
 
+# Define here from what release (codename!) components (udebs) should be taken
+# to build debian-installer. By default this is set to 'unstable' for building
+# daily images. For official builds this is overruled in debian/rules.
+USE_UDEBS_FROM ?= unstable
+
+# Archive components from which to fetch debian-installer modules.
+UDEB_COMPONENTS ?= main/debian-installer
+
 # The date the installer is built.
 BUILD_DATE ?= $(shell date -u '+%Y%m%d-%H:%M')
 
Index: build/config/i386/floppy/boot.cfg
===================================================================
--- build/config/i386/floppy/boot.cfg	(revision 46995)
+++ build/config/i386/floppy/boot.cfg	(working copy)
@@ -9,11 +9,12 @@
 # Use type -ng to not interfere with sparc and powerpc floppies
 TYPE=bootfloppy-ng
 
+# Release info not needed on boot floppy
+OMIT_RELEASE_INFO=1
 # No gpg fits on a boot floppy.
 KEYRING=
 # No debconf either, so no preseeding.
 PRESEED=
-PRESEED_SUITE=
 EXTRAUDEBS=
 
 # Save some much needed space by compressing busybox. This is kind of a
Index: build/unstable.cfg
===================================================================
--- build/unstable.cfg	(revision 46995)
+++ build/unstable.cfg	(working copy)
@@ -1,4 +0,0 @@
-# Preseed file to make d-i download udebs from unstable, useful for daily
-# builds and development builds.
-d-i mirror/udeb/suite string unstable
-d-i mirror/udeb/suite seen false
Index: build/Makefile
===================================================================
--- build/Makefile	(revision 46995)
+++ build/Makefile	(working copy)
@@ -383,14 +383,6 @@
 	# Copy in preseed file.
 	cp -a $(PRESEED) $(TREE)/preseed.cfg
 endif
-ifdef PRESEED_SUITE
-	# Add suite preseed file.
-	if [ -e "$(TREE)/preseed.cfg" ]; then \
-		cat $(PRESEED_SUITE) >> $(TREE)/preseed.cfg; \
-	else \
-		cp -a $(PRESEED_SUITE) $(TREE)/preseed.cfg; \
-	fi
-endif
 
 ifneq (,$(wildcard $(KEYRING)))
 	mkdir -p $(TREE)/usr/share/keyrings
@@ -411,6 +403,13 @@
 
 
 $(STAMPS)tree-$(targetstring)-stamp: $(STAMPS)tree-unpack-$(targetstring)-stamp
+ifndef OMIT_RELEASE_INFO
+	# Add release info
+	mkdir -p $(TREE)/.installer
+	echo $(DEBIAN_RELEASE) >$(TREE)/.installer/default_release
+	echo $(USE_UDEBS_FROM) >$(TREE)/.installer/udebs_source
+endif
+
 	# Create a dev tree.
 	mkdir -p $(TREE)/dev
 	# Always needed, in case devfs is not mounted on boot.
@@ -420,6 +419,7 @@
 	mkdir -p $(EXTRAUDEBSDIR)
 	mkdir -p $(EXTRAUDEBSDPKGDIR)/info $(EXTRAUDEBSDPKGDIR)/updates
 	touch $(EXTRAUDEBSDPKGDIR)/status $(EXTRAUDEBSDPKGDIR)/available
+
 ifdef EXTRADRIVERS
 	# Unpack the udebs of additional driver disks, so mklibs runs on them too.
 	dpkg $(DPKG_UNPACK_OPTIONS) --log=/dev/null --root=$(EXTRAUDEBSDIR) --unpack \
@@ -531,14 +531,14 @@
 	echo "# This file is automatically generated, edit $@.local instead."; \
 	echo "deb copy:$(shell pwd)/ $(LOCALUDEBDIR)/"; \
 	if [ "$(MIRROR)x" != "x" ]; then \
-		echo "deb $(MIRROR) $(SUITE) $(UDEB_COMPONENTS)"; \
+		echo "deb $(MIRROR) $(USE_UDEBS_FROM) $(UDEB_COMPONENTS)"; \
 	else \
 		grep '^deb[ \t]' $(SYSTEM_SOURCES_LIST) \
 		|grep -v '^deb[ \t]cdrom:' \
 		|grep -v '\(security.debian.org\|volatile.debian.\(net\|org\)\)' \
 		|grep '[ \t]main' \
 		|awk '{print $$1 " " $$2}' \
-		|sed "s,/* *$$, $(SUITE) $(UDEB_COMPONENTS)," \
+		|sed "s,/* *$$, $(USE_UDEBS_FROM) $(UDEB_COMPONENTS)," \
 		|sed "s,^deb file,deb copy," \
 		|perl -ne 'print unless $$seen{$$_}; $$seen{$$_}=1' ; \
 	fi) > $@
Index: build/README
===================================================================
--- build/README	(revision 46995)
+++ build/README	(working copy)
@@ -326,9 +326,22 @@
   The type of media produced, currently used to make qemu boot the image
   properly. Suggested values: "CD-ROM", "netboot image", "floppy", etc.
 
+DEBIAN_RELEASE
+  The codename of the debian release to be installed by default.
+  Included in .installer/default_release in most initrds.
+
 DEBIAN_VERSION
-  The debian version descriptive name.
+  The version number of the Debian release.
 
+USE_UDEBS_FROM
+  Normally the codename of the release to use for the build. Defaults to
+  unstable for daily builds.
+  Included in .installer/udebs_source in most initrds.
+
+OMIT_RELEASE_INFO
+  Can be used to suppress the inclusion of the .installer directory in some
+  targets.
+
 DOS_VOLUME_ID
 DOS_VOLUME_LABEL
   Volume ID and label for DOS filesystems.
@@ -383,7 +396,6 @@
   Mostly useful for floppies.
 
 UDEB_LISTS
-
   List of files listing udebs that were used to build the image.
 
 
@@ -405,9 +417,6 @@
   The mirror to get .deb and .udeb packages from. Defaults to the same
   as the host machine uses.
 
-SUITE
-  The suite to use for the build. Defaults to unstable.
-
 UDEB_COMPONENTS
   Archive components from which to fetch .udeb packages. Defaults to
   main/debian-installer.
@@ -415,10 +424,6 @@
 PRESEED
   An initrd preseed file to put in the initrd.
 
-PRESEED_SUITE
-  An initrd preseed file to append to any other preseed file put in the
-  initrd by PRESEED; used to preseed the suite for daily builds.
-
 Rules invoked from the various targets:
 
 arch_boot:
Index: debian/changelog
===================================================================
--- debian/changelog	(revision 46995)
+++ debian/changelog	(working copy)
@@ -43,8 +43,15 @@
   [ Martin Michlmayr ]
   * Switch arm, mips and mipsel to 2.6.21-1.
 
- -- dann frazier <dannf@debian.org>  Thu, 03 May 2007 15:49:39 -0600
+  [ Frans Pop ]
+  * Include the default release for the target system and the release from
+    which to retrieve udebs in images. The first makes it unnecessary to
+    hardcode the default release in choose-mirror and the last ensures
+    consistency between udebs included in the initrd and udebs retrieved
+    during the installation.
 
+ -- Frans Pop <fjp@debian.org>  Sat, 26 May 2007 17:22:14 +0200
+
 debian-installer (20070308) unstable; urgency=low
 
   [ Thiemo Seufer ]
Index: debian/rules
===================================================================
--- debian/rules	(revision 46995)
+++ debian/rules	(working copy)
@@ -4,11 +4,10 @@
 VERSION=$(shell LC_ALL=C dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)
 DATE=$(shell echo $(VERSION) | cut -d '.' -f 1)
 SUITE=$(shell LC_ALL=C dpkg-parsechangelog | grep ^Distribution: | cut -d ' ' -f 2)
-ifeq (${SUITE},unstable)
-SUITE=lenny
-endif
 ifeq (${SUITE},UNRELEASED)
-SUITE=unstable
+USE_UDEBS_FROM=unstable
+else
+USE_UDEBS_FROM=lenny
 endif
 
 ARCHIVEDIR=debian/tmp/installer-$(ARCH)
@@ -26,7 +25,7 @@
 # Must run as root, so is not run as part of regular build.
 build-images:
 	$(MAKE) -C build all_build stats release \
-		SUITE=$(SUITE) BUILD_DATE=$(DATE) PRESEED_SUITE=
+		USE_UDEBS_FROM=$(USE_UDEBS_FROM) BUILD_DATE=$(DATE)
 	
 build: build-stamp
 build-stamp:
