Codebase list partman-auto / 21d61ba
Filter out reused partitions when calculating the size used by a recipe (LP: #1197766). Colin Watson 10 years ago
2 changed file(s) with 25 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
0 partman-auto (113) UNRELEASED; urgency=low
1
2 * Filter out reused partitions when calculating the size used by a recipe
3 (LP: #1197766).
4
5 -- Colin Watson <[email protected]> Mon, 30 Sep 2013 15:47:11 +0100
6
07 partman-auto (112) unstable; urgency=low
18
29 * Skip installer disk when using
340340 done
341341 }
342342
343 filter_reused () {
344 scheme_reused=$(
345 foreach_partition '
346 if echo "$*" | grep -q '\''\$reuse{'\''; then
347 echo "$*"
348 fi'
349 )
350 scheme=$(
351 foreach_partition '
352 if ! echo "$*" | grep -q '\''\$reuse{'\''; then
353 echo "$*"
354 fi'
355 )
356 }
357
343358 choose_recipe () {
344359 local recipes recipedir free_size choices min_size type target
345360
357372 if [ ! -z "$RET" ] && [ -e "$RET" ]; then
358373 recipe="$RET"
359374 decode_recipe $recipe $type
375 filter_reused
360376 min_size=$(min_size)
361377 if [ $min_size -le $free_size ]; then
362378 return 0
383399 for recipe in $recipedir/*; do
384400 [ -f "$recipe" ] || continue
385401 decode_recipe $recipe $type
402 filter_reused
386403 if [ $(min_size) -le $free_size ]; then
387404 choices="${choices}${recipe}${TAB}${name}${NL}"
388405 if [ "$default_recipe" = no ]; then
418435 expand_scheme() {
419436 # Filter out reused partitions first, as we don't want to take
420437 # account of their size.
421 scheme_reused=$(
422 foreach_partition '
423 if echo "$*" | grep -q '\''\$reuse{'\''; then
424 echo "$*"
425 fi'
426 )
427 scheme=$(
428 foreach_partition '
429 if ! echo "$*" | grep -q '\''\$reuse{'\''; then
430 echo "$*"
431 fi'
432 )
438 filter_reused
433439
434440 # Make factors small numbers so we can multiply on them.
435441 # Also ensure that fact, max and fs are valid