1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
#!/bin/sh
. /lib/partman/definitions.sh
have_prep=no
good_place=no
# Is there at least one prep-partition?
for dev in $DEVICES/*; do
[ -d "$dev" ] || continue
cd $dev
partitions=
open_dialog PARTITIONS
while { read_line num id size type fs path name; [ "$id" ]; }; do
[ "$fs" != free ] || continue
partitions="$partitions $id,$path"
done
close_dialog
for part in $partitions; do
id=${part%,*}
part=${part#*,}
[ -f $id/method ] || continue
method=$(cat $id/method)
if [ "$method" = prep ]; then
end=${id#*-}
have_prep=yes
if longint_le "$end" 8589934592; then
good_place=yes
good_paths="${good_paths:+$good_paths,}$path"
fi
fi
done
done
if [ $good_place = no ]; then
if [ $have_prep = no ]; then
db_fset partman-prep/no_prep seen false
db_input critical partman-prep/no_prep || true
db_go || exit 1
db_get partman-prep/no_prep
if [ "$RET" = 'true' ]; then
exit 1
fi
else
db_fset partman-prep/wrong_place seen false
db_input critical partman-prep/wrong_place || true
db_go || exit 1
db_get partman-prep/wrong_place
if [ "$RET" = 'true' ]; then
exit 1
fi
fi
fi
db_set partman-prep/boot_partitions "$good_paths"
exit 0
|