[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, Frans Pop wrote:
> On Thursday 25 October 2007, Frans Pop wrote:
> > The prompt for CD changing works during pkgsel, but apparently not for
> > a normal apt-install. During initial tests, installation of grub failed
> > because CD2 was still mounted and I never got the prompt to change CDs.
> > This is worked around by making sure CD1 is installed again, but if any
> > packages from other CDs are needed for whatever reason _after_ pkgsel,
> > the installation will hang for the same reason.
> > I've not really looked yet at why this does not work.
>
> It looks like this could be fixed by (conditionally) making apt-setup use
> debconf-apt-progress.
>
> > - if a CD change is needed to install a package _after_ pkgsel, this
> > will fail because the CD is mounted in the D-I environment (the CD
> > drive is locked)
>
> With the above implemented, this could be worked around by making
> apt-setup umount the CD in the D-I environment and making it reload the
> installation CD again before exiting (just like pkgsel now does).

The attached patch does both and works :-)
Tested by having grub-installer apt-install both grub and anacron (the 
latter is on CD2).

The patch does introduce an inconsistency that will need to be resolved:
with multiple CDs in sources.list package installation will be interactive 
(including any configuration questions) while in other cases the 
installation will be non-interactive.

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.

Cheers,
FJP

commit ceeecdd23cd5b8423873407bee18231e5bd5b7ed
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.
    
    The change introduces an inconsistency where apt-install is interactive in
    this case and non-interactive in other cases; this is to be solved!

diff --git a/packages/debian-installer-utils/apt-install b/packages/debian-installer-utils/apt-install
index 16be3ea..e0c78d2 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,29 @@ 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
-fi
+ERRCODE=0
+if [ $(grep "^deb cdrom:" /target/etc/apt/sources.list | wc -l) -gt 1 ]; then
+	log-output -t apt-install umount /cdrom || true
 
-# Disable debconf questions.
-DEBIAN_FRONTEND=noninteractive
-export DEBIAN_FRONTEND
+	config=$(chroot /target debconf-apt-progress --config | sed "s/$/;/")
+	in-target sh -c "$config debconf-apt-progress --logstderr -- apt-get -o APT::Install-Recommends=false -y --no-remove install $packages" || ERRCODE=$?
+	
+	load-install-cd /target
+else
+	if ! chroot_setup; then
+		logger -t apt-install "Unexpected error; skipped processing of: $packages"
+		exit 1
+	fi
 
-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
+	# Disable debconf questions
+	DEBIAN_FRONTEND=noninteractive
+	export DEBIAN_FRONTEND
+	log-output -t apt-install chroot /target \
+		apt-get -o APT::Install-Recommends=false -y --no-remove install $packages \
+			< /dev/null || ERRCODE=$?
+
+	chroot_cleanup
+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..212754b 100644
--- a/packages/debian-installer-utils/debian/changelog
+++ b/packages/debian-installer-utils/debian/changelog
@@ -2,8 +2,12 @@ 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 introduces an inconsistency
+    where apt-install is interactive in this case and non-interactive in other
+    cases; this is to be solved!
 
- -- Frans Pop <fjp@debian.org>  Sun, 23 Sep 2007 16:38:50 +0200
+ -- Frans Pop <fjp@debian.org>  Thu, 25 Oct 2007 19:20:22 +0200
 
 debian-installer-utils (1.49) unstable; urgency=low
 

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


Reply to: