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

Bug#270969: [patch] Improved progress bar information



Package: base-installer
Version: 1.05
Severity: wishlist

The attached patch improves the information provided by d-i during 
base-installation:
- During both kernel installation and installation of extra packages,
  the package being installed is shown and the progress bar is advanced
  after each package.
- For the kernel the advancement of the progress bar is rough; for extra
  packages it is based on the number of packages to be installed.
- Increased the relative duration for installation of kernel and
  extra packages based on timings from a i386 netboot installation.


I have considered the following alternatives for the template changes.

ALTERNATIVE 1
  Installing extra packages...
  .
  Getting and installing ${SUBST0}
ALTERNATIVE 2
  Installing extra packages...\n
  Getting and installing ${SUBST0}
ALTERNATIVE 3
  Installing extra packages - getting and installing ${SUBST0}...

I'm not sure if alternative 2 is valid.
In the end I chose alternative 3 because that keeps everything on one line so 
the progress bar will 'jump around' less as extra lines are added/deleted.
(Alternative 1 would have meant slightly less work for translators.)
The proposed description for 'install_kernel_package_long' is too long for one 
line, so may need rethinking (or could be dropped altogether using 
'install_kernel_package' instead).


I have tested the formula used to advance the progress bar during an actual 
installation (and it works beautifully).
I have _not_ tested the new templates.
diff -u ./base-installer.templates new/base-installer.templates
--- ./base-installer.templates	2004-08-23 18:04:45.000000000 +0200
+++ new/base-installer.templates	2004-09-10 11:21:36.000000000 +0200
@@ -223,6 +223,10 @@
 Type: text
 _Description: Installing extra packages...
 
+Template: base-installer/section/install_extra_package
+Type: text
+_Description: Installing extra packages - getting and installing ${SUBST0}...
+
 Template: base-installer/section/create_devices
 Type: text
 _Description: Creating device files...
@@ -235,6 +239,14 @@
 Type: text
 _Description: Installing the kernel...
 
+Template: base-installer/section/install_kernel_package
+Type: text
+_Description: Installing the kernel - getting and installing ${SUBST0}...
+
+Template: base-installer/section/install_kernel_package_long
+Type: text
+_Description: Installing the kernel - getting and installing ${SUBST0}... (this may take a long time)
+
 Template: base-installer/section/install_pcmcia_modules
 Type: text
 _Description: Installing the PCMCIA modules
diff -u ./postinst new/postinst
--- ./postinst	2004-09-09 20:17:10.000000000 +0200
+++ new/postinst	2004-09-10 11:19:46.000000000 +0200
@@ -670,6 +670,8 @@
 
 	if [ yes = "$do_initrd" ] ; then
 		info "Installing initrd-tools."
+		db_subst "base-installer/section/install_kernel_package" SUBST0 "initrd-tools"
+		db_progress INFO "base-installer/section/install_kernel_package"
 		# Make sure initrd-tools is installed before we change its
 		# configuration
 		if ! apt-install initrd-tools 2>> $LOGFILE ; then
@@ -696,11 +698,17 @@
 		info "Not installing initrd-tools."
 	fi
 
+	# Advance progress bar to 15% of allocated space for install_kernel
+	WRK_POS=$((POS + step * 15 / 100))
+	db_progress SET $WRK_POS
+
 	# Installing mkvmlinuz on the powerpc subarches that need it.
 	if [ "$ARCH" = "powerpc" -a "$(uname -r | cut -d . -f 1,2)" = "2.6" ]; then
 		case "$SUBARCH" in
 			prep | chrp | chrp_pegasos)
 				info "Installing mkvmlinuz."
+				db_subst "base-installer/section/install_kernel_package" SUBST0 "mkvmlinuz"
+				db_progress INFO "base-installer/section/install_kernel_package"
 				apt-install mkvmlinuz 2>> $LOGFILE || true
 				cat >> /target/etc/kernel-img.conf <<EOF
 postinst_hook = /usr/sbin/mkvmlinuz
@@ -709,9 +717,19 @@
 		esac
 	fi
 
+	# Advance progress bar to 30% of allocated space for install_kernel
+	WRK_POS=$((POS + step * 30 / 100))
+	db_progress SET $WRK_POS
+
 	info "Installing kernel '$KERNEL'."
+	db_subst "base-installer/section/install_kernel_package_long" SUBST0 "$KERNEL"
+	db_progress INFO "base-installer/section/install_kernel_package_long"
 	apt-install "$KERNEL" 2>> $LOGFILE || kernel_install_failed=$?
 
+	# Advance progress bar to 90% of allocated space for install_kernel
+	WRK_POS=$((POS + step * 90 / 100))
+	db_progress SET $WRK_POS
+
 	# /proc/filesystems will accomodate this past the second bootup.
 	if [ "$do_initrd" = yes ]; then
 		sed -e 's/^ROOT=.*/ROOT=probe/' $mkinitrdconf > $mkinitrdconf.new && mv $mkinitrdconf.new $mkinitrdconf
@@ -747,12 +765,21 @@
 	
 	if [ -f /var/lib/apt-install/queue ] ; then
 		# We need to install these one by one in case one fails.
+		NR_PKG=`cat /var/lib/apt-install/queue | wc -w`
+		CURR_PKG=0
 		for PKG in `cat /var/lib/apt-install/queue`; do
+			db_subst "base-installer/section/install_extra_package" SUBST0 "$PKG"
+			db_progress INFO "base-installer/section/install_extra_package"
+
 			if apt-install $PKG >> $LOGFILE 2>&1 ; then
 				info "Installed $PKG successfully into /target/"
 			else
 				warning "Failed to install $PKG into /target/: $?"
 			fi
+
+			# Advance progress bar within space allocated for install_extra
+			WRK_POS=$((POS + step * ++CURR_PKG / NR_PKG))
+			db_progress SET $WRK_POS
 		done
 	fi
 }
@@ -776,7 +803,7 @@
 waypoint 3	apt_update
 waypoint 2	create_devices
 waypoint 1	pick_kernel
-waypoint 10	install_kernel
+waypoint 35	install_kernel
 case "$ARCH" in
 	i386*)
 		if [ -e /proc/bus/pccard/drivers ]; then
@@ -784,7 +811,7 @@
 		fi
 	;;
 esac
-waypoint 5	install_extra
+waypoint 15	install_extra
 waypoint 0	cleanup
 
 db_progress START 0 $NUM_STEPS base-installer/progress/installing-debian

Reply to: