Filter out reused partitions when calculating the size used by a recipe (LP: #1197766).
Colin Watson
10 years ago
|
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 |
|
0 | 7 |
partman-auto (112) unstable; urgency=low
|
1 | 8 |
|
2 | 9 |
* Skip installer disk when using
|
340 | 340 |
done
|
341 | 341 |
}
|
342 | 342 |
|
|
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 |
|
343 | 358 |
choose_recipe () {
|
344 | 359 |
local recipes recipedir free_size choices min_size type target
|
345 | 360 |
|
|
357 | 372 |
if [ ! -z "$RET" ] && [ -e "$RET" ]; then
|
358 | 373 |
recipe="$RET"
|
359 | 374 |
decode_recipe $recipe $type
|
|
375 |
filter_reused
|
360 | 376 |
min_size=$(min_size)
|
361 | 377 |
if [ $min_size -le $free_size ]; then
|
362 | 378 |
return 0
|
|
383 | 399 |
for recipe in $recipedir/*; do
|
384 | 400 |
[ -f "$recipe" ] || continue
|
385 | 401 |
decode_recipe $recipe $type
|
|
402 |
filter_reused
|
386 | 403 |
if [ $(min_size) -le $free_size ]; then
|
387 | 404 |
choices="${choices}${recipe}${TAB}${name}${NL}"
|
388 | 405 |
if [ "$default_recipe" = no ]; then
|
|
418 | 435 |
expand_scheme() {
|
419 | 436 |
# Filter out reused partitions first, as we don't want to take
|
420 | 437 |
# 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
|
433 | 439 |
|
434 | 440 |
# Make factors small numbers so we can multiply on them.
|
435 | 441 |
# Also ensure that fact, max and fs are valid
|