[SCM] live-initramfs branch, debian-next, updated. debian/1.215.1-1-21-g5999a3e

Daniel Baumann daniel at debian.org
Tue May 11 16:45:14 UTC 2010


The following commit has been merged in the debian-next branch:
commit 841886e668b15f2984c5a6e63e5fbc4d0599ff45
Author: Daniel Baumann <daniel at debian.org>
Date:   Sat May 1 14:28:54 2010 +0200

    Merging casper 1.233.

diff --git a/docs/ChangeLog.casper b/docs/ChangeLog.casper
index f6c4ae1..3b28500 100644
--- a/docs/ChangeLog.casper
+++ b/docs/ChangeLog.casper
@@ -1,3 +1,19 @@
+casper (1.233) lucid; urgency=low
+
+  * Bring the network up while running preseed/early_command.
+  * Fix use of debconf passthrough frontend; DEBCONF_READFD and
+    DEBCONF_WRITEFD were backwards, and DEBIAN_HAS_FRONTEND and
+    DEBCONF_REDIR needed to be unset or else confmodule scripts would end up
+    trying to talk to closed file descriptors.
+  * Run debconf-communicate with a read-only template database and separate
+    config databases, and copy any changed values back to the master
+    databases at the end.  This allows us to use the noninteractive frontend
+    rather than passthrough when running apt-get in preseed/early_command or
+    dpkg to install driver updates, thereby ensuring that the template
+    database is properly initialised (LP: #557011).
+
+ -- Colin Watson <cjwatson at ubuntu.com>  Mon, 12 Apr 2010 23:41:09 +0100
+
 casper (1.232) lucid; urgency=low
 
   * bump compcache size to 50% on live images for machines with less than
diff --git a/scripts/live b/scripts/live
index 7acf0d9..ec3a639 100755
--- a/scripts/live
+++ b/scripts/live
@@ -43,6 +43,35 @@ then
 	touch /live.vars
 fi
 
+network_started=
+
+start_network ()
+{
+	[ -z "$network_started" ] || return
+	[ -z "$NETBOOT" ] || return
+
+	mount -n -o bind /sys /root/sys
+	mount -n -o bind /proc /root/proc
+	mount -n -o bind /dev /root/dev
+	mkdir -p /root/var/run/network
+
+	# Close inherited fd's to prevent debconf-communicate from
+	# continuing to run post-live-initramfs.
+	chroot /root dhclient eth0 3>&- 4<&-
+
+	network_started=1
+}
+
+stop_network ()
+{
+	[ "$network_started" ] || return
+
+	chroot /root ifconfig eth0 down
+	umount /root/sys
+	umount /root/proc
+	umount /root/dev
+}
+
 Arguments ()
 {
 	PRESEEDS=""
@@ -431,19 +460,8 @@ Arguments ()
 			url=*)
 				URL_LOCATION="${ARGUMENT#url=}"
 
-				mount -o bind /sys /root/sys
-				mount -o bind /proc /root/proc
-				mount -o bind /dev /root/dev
-
-				mkdir -p /root/var/run/network
-				[ "${NETBOOT}" ] || chroot /root dhclient eth0
+				start_network
 				chroot /root wget -P /tmp "${URL_LOCATION}"
-				[ "${NETBOOT}" ] || chroot /root ifconfig eth0 down
-
-				umount /root/sys
-				umount /root/proc
-				umount /root/dev
-
 				LOCATIONS="/tmp/$(basename ${URL_LOCATION}) ${LOCATIONS}"
 				;;
 
@@ -1895,10 +1913,18 @@ mountroot ()
 	mkfifo /tmp/debconf-in.fifo
 	mkfifo /tmp/debconf-out.fifo
 
-	chroot /root debconf-communicate -fnoninteractive live-initramfs > /tmp/debconf-out.fifo < /tmp/debconf-in.fifo &
+	# Make the template database read-only, so that passthrough debconf
+	# instances can write to it directly; otherwise templates are only
+	# passed through when necessary.  Use temporary config databases as
+	# well; we'll copy their contents back at the end.
+	DEBCONF_TMPDIR="$(chroot /root mktemp -dt debconf.XXXXXX)"
+	cp -a /root/var/cache/debconf/config.dat "/root$DEBCONF_TMPDIR/"
+	cp -a /root/var/cache/debconf/passwords.dat "/root$DEBCONF_TMPDIR/"
+	sed "s,^Filename: /var/cache/debconf/\(config\|passwords\).dat$,Filename: $DEBCONF_TMPDIR/\1.dat,; /^Name: templatedb/a\
++Readonly: true" /root/etc/debconf.conf >"/root$DEBCONF_TMPDIR/debconf.conf"
 
 	# Save the PID so it can be killed later.
-	DEBCONF_COMMUNICATE_PID="$!"
+	DEBCONF_SYSTEMRC="$DEBCONF_TMPDIR/debconf.conf" chroot /root debconf-communicate -fnoninteractive live-initramfs > /tmp/debconf-out.fifo < /tmp/debconf-in.fifo &
 
 	if [ ! -p /tmp/debconf-in.fifo ] || [ ! -p /tmp/debconf-out.fifo ]
 	then
@@ -1927,6 +1953,15 @@ mountroot ()
 	rm -f /tmp/debconf-in.fifo
 	rm -f /tmp/debconf-out.fifo
 
+	# Copy config database changes back to the master files.
+	chroot /root debconf-copydb tmpdb config \
+		--config=Name:tmpdb --config=Driver:File \
+		--config="Filename:$DEBCONF_TMPDIR/config.dat"
+	chroot /root debconf-copydb tmpdb passwords \
+		--config=Name:tmpdb --config=Driver:File \
+		--config="Filename:$DEBCONF_TMPDIR/passwords.dat"
+	rm -rf "$DEBCONF_TMPDIR"
+
 	exec 1>&6 6>&-
 	exec 2>&7 7>&-
 	kill ${tailpid}
diff --git a/scripts/live-bottom/24preseed b/scripts/live-bottom/24preseed
index 60b9be6..fb980bd 100755
--- a/scripts/live-bottom/24preseed
+++ b/scripts/live-bottom/24preseed
@@ -58,16 +58,14 @@ fi
 
 if db_get preseed/early_command && [ "$RET" ]
 then
-	echo 'APT::Keep-Fds { "3"; "4"; };' > /root/etc/apt/apt.conf.d/00-early-debconf
-	DEBIAN_FRONTEND=passthrough \
-	DEBCONF_READFD=3 \
-	DEBCONF_WRITEFD=4 \
-	DEBCONF_DB_REPLACE=configdb \
-	DEBCONF_DB_OVERRIDE='Pipe{infd:none outfd:none}' \
+	start_network
+	DEBIAN_HAS_FRONTEND= DEBCONF_REDIR= \
+	DEBIAN_FRONTEND=noninteractive \
 	sh -c "$RET"
-	rm -f /root/etc/apt/apt.conf.d/00-early-debconf
 fi
 
+stop_network
+
 # Clear out debconf database backup files to save memory.
 rm -f /root/var/cache/debconf/*.dat-old
 

-- 
live-initramfs



More information about the debian-live-changes mailing list