Bug#270969: [patch] Improved progress bar information
Here's the new patch. I've made some other changes to make the use of
variables a bit more consistent.
I've corrected the timings. They are now consistent with a i386 netinst CD
installation using the 2.6 kernel.
Joey: could you check and commit it?
I have tested the new script during an actual installation, but again without
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 20:10:32.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 - retrieving and installing ${SUBST0}...
+
Template: base-installer/section/create_devices
Type: text
_Description: Creating device files...
@@ -235,6 +239,10 @@
Type: text
_Description: Installing the kernel...
+Template: base-installer/section/install_kernel_package
+Type: text
+_Description: Installing the kernel - retrieving and installing ${SUBST0}...
+
Template: base-installer/section/install_pcmcia_modules
Type: text
_Description: Installing the PCMCIA modules
diff -u ./postinst new/postinst
--- ./postinst 2004-09-10 20:23:34.000000000 +0200
+++ new/postinst 2004-09-10 22:00:42.000000000 +0200
@@ -21,6 +21,10 @@
DEBCONF_ADMIN_EMAIL=""
export DEBCONF_ADMIN_EMAIL
+# Variables used to set the progress bar
+PB_POSITION=0
+PB_WAYPOINT_LENGTH=0
+
db_get debian-installer/kernel/subarchitecture
SUBARCH="$RET"
@@ -45,6 +49,13 @@
exit 1
}
+update_progress () {
+ # Updates the progress bar to a new position within the space allocated
+ # for the current waypoint.
+ NW_POS=$(($PB_POSITION + $PB_WAYPOINT_LENGTH * $1 / $2))
+ db_progress SET $NW_POS
+}
+
check_target () {
# Make sure something is mounted on the target.
# Partconf causes the latter format.
@@ -670,8 +681,11 @@
if [ yes = "$do_initrd" ] ; then
info "Installing initrd-tools."
+
# Make sure initrd-tools is installed before we change its
# configuration
+ db_subst "base-installer/section/install_kernel_package" SUBST0 "initrd-tools"
+ db_progress INFO "base-installer/section/install_kernel_package"
if ! apt-install initrd-tools 2>> $LOGFILE ; then
exit_error base-installer/kernel/failed-initrd-tools-install
fi
@@ -696,11 +710,16 @@
info "Not installing initrd-tools."
fi
+ # Advance progress bar to 15% of allocated space for install_kernel
+ update_progress 15 100
+
# 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 +728,18 @@
esac
fi
+ # Advance progress bar to 30% of allocated space for install_kernel
+ update_progress 30 100
+
+ # Install the kernel
info "Installing kernel '$KERNEL'."
+ db_subst "base-installer/section/install_kernel_package_long" SUBST0 "$KERNEL"
+ db_progress INFO "base-installer/section/install_kernel_package"
apt-install "$KERNEL" 2>> $LOGFILE || kernel_install_failed=$?
+ # Advance progress bar to 90% of allocated space for install_kernel
+ update_progress 90 100
+
# /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 +775,21 @@
if [ -f /var/lib/apt-install/queue ] ; then
# We need to install these one by one in case one fails.
+ PKG_COUNT=`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
+ CURR_PKG=$(($CURR_PKG + 1))
+ update_progress $CURR_PKG $PKG_COUNT
done
fi
}
@@ -766,7 +803,7 @@
NUM_STEPS=0
waypoint () {
WAYPOINTS="$WAYPOINTS $1:$2"
- NUM_STEPS=$(expr $NUM_STEPS + $1) || true
+ NUM_STEPS=$(($NUM_STEPS + $1)) || true
}
waypoint 1 check_target
@@ -776,7 +813,7 @@
waypoint 3 apt_update
waypoint 2 create_devices
waypoint 1 pick_kernel
-waypoint 10 install_kernel
+waypoint 20 install_kernel
case "$ARCH" in
i386*)
if [ -e /proc/bus/pccard/drivers ]; then
@@ -784,19 +821,18 @@
fi
;;
esac
-waypoint 5 install_extra
+waypoint 10 install_extra
waypoint 0 cleanup
db_progress START 0 $NUM_STEPS base-installer/progress/installing-debian
-POS=0
for item in $WAYPOINTS; do
- step=$(echo $item | cut -d: -f 1)
- waypoint=$(echo $item | cut -d: -f 2)
+ PB_WAYPOINT_LENGTH=$(echo $item | cut -d: -f 1)
+ WAYPOINT=$(echo $item | cut -d: -f 2)
# Not all of the section headers need exist.
- db_progress INFO "base-installer/section/$waypoint" || true
- eval $waypoint
- POS=$(expr $POS + $step) || true
- db_progress SET $POS
+ db_progress INFO "base-installer/section/$WAYPOINT" || true
+ eval $WAYPOINT
+ PB_POSITION=$(($PB_POSITION + $PB_WAYPOINT_LENGTH)) || true
+ db_progress SET $PB_POSITION
done
db_progress STOP
exit 0
Reply to: