Merging casper 1.233.
authorDaniel Baumann <daniel@debian.org>
Sat, 1 May 2010 12:28:54 +0000 (14:28 +0200)
committerDaniel Baumann <daniel@debian.org>
Wed, 9 Mar 2011 16:48:09 +0000 (17:48 +0100)
docs/ChangeLog.casper
scripts/live
scripts/live-bottom/24preseed

index f6c4ae1..3b28500 100644 (file)
@@ -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@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
index 7acf0d9..ec3a639 100755 (executable)
@@ -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}
index 60b9be6..fb980bd 100755 (executable)
@@ -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