Bug#653305: partman-auto: Please provide hook when disk is too small for the expert recipe
I discovered a typo in my patch. $min_size should have been
$(min_size), and this lead me to discover that the min_size() function
would calculate the size every time it is called. To avoid wasting
that time, I store the value in a variable at least for the duration
of the if block. Here is an updated patch.
--- a/lib/recipes.sh
+++ b/lib/recipes.sh
@@ -328,11 +328,20 @@ choose_recipe () {
if [ ! -z "$RET" ] && [ -e "$RET" ]; then
recipe="$RET"
decode_recipe $recipe $type
- if [ $(min_size) -le $free_size ]; then
+ min_size=$(min_size)
+ if [ $min_size -le $free_size ]; then
return 0
else
logger -t partman-auto \
- "Available disk space ($free_size) too small for expert recipe ($(min_size)); skipping"
+ "Available disk space ($free_size) too small for expert recipe ($min_size); skipping"
+ hookdir=/lib/partman/not-enough-space.d
+ if [ -d $hookdir ] ; then
+ for h in $hookdir/* ; do
+ if [ -x $h ] ; then
+ $h $recipe $free_size $min_size
+ fi
+ done
+ fi
fi
fi
--
Happy hacking
Petter Reinholdtsen
Reply to: