[SCM] live-initramfs branch, debian-next, updated. debian/1.236.1-1-18-g0bd5a87

Daniel Baumann daniel at debian.org
Sun May 16 14:25:09 UTC 2010


The following commit has been merged in the debian-next branch:
commit 0bd5a8733d3fcefe6f41886c6fb5411f0613d8c3
Author: Daniel Baumann <daniel at debian.org>
Date:   Sun May 16 16:03:12 2010 +0200

    Reverting debconf stuff in initramfs, making much more problems than it's actually worth.

diff --git a/Makefile b/Makefile
index a03d75f..73bf2ba 100644
--- a/Makefile
+++ b/Makefile
@@ -32,7 +32,7 @@ install: test build
 	cp bin/live-getty bin/live-login bin/live-new-uuid bin/live-snapshot bin/live-swapfile $(DESTDIR)/sbin
 
 	mkdir -p $(DESTDIR)/usr/share/live-initramfs
-	cp bin/live-preseed bin/live-reconfigure bin/live-set-selections contrib/languagelist $(DESTDIR)/usr/share/live-initramfs
+	cp bin/live-preseed bin/live-reconfigure contrib/languagelist $(DESTDIR)/usr/share/live-initramfs
 
 	mkdir -p $(DESTDIR)/usr/share/initramfs-tools
 	cp -r hooks scripts $(DESTDIR)/usr/share/initramfs-tools
diff --git a/bin/live-preseed b/bin/live-preseed
index add29bd..d98c4f3 100755
--- a/bin/live-preseed
+++ b/bin/live-preseed
@@ -4,29 +4,22 @@ set -e
 
 PATH=/usr/sbin:/usr/bin:/sbin:/bin
 
-# Only do this once
-if [ -z "${DEBCONF_REDIR}" ]
-then
-	exec <&4
-	export DEBIAN_HAS_FRONTEND=1
-	export DEBCONF_REDIR=1
-fi
-
 root="${1}"
-. "$root/usr/share/debconf/confmodule"
-
 question="${2}"
 value="${3}"
 seen="${4}"
 
 [ "${seen}" ] || seen=true
 
-if ! db_set "${question}" "${value}"
+if ! (echo "SET ${question} ${value}"; echo "FSET ${question} seen ${seen}") | chroot "${1}" /usr/bin/debconf-communicate -fnoninteractive live-initramfs >/dev/null
 then
-	db_register debian-installer/dummy "${question}"
-	db_set "${question}" "${value}"
-fi
 
-db_fset "${question}" seen "${seen}"
+chroot "${1}" /usr/bin/debconf-communicate -fnoninteractive live-initramfs >/dev/null << EOF
+REGISTER debian-installer/dummy ${question}
+SET ${question} ${value}
+FSET ${question} seen ${seen}
+EOF
+
+fi
 
 exit 0
diff --git a/bin/live-set-selections b/bin/live-set-selections
deleted file mode 100755
index c4c38dd..0000000
--- a/bin/live-set-selections
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/bin/sh
-# Cloned-and-hacked from preseed/debconf-set-selections for live-initramfs.
-set -e
-
-OLDIFS="$IFS"
-CR=$(echo -en "\r")
-NL="
-"
-
-. /scripts/live-functions
-load_confmodule
-
-# Returns the first field in the current line
-first_field() {
-	echo "$line" | grep -q "[[:space:]]" || return 1
-	echo "$line" | sed -r 's/^([^[:space:]]*).*/\1/'
-}
-
-# Returns any fields after the first field in the current line
-rest_line() {
-	if echo "$line" | grep -q "[[:space:]]"; then
-		echo "$line" | sed 's/^[^[:space:]]*[[:space:]]*//'
-	fi
-}
-
-SEEN=1
-if [ "$1" = --unseen ]; then
-	SEEN=
-	shift
-fi
-
-file="$1"
-
-parse_error() {
-	echo "Error parsing preconfiguration file: $*" >&2
-	exit 1
-}
-
-IFS="$NL"
-multiline=""
-# TODO: this squashes \r elsewhere in the line too
-for line in $(grep -v '^#\|^[[:space:]]*$' "$file" | sed "s/$CR//g"); do
-	IFS="$OLDIFS"
-
-	line="$(echo "$line" | sed 's/^[[:space:]]*//')"
-	if echo "$line" | grep -q '\\$'; then
-		multiline="${multiline:+$multiline }$(echo "$line" | \
-			sed 's/[[:space:]]*\\$//')"
-		continue
-	elif [ -n "$multiline" ]; then
-		line="$multiline $line"
-		multiline=""
-	fi
-
-	package=""
-	var=""
-	type=""
-	val=""
-	if ! package="$(first_field)"; then
-		parse_error "Syntax error: unable to determine template owner"
-	fi
-	line="$(rest_line)"
-	if ! var="$(first_field)"; then
-		parse_error "Syntax error: unable to determine template name"
-	fi
-	line="$(rest_line)"
-	if ! type="$(first_field)"; then
-		# Allow for lines without separator before an empty value
-		if [ "$line" ]; then
-			type="$line"
-		else
-			parse_error "Syntax error: unable to determine template type"
-		fi
-	fi
-	line="$(rest_line)"
-	val="$line"
-
-	if [ "$type" = seen ]; then
-		# Set seen flag.
-		db_fset "$var" "$type" "$val" || true # how to handle this error?
-	else
-		if ! db_set "$var" "$val"; then
-			# Question does not exist yet.
-			db_register debian-installer/dummy "$var"
-			db_set "$var" "$val"
-			db_subst "$var" ID "$var"
-		fi
-		if [ "$SEEN" ]; then
-			db_fset "$var" seen true
-		fi
-	fi
-done
diff --git a/debian/copyright b/debian/copyright
index 3babe1c..539feb2 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -27,23 +27,3 @@ License: GPL-3+
  .
  On Debian systems, the complete text of the GNU General Public License
  can be found in /usr/share/common-licenses/GPL-3 file.
-
-Files: bin/live-set-selections
-Copyright: Joey Hess <joeyh at debian.org>
-License: GPL-2+
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
- .
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- .
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- .
- On Debian systems, the complete text of the GNU General Public License
- can be found in /usr/share/common-licenses/GPL-2 file.
diff --git a/hooks/live b/hooks/live
index afa198d..11dfc76 100755
--- a/hooks/live
+++ b/hooks/live
@@ -44,7 +44,6 @@ mkdir -p "${DESTDIR}"/lib/live-initramfs
 # Executables
 copy_exec /usr/share/live-initramfs/live-reconfigure /bin
 copy_exec /usr/share/live-initramfs/live-preseed /bin
-copy_exec /usr/share/live-initramfs/live-set-selections /bin
 
 # Scripts
 cp /usr/share/initramfs-tools/scripts/live-functions "${DESTDIR}"/scripts
diff --git a/scripts/live b/scripts/live
index 1f46d42..46d0a9e 100755
--- a/scripts/live
+++ b/scripts/live
@@ -43,35 +43,6 @@ 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=""
@@ -460,8 +431,19 @@ Arguments ()
 			url=*)
 				URL_LOCATION="${ARGUMENT#url=}"
 
-				start_network
+				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
 				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}"
 				;;
 
@@ -1907,36 +1889,6 @@ mountroot ()
 		mount -n -o bind /dev "${rootmnt}/dev"
 	fi
 
-	# Open up two fifo's fd's for debconf-communicate to use. Speeds up
-	# the live-initramfs process considerably.
-	log_begin_msg "Creating debconf-communicate fifo mechanism"
-	mkfifo /tmp/debconf-in.fifo
-	mkfifo /tmp/debconf-out.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_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
-		log_warning_msg "failed to setup debconf-communicate channel"
-	fi
-	log_end_msg
-
-	# Order matters!
-	# These file descriptors must stay open until we're finished with
-	# debconf-communicate.
-	exec 4</tmp/debconf-out.fifo 3>/tmp/debconf-in.fifo
-
 	maybe_break live-bottom
 	log_begin_msg "Running /scripts/live-bottom\n"
 
@@ -1948,20 +1900,6 @@ mountroot ()
 		umount "${rootmnt}/dev"
 	fi
 
-	# Close the fd's associated with debconf-communicate
-	exec 3>&- 4<&-
-	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/22sslcert b/scripts/live-bottom/22sslcert
index d54dc29..1950eef 100755
--- a/scripts/live-bottom/22sslcert
+++ b/scripts/live-bottom/22sslcert
@@ -21,7 +21,6 @@ esac
 # live-initramfs header
 
 . /scripts/live-functions
-load_confmodule
 
 log_begin_msg "Regenerating SSL certificate..."
 
diff --git a/scripts/live-bottom/24preseed b/scripts/live-bottom/24preseed
index 1f5c513..344a579 100755
--- a/scripts/live-bottom/24preseed
+++ b/scripts/live-bottom/24preseed
@@ -26,7 +26,6 @@ then
 fi
 
 . /scripts/live-functions
-load_confmodule
 
 log_begin_msg "Loading preseed file"
 
@@ -34,14 +33,14 @@ log_begin_msg "Loading preseed file"
 
 if [ -e /preseed.cfg ]
 then
-	live-set-selections /preseed.cfg
+	chroot /root debconf-set-selections < /preseed.cfg
 fi
 
 if [ -n "${LOCATIONS}" ]
 then
 	for item in ${LOCATIONS}
 	do
-		live-set-selections "/root$item"
+		chroot /root debconf-set-selections < "/root${item}"
 	done
 fi
 
@@ -56,20 +55,14 @@ then
 	done
 fi
 
-if db_get preseed/early_command && [ "$RET" ]
+reply="$(echo "GET preseed/early_command" | chroot /root debconf-communicate -fnoninteractive live-initramfs)"
+
+if [ "${reply#0 }" != "${reply}" ]
 then
-	EARLY="$RET"
-	if db_get preseed/allow-network && [ "$RET" = true ]; then
-		start_network
-	fi
-
-	DEBIAN_HAS_FRONTEND= DEBCONF_REDIR= \
-	DEBIAN_FRONTEND=noninteractive \
-	sh -c "$EARLY"
+	reply="${reply#0 }"
+	sh -c "${reply}"
 fi
 
-stop_network
-
 # Clear out debconf database backup files to save memory.
 rm -f /root/var/cache/debconf/*.dat-old
 
diff --git a/scripts/live-functions b/scripts/live-functions
index 9e138ec..cced728 100644
--- a/scripts/live-functions
+++ b/scripts/live-functions
@@ -115,16 +115,3 @@ panic() {
 	. /scripts/functions
 	panic "$@"
 }
-
-load_confmodule ()
-{
-	# Only do this once
-	if [ -z "$DEBCONF_REDIR" ]
-	then
-		exec <&4
-		export DEBIAN_HAS_FRONTEND=1
-		export DEBCONF_REDIR=1
-	fi
-
-	. /root/usr/share/debconf/confmodule
-}

-- 
live-initramfs



More information about the debian-live-changes mailing list