[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [RFC] Support for using multiple CDs during installation



On Thursday 25 October 2007, Joey Hess wrote:
> Frans Pop wrote:
> > What's the reason we made apt-install non-interactive? Was it just that
> > we did not have the passthrough frontend at the time? If so, I guess we
> > should probably just make apt-install interactive in all cases.
>
> Both that we lacked working passthrough, and that none of these packages
> have any business in asking questions at install time.

OK. Adapted apt-install to always use passthrough.

> We should keep it consistent, and file bugs on any packages that ask
> questions, even more aggressively than we file bugs on unncessary
> questions from task packages.

Only one question shows up: console-data "Policy for handling keymaps".
Luckily we know who we can blame for^W^Wask to fix that.

> > +	in-target sh -c "$config debconf-apt-progress --logstderr -- apt-get
> > -o APT::Install-Recommends=false -y --no-remove install $packages" ||
> > ERRCODE=$?
>
> This resets the progress bar to 0, advances it to 100, and then STOPs
> it, which is not desirable if there is already a progress bar.. See my
> other mail about that.

Yep. To be honest I was surprised that it worked at all. I expected that 
part to be a lot harder.
In my tests yesterday it wasn't really obvious, but when used during 
base-installation it really hurts. But the updated debconf-apt-progress 
works beautifully.

Attached an updated patch for di-utils.

commit c00bc1a0cea6dbd417de0f52cfa5f04d991122ca
Author: Frans Pop <fjp@debian.org>
Date:   Thu Oct 25 19:24:57 2007 +0200

    apt-install: support CD/DVD changing
    
    This is done by using debconf-apt-progress if multiple CDs are defined in
    sources.list.
    
    With this change apt-install uses the pass-through instead of the
    noninteractive frontend. This is needed so that CD changing requests can
    be displayed to the user. It also means that debconf questions that until
    now would have been ignored (defaulted) will now be displayed.

diff --git a/packages/debian-installer-utils/apt-install b/packages/debian-installer-utils/apt-install
index 16be3ea..a2baf4d 100755
--- a/packages/debian-installer-utils/apt-install
+++ b/packages/debian-installer-utils/apt-install
@@ -2,15 +2,17 @@
 set -e
 . /lib/chroot-setup.sh
 
+packages=$@
+
 queue=/var/lib/apt-install/queue
 
 # If we don't have a working mirror yet, only queue the package;
-# it will be installed later by the postinst in base-installer.
+# it will be installed later by the postinst in base-installer
 if [ ! -f /target/etc/apt/sources.list ]; then
 	# Add to list of extra packages to be installed into /target/.
 	mkdir -p /var/lib/apt-install
 	touch $queue
-	for pkg in $@ ; do
+	for pkg in $packages; do
 		if ! grep -q "^$pkg$" $queue; then
 			logger -t apt-install "Queueing package $pkg for later installation"
 			echo "$pkg" >> $queue
@@ -20,20 +22,19 @@ if [ ! -f /target/etc/apt/sources.list ]; then
 	exit 1 # Return error as the package is not ready to be used yet.
 fi
 
-if ! chroot_setup; then
-	logger -t apt-install "Unexpected error; skipped processing of: $@"
-	exit 1
+MULTICD=""
+if [ $(grep "^deb cdrom:" /target/etc/apt/sources.list | wc -l) -gt 1 ]; then
+	MULTICD=1
+	log-output -t apt-install umount /cdrom || true
 fi
 
-# Disable debconf questions.
-DEBIAN_FRONTEND=noninteractive
-export DEBIAN_FRONTEND
-
 ERRCODE=0
-log-output -t apt-install chroot /target \
-	apt-get -o APT::Install-Recommends=false -y --no-remove install $@ \
-		< /dev/null || ERRCODE=$?
-chroot_cleanup
+config=$(chroot /target debconf-apt-progress --config | sed "s/$/;/")
+in-target sh -c "$config debconf-apt-progress --logstderr --no-progress -- apt-get -o APT::Install-Recommends=false -y --no-remove install $packages" || ERRCODE=$?
+
+if [ "$MULTICD" ]; then
+	load-install-cd "/target" || true
+fi
 
 if [ "$ERRCODE" != 0 ]; then
 	exit 1
diff --git a/packages/debian-installer-utils/debian/changelog b/packages/debian-installer-utils/debian/changelog
index d5e49aa..b53582c 100644
--- a/packages/debian-installer-utils/debian/changelog
+++ b/packages/debian-installer-utils/debian/changelog
@@ -2,8 +2,11 @@ debian-installer-utils (1.50) UNRELEASED; urgency=low
 
   * register-module: remove support for obsolete modutils and for no longer
     used type chandev.
+  * apt-install: support CD/DVD changing by using debconf-apt-progress if
+    multiple CDs are defined in sources.list. This change also makes
+    apt-install use the passthrough instead of the noninteractive frontend.
 
- -- Frans Pop <fjp@debian.org>  Sun, 23 Sep 2007 16:38:50 +0200
+ -- Frans Pop <fjp@debian.org>  Fri, 26 Oct 2007 11:03:40 +0200
 
 debian-installer-utils (1.49) unstable; urgency=low
 

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: