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
|
#!/bin/sh
. /usr/share/debconf/confmodule
. /lib/partman/definitions.sh
dev_to_partman () {
local dev_name="$1"
local mapped_dev_name="$(mapdevfs $dev_name)"
if [ -n "$mapped_dev_name" ]; then
dev_name="$mapped_dev_name"
fi
for dev in $DEVICES/*; do
# mapdevfs both to allow for different ways to refer to the
# same device using devfs, and to allow user input in
# non-devfs form
if [ "$(mapdevfs $(cat $dev/device))" = "$dev_name" ]; then
echo $dev
fi
done
}
# Only run the first time.
if [ -f /var/lib/partman/initial_auto ]; then
exit 0
fi
[ -d /var/lib/partman ] || mkdir /var/lib/partman
touch /var/lib/partman/initial_auto
# See if a disk to autopartition has been set.
db_get partman-auto/disk
if [ -n "$RET" ]; then
disk="$RET"
id=$(dev_to_partman "$disk") || true
if [ -n "$id" ]; then
autopartition "$id"
exit 0
fi
fi
echo "partman-auto/init_automatically_partition" > /lib/partman/automatically_partition/question
. /lib/partman/definitions.sh
ask_user /lib/partman/automatically_partition
code=$?
echo "partman-auto/automatically_partition" > /lib/partman/automatically_partition/question
|