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 60 61 62 63 64 65 66
|
#!/bin/sh
# parts based on initial_auto from partman_auto
# parts based on partman-md's do_option for choose_partition
. /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
}
# See if we are supposed to run and only run once
db_get partman-auto/method
if [ "$RET" != raid ] || \
[ -f /var/lib/partman/initial_auto_raid ]; then
exit 0
fi
[ -d /var/lib/partman ] || mkdir /var/lib/partman
touch /var/lib/partman/initial_auto_raid
confirm_changes "partman-md" || exit 1
# Commit the changes
for s in /lib/partman/commit.d/*; do
if [ -x $s ]; then
$s || {
db_input critical partman/text/commit_failed || true
db_go || true
for s in /lib/partman/init.d/*; do
if [ -x $s ]; then
$s || exit 255
fi
done
exit 1
}
fi
done
stop_parted_server
RET=""
auto-raidcfg || RET=$?
if [ "$RET" ] && [ "$RET" -ne 9 ]; then
db_set partman-auto-raid/error false
db_input critical partman-auto-raid/error
db_go
exit 1
fi
touch /var/lib/partman/do_initial_auto_raid_fs
restart_partman
|