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

[RFR] Display selected target for partitioning when choosing a recipe



> BTW. I also noticed that with "Use the largest continuous free space"
> there is currently no indication of what disk will actually be used
> or how big the free space is. It is of course kind of implied
> (whichever disk has the largest free space), but IMO it would be kind
> of nice to tell the user before it is done.

In #391071 I proposed to display the target selected for partitioning in 
the dialog for selecting a recipe. I've put together a patch (attached) 
and I'd appreciate some feedback on that.

Here's how it currently looks:
- full disk:
  http://people.debian.org/~fjp/d-i/d-i_recipe_disk.png
- largest free space:
  http://people.debian.org/~fjp/d-i/d-i_recipe_free-space.png

I'm not completely happy with how the size is displayed.
I also wonder if it really adds enough to implement it.

Cheers,
FJP

Index: partman-auto-lvm/debian/control
===================================================================
--- partman-auto-lvm/debian/control	(revision 41390)
+++ partman-auto-lvm/debian/control	(working copy)
@@ -9,5 +9,5 @@
 Package: partman-auto-lvm
 XC-Package-Type: udeb
 Architecture: all
-Depends: ${misc:Depends}, partman-base (>= 73), partman-auto (>= 55), partman-lvm (>= 36), di-utils (>= 1.15), lvm2-udeb
+Depends: ${misc:Depends}, partman-base (>= 73), partman-auto (>= 58), partman-lvm (>= 36), di-utils (>= 1.15), lvm2-udeb
 Description: Automatically partition storage devices using LVM
Index: partman-auto-lvm/debian/changelog
===================================================================
--- partman-auto-lvm/debian/changelog	(revision 41391)
+++ partman-auto-lvm/debian/changelog	(working copy)
@@ -4,8 +4,9 @@
     Closes: #368633.
   * Change description for method.
   * Avoid double sourcing of common functions.
+  * Display selected target for partitioning when choosing a recipe.
 
- -- Frans Pop <fjp@debian.org>  Sat,  7 Oct 2006 04:44:32 +0200
+ -- Frans Pop <fjp@debian.org>  Sun,  8 Oct 2006 04:12:42 +0200
 
 partman-auto-lvm (15) unstable; urgency=low
 
Index: partman-auto-lvm/auto-lvm_tools.sh
===================================================================
--- partman-auto-lvm/auto-lvm_tools.sh	(revision 41391)
+++ partman-auto-lvm/auto-lvm_tools.sh	(working copy)
@@ -10,13 +10,12 @@
 }
 
 auto_lvm_prepare() {
-	local dev method free_size normalscheme
+	local dev method size free_size normalscheme target
 	dev=$1
 	method=$2
 
 	[ -f $dev/size ] || return 1
-	free_size=$(cat $dev/size)
-	free_size=$(expr 0000000"$free_size" : '0*\(..*\)......$') # convert to megabytes
+	size=$(cat $dev/size)
 
 	# Be sure the modules are loaded
 	modprobe dm-mod >/dev/null 2>&1 || true
@@ -26,8 +25,12 @@
 		log-output -t update-dev update-dev
 	fi
 
-	choose_recipe "$free_size" lvm || return $?
+	target="$(humandev $(cat $dev/device)) - $(cat $dev/model)"
+	target="$target: $(longint2human $size)"
+	free_size=$(expr 0000000"$size" : '0*\(..*\)......$') # convert to megabytes
 
+	choose_recipe lvm "$target" "$free_size" || return $?
+
 	wipe_disk || return $?
 
 	# Check if partition is usable; use existing partman-auto template as we depend on it
Index: partman-auto/debian/partman-auto.templates
===================================================================
--- partman-auto/debian/partman-auto.templates	(revision 41422)
+++ partman-auto/debian/partman-auto.templates	(working copy)
@@ -69,6 +69,10 @@
 Type: select
 Choices: ${CHOICES}
 _Description: Partitioning scheme:
+ Selected for partitioning:
+ .
+ ${TARGET}
+ .
  The disk can be partitioned using one of several different schemes.
  If you are unsure, choose the first one.
 
Index: partman-auto/debian/changelog
===================================================================
--- partman-auto/debian/changelog	(revision 41422)
+++ partman-auto/debian/changelog	(working copy)
@@ -8,12 +8,13 @@
   * Activate LVM support in recipes for hppa.
   * Implement selection of method before disk for regular guided partitioning.
     Closes: #391071.
+  * Display selected target for partitioning when choosing a recipe.
 
   [ Simon Huggins ]
   * Add a raid method so we get multiple disk partitioning functionality back
     again.
 
- -- Frans Pop <fjp@debian.org>  Sat,  7 Oct 2006 03:33:30 +0200
+ -- Frans Pop <fjp@debian.org>  Sun,  8 Oct 2006 14:41:10 +0200
 
 partman-auto (57) unstable; urgency=low
 
Index: partman-auto/autopartition
===================================================================
--- partman-auto/autopartition	(revision 41422)
+++ partman-auto/autopartition	(working copy)
@@ -5,29 +5,33 @@
 . /lib/partman/auto-shared.sh
 
 dev=$1
+cd $dev
 
+[ -f size ] || exit 1
+size=$(cat size)
+target="$(humandev $(cat device)) - $(cat model)"
+
 if [ -z "$2" ]; then
 	# Only one parameter. Being run for initial autopartitioning.
 
-	[ -f $dev/size ] || exit 1
-	free_size=$(cat $dev/size)
-	free_size=$(expr 0000000"$free_size" : '0*\(..*\)......$') # convert to megabytes
+	target="$target: $(longint2human $size)"
+	free_size=$(expr 0000000"$size" : '0*\(..*\)......$') # convert to megabytes
 
-	choose_recipe "$free_size" default || exit $?
+	choose_recipe default "$target" "$free_size" || exit $?
 
 	wipe_disk || exit $?
 else
 	# Two parameters, being run on selected free space.
 	free_space=$2
 	
-	cd $dev
 	open_dialog PARTITION_INFO $free_space
 	read_line x1 x2 free_size x3 x4 x5 x6
 	close_dialog
 
+	target="$target: $(longint2human $free_size)/$(longint2human $size)"
 	free_size=$(expr 0000000"$free_size" : '0*\(..*\)......$') # convert to megabytes
 
-	choose_recipe "$free_size" default || exit $?
+	choose_recipe default "$target" "$free_size" || exit $?
 fi
 
 perform_recipe $dev $free_space $recipe || exit $?
Index: partman-auto/recipes.sh
===================================================================
--- partman-auto/recipes.sh	(revision 41422)
+++ partman-auto/recipes.sh	(working copy)
@@ -286,7 +286,11 @@
 }
 
 choose_recipe () {
-    local recipes recipedir free_size choices min_size
+    local recipes recipedir free_size choices min_size type target
+
+    type=$1
+    target="$2"
+    free_size=$3
     
     # Preseeding of recipes.
     db_get partman-auto/expert_recipe
@@ -297,7 +301,7 @@
     db_get partman-auto/expert_recipe_file
     if [ ! -z "$RET" ] && [ -e "$RET" ]; then
         recipe="$RET"
-	decode_recipe $recipe $2
+	decode_recipe $recipe $type
 	if [ $(min_size) -le $free_size ]; then
 	    return 0
 	else
@@ -308,14 +312,13 @@
 
     recipedir=$(get_recipedir)
     
-    free_size=$1
     choices=''
     default_recipe=no
     db_get partman-auto/choose_recipe
     old_default_recipe="$RET"
     for recipe in $recipedir/*; do
 	[ -f "$recipe" ] || continue
-	decode_recipe $recipe $2
+	decode_recipe $recipe $type
 	if [ $(min_size) -le $free_size ]; then
 	    choices="${choices}${recipe}${TAB}${name}${NL}"
 	    if [ no = "$default_recipe" ]; then
@@ -333,6 +336,7 @@
        return 1
     fi
  
+    db_subst partman-auto/choose_recipe TARGET "$target"
     debconf_select high partman-auto/choose_recipe "$choices" "$default_recipe"
     if [ "$?" = 255 ]; then
 	exit 0

Attachment: pgp6OHddsyM1E.pgp
Description: PGP signature


Reply to: